Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran Fixed Format Fortran Rules

  1. Nov 24, 2015 #1
    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!
  2. jcsd
  3. Nov 24, 2015 #2


    User Avatar

    Staff: Mentor

    I don't understand why you are calling that "a few snippets." This is a complete description of fixed-form Fortran.
  4. Nov 24, 2015 #3
    Yes, but isn't that just for .f77? Do .f and .for have different rules?
  5. Nov 24, 2015 #4


    User Avatar

    Staff: Mentor

    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.
  6. Nov 24, 2015 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    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:


    A Fortran coding form:


    Ahhh... the good old days!
  7. Nov 24, 2015 #6


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    That's progress for you ! Much better than that damn flimsy old paper tape ... :rolleyes:
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook