View previous topic :: View next topic |
Author |
Message |
stfark1
Joined: 02 Sep 2008 Posts: 222
|
Posted: Tue Apr 18, 2023 8:51 pm Post subject: Fixed Fortran |
|
|
Been writing in Fortran for several years, always using the Fixed Fortran. Is Variable Length Fortran upward compatible? In other words, can I enter variable length Fortran statements into fixed Fortran or? Please advise, Sid Kraft |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 711 Location: Hamilton, Lanarkshire, Scotland.
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8017 Location: Salford, UK
|
Posted: Wed Apr 19, 2023 6:52 am Post subject: |
|
|
Sid
I think that you would need to give an example of what you would like to do. But then, you could always try it and see whether or not it works.
Fixed format means that labels, statements etc. must appear in specific columns. Free format has fewer restrictions (labels must appear before statements etc.).
Typically, for FTN95, fixed Fortran files are given the .for extension whilst free Format files have the .f90 or .f95 extension. Alternatively you can use /FREE or /FIXED on the FTN95 command line. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Wed Apr 19, 2023 4:47 pm Post subject: |
|
|
Sid,
You can write your source code so that it works both ways. For an example, look at CLRWIN.INS.
The trick is to put the & character in column 73 of the line to be continued, and use the & character in column 6 of the continuation line. You can do it multiple times.
I used to use column 6 continuation characters in the order 1, 2, 3 ... when there was a risk of dropping cards, but it is easy to use & instead.
Eddie |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2585 Location: Sydney
|
Posted: Mon Apr 24, 2023 6:20 am Post subject: |
|
|
Interesting that the requirement for puting line numbers in columns 74+ ended when I stopped using cards in '74
Eddie is correct to note the most significant difference between fixed and free format Fortran is the use of line extensions in column 6.
Free format ( which extends the line from col 72 to col 132 ) is a much easier/flexible format to use, where the line continuation character & is placed at the end of each continued line and optionally at the start of each subsequent continued line. |
|
Back to top |
|
|
|