A free source form line can specify up to 132 characters on each
line. In XL Fortran,
there is no limit to the number of continuation lines for a statement,
but the statement cannot be longer than 34 000 characters. Fortran 2003 limits
the number of continuation lines to 255, while Fortran 95 limits
the number of continuation lines to 39.
Items can begin in any column of a line, subject to the following
requirements for lines and items on those lines:
- A comment line is a line of white space or begins with an exclamation
mark that is not in a character context.
- An initial line can contain any of the following items, in the
following sequence:
- A statement label.
- Statement text. Note that statement text is required in an initial
line.
- Additional statements.
- The ampersand continuation character.
- An inline comment.
- If you want to continue an initial line or continuation line in
a non-character context, the continuation line must start on the first
noncomment line that follows the intial line or continuation line.
To define a line as a continuation line, you must place an ampersand
after the statements on the previous non-comment line.
- White space before and after the ampersand is optional, with the
following restrictions:
- If you also place an ampersand in the first nonblank character
position of the continuation line, the statement continues at the
next character position following the ampersand.
- If a lexical token is continued, the ampersand must immediately
follow the initial part of the token, and the remainder of the token
must immediately start after the ampersand on the continuation line.
- A character context can be continued if the following conditions
are true:
- The last character of the continued line is an ampersand and is
not followed by an inline comment. If the rightmost character of the
statement text to be continued is an ampersand, you must enter a second
ampersand as a continuation character.
- The first nonblank character of the next noncomment line is an
ampersand.
A semicolon separates statements on a single source
line, except when the semicolon appears in a character context or
in a comment. Two or more separators that are on the same
line and are themselves separated by only white space or other semicolons
are considered to be a single separator. A separator that is the last
character on a line or before an inline comment is ignored. Additional
statements cannot follow a program unit END statement
on the same line.