Rules for Fixed Format Fortran: A Comprehensive Guide

  • Context: Fortran 
  • Thread starter Thread starter swartzism
  • Start date Start date
  • Tags Tags
    Format Fortran Rules
Click For Summary

Discussion Overview

The discussion centers on the rules and guidelines for fixed format Fortran, particularly in relation to file extensions such as .f77, .f, and .for. Participants explore the historical context and specific formatting rules associated with these file types.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about existing rule guides for fixed format Fortran, referencing a specific resource that outlines basic formatting rules.
  • Another participant challenges the characterization of the referenced resource as "a few snippets," arguing that it provides a complete description of fixed-form Fortran.
  • There is a question regarding whether the rules for .f and .for files differ from those for .f77.
  • One participant asserts that there is a single fixed format for Fortran, which is a remnant from the punch card era, and notes that file extensions are only significant for free-form formats like .f90 or .f95.
  • Another participant adds historical context, stating that the formatting rules have been in use since at least Fortran 66 and are tied to the limitations of punch cards.
  • A light-hearted comment is made about the transition from punch cards to modern coding practices.

Areas of Agreement / Disagreement

Participants express differing views on the completeness of the formatting description and whether the rules vary by file extension. The discussion remains unresolved regarding the specifics of formatting rules across different file types.

Contextual Notes

There is a lack of consensus on the applicability of the rules to different file extensions, and the historical context of punch cards is mentioned but not fully explored in terms of its implications for modern usage.

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:
 

Similar threads

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