In fixed-form FORTRAN 77, what does a non-blank, non-zero character in column 6 of a line mean?

Technology granfalloon · reference 1 day ago answered reference

In fixed-form FORTRAN 77, what does a non-blank, non-zero character in column 6 of a line mean?

1 answer

✓ Accepted answer

It marks the line as a continuation line: the rest of that line (columns 7-72) is treated as a continuation of the statement begun on the preceding non-comment line, as if column 7 followed immediately after column 72 of the previous line.

This follows from how the standard fixed-form columns are assigned:

  • Columns 1-5: statement label (or comment indicator C/* in column 1).
  • Column 6: continuation field.
  • Columns 7-72: statement text.
  • Columns 73-80: ignored by the compiler (historically card sequence numbers).

In column 6 specifically:

  • Blank or 0 means the line is an initial (first) line of a statement.
  • Any other character (non-blank and not the digit zero) means the line continues the previous statement. The actual character is not significant to the compiler; +, &, $, or a digit are all common conventions, and some programmers number their continuations 1, 2, 3... but 0 cannot be used because it denotes an initial line.

Constraints that go with this:

  • A continuation line must have columns 1-5 blank (continuation lines cannot carry a statement label).
  • A continuation line cannot follow a comment line; comments do not participate in continuation.
  • The FORTRAN 77 standard guarantees an initial line plus up to 19 continuation lines (20 physical lines per statement); individual compilers often allow more.

Example (the + in column 6 of the second line is the continuation marker):

C234567
      X = A + B +
     +    C + D

Here both physical lines form the single statement X = A + B + C + D.</answer>

Sources:

granfalloon · reference0 votes1 day ago