Lahey/Fujitsu Fortran

Source Form

Fortran offers two source forms: fixed and free.

Fixed Source Form

Fixed source form is the traditional Fortran source form and is based on the columns of a punched card. There are restrictions on where statements and labels can appear on a line. Except in CHARACTER literals, blanks are ignored.

Except within a comment:

Fixed source form comments are formed by beginning a line with a `C' or a `*' in column 1. Additionally, trailing comments can be formed by placing a `!' in any column except column 6. A `!' in a CHARACTER literal does not indicate a trailing comment. Comment lines must not be continued, but a continuation line can contain a trailing comment. An END statement must not be continued.

The `;' character can be used to separate statements on a line. If it appears in a CHARACTER literal or in a comment, the `;' character is not interpreted as a statement separator.

Free Source Form

In free source form, there are no restrictions on where a statement can appear on a line. A line can be up to 132 characters long. Blanks are used to separate names, constants, or labels from adjacent names, constants, or labels. Blanks are also used to separate Fortran keywords, with the following exceptions, for which the blank separator is optional:

The `!' character begins a comment except when it appears in a CHARACTER literal. The comment extends to the end of the line.

The `;' character can be used to separate statements on a line. If it appears in a CHARACTER literal or in a comment, the `;' character is not interpreted as a statement separator.

The `&' character as the last non-comment, non-blank character on a line indicates the line is to be continued on the next non-comment line. If a name, constant, keyword, or label is split across the end of a line, the first non-blank character on the next non-comment line must be the `&' character followed by successive characters of the name, constant, keyword, or label. If a CHARACTER literal is to be continued, the `&' character ending the line cannot be followed by a trailing comment. A free source form statement can have up to 39 continuation lines.

Comment lines cannot be continued, but a continuation line can contain a trailing comment. A line cannot contain only an `&' character or contain an `&' character as the only character before a comment.