Silverfrost Forums

Welcome to our forums

Fixed Fortran

18 Apr 2023 7:51 #30202

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

18 Apr 2023 11:35 #30203

See the following information, which may help: https://www.nsc.liu.se/~boein/f77to90/c5.html

19 Apr 2023 5:52 #30204

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.

19 Apr 2023 3:47 #30207

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

24 Apr 2023 5:20 #30219

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.

Please login to reply.