Fortran Rules for Fixed Format Fortran: A Comprehensive Guide

Click For Summary
The discussion centers on the rules and style guides for fixed-format Fortran, particularly for file extensions such as .f77, .f, and .for. It highlights the structure of fixed-format Fortran, which includes specific column designations for comments, statement labels, continuation lines, and actual statements, all rooted in the limitations of punch card technology. The participants clarify that while the .f77 extension is commonly referenced, the rules apply uniformly across .f and .for files as well, emphasizing that the fixed format has been consistent since Fortran 66. The conversation touches on the historical context of these formats, noting that the 80-column limit is a remnant of punch card usage, and acknowledges the evolution of programming practices away from older technologies.
swartzism
Messages
103
Reaction score
0
Are there any rule guides on fixed format Fortran such as in .f77, .f, .for files? For example, http://www.physics.nau.edu/~bowman/PHY520/F77tutor/03_basics.html has a few snippets of rules for Fortran 77 such as

Col. 1 : Blank, or a "c" or "*" for comments
Col. 1-5 : Statement label (optional)
Col. 6 : Continuation of previous line (optional; see below)
Col. 7-72 : Statements
Col. 73-80: Sequence number (optional, rarely used today)​

I'm wondering if there are any style guides floating around out there governing all of these sorts of rules for fixed (and even free) format Fortran. Thanks in advance!
 
Technology news on Phys.org
I don't understand why you are calling that "a few snippets." This is a complete description of fixed-form Fortran.
 
Yes, but isn't that just for .f77? Do .f and .for have different rules?
 
swartzism said:
Yes, but isn't that just for .f77? Do .f and .for have different rules?
No. There is a single fixed format, which is a leftover from the punch card era.

The only time the extension is important is when it is something like .f90 or .f95, where free-form is assumed.
 
swartzism said:
Yes, but isn't that just for .f77? Do .f and .for have different rules?
The statement format in the OP has been used since at least Fortran 66. The 80 column width limit is predicated on what could be fit onto old-style punch cards, which were used at one time to store and then feed a Fortran source program into a computer.

A punch card:

ibm-80-column-punched-card1.jpg

A Fortran coding form:

FortranCodingForm.png


Ahhh... the good old days!
 
That's progress for you ! Much better than that damn flimsy old paper tape ... :rolleyes:
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
Replies
2
Views
589