Rules for Fixed Format Fortran: A Comprehensive Guide

In summary, the conversation discusses the rules and format for fixed-form Fortran, which includes a statement label, statement continuation, and column width limit of 80 characters. The only time the extension is important is for free-form Fortran, and the fixed format has been used since Fortran 66. It is a remnant from the punch card era and is now considered outdated with the use of modern computers.
  • #1
swartzism
103
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
  • #2
I don't understand why you are calling that "a few snippets." This is a complete description of fixed-form Fortran.
 
  • #3
Yes, but isn't that just for .f77? Do .f and .for have different rules?
 
  • #4
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.
 
  • #5
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!
 
  • #6
That's progress for you ! Much better than that damn flimsy old paper tape ... :rolleyes:
 

What is Fixed Format Fortran?

Fixed Format Fortran is a programming language used mainly for scientific and engineering calculations. It is a structured, high-level language that is particularly well-suited for numerical computing and data processing. It was developed in the 1950s and has been updated and improved over the years.

What are the rules for writing Fixed Format Fortran code?

The rules for writing Fixed Format Fortran code are as follows:

  • Code must be written in fixed columns, with each line consisting of a specific number of characters.
  • The first 6 columns are reserved for line numbers.
  • Columns 7-72 are used for code and comments.
  • Column 73 is used for continuation markers.
  • Columns 74-80 are for sequence numbers, which are not used in modern Fortran.

What are the benefits of using Fixed Format Fortran?

Fixed Format Fortran has several benefits, including:

  • Efficient code execution, making it well-suited for complex scientific calculations.
  • Portability, as Fortran code can be easily adapted to run on different platforms.
  • High level of accuracy, as Fortran is designed specifically for numerical computing.
  • Large library of functions and subroutines for common scientific operations.
  • Long history and widespread use in the scientific community, making it a well-supported language.

What are the main differences between Fixed Format Fortran and Free Format Fortran?

The main differences between Fixed Format Fortran and Free Format Fortran are:

  • Fixed Format Fortran requires code to be written in specific columns, whereas Free Format Fortran allows for more flexibility in code layout.
  • Fixed Format Fortran uses continuation markers to indicate when a code statement continues onto the next line, whereas Free Format Fortran allows code to span multiple lines without markers.
  • Fixed Format Fortran is an older version of Fortran, while Free Format Fortran is a newer, more modern version.

Is Fixed Format Fortran still used today?

Yes, Fixed Format Fortran is still used today, although it has been largely replaced by Free Format Fortran. However, there are still many legacy codes written in Fixed Format Fortran that are in use and continue to be maintained and updated.

Similar threads

  • Programming and Computer Science
Replies
14
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
Back
Top