The FORTRAN character set consists of twenty-six letters,
ten digits, and thirteen special characters.
is one of the twenty-six characters:
- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
is one of the ten characters:
- 0 1 2 3 4 5 6 7 8 9
A string of digits is interpreted in the decimal base
number system when a numeric interpretation is
is a letter or a digit.
is one of the thirteen characters:
| | |
| | |
| | Blank |
| _________| Equals |
| + | Plus |
| - | Minus |
| * | Asterisk |
| / | Slash |
| ( | Left Parenthesis |
| ) | Right Parenthesis|
| . | Decimal Point |
| , | Comma |
| $ | Currency Symbol |
| ' | Apostrophe |
| : | Colon |
The order in which the letters are listed in
the collating sequence for the letters; A is less than
The order in which the digits are listed in
the collating sequence for the digits; 0 is less than
The digits and letters must not be intermixed in the
collating sequence; all of the digits must precede A or
all of the digits must follow Z. The character blank is
less than the letter A and less than the digit 0.
order in which the special characters are listed in
does not imply a collating sequence.
Except for the currency symbol, the graphics used for the
forty-nine characters must be as given in
the style of any graphic is not specified.
With the exception of the uses specified (
13.5.2), a blank character
within a program unit has no meaning and may be used to
improve the appearance of the program unit, subject to the
restriction on the number of consecutive continuation lines
in a program unit is a sequence of 72 characters.
All characters must be from the FORTRAN character set,
except as described in
The character positions in a line are called
are numbered consecutively 1, 2, through 72.
indicates the sequential position of a character in the
line, beginning at the left and proceeding to the right.
Lines are ordered by the sequence in which they are
presented to the processor.
Thus, a program unit consists
of a totally ordered set of characters.
is any line that
contains a C or an asterisk in column 1, or contains only
blank characters in columns 1 through 72.
A comment line that
contains a C or an asterisk in column 1 may contain any
character capable of representation in the processor in
columns 2 through 72.
A comment line does not affect the executable program in
any way and may be used to provide documentation.
Comment lines may appear anywhere in the program unit.
Comment lines may precede the initial line of the first
statement of any program unit.
Comment lines may appear
between an initial line and its first continuation line
or between two continuation lines.
is any line that is not a comment line and
contains the character blank or the digit 0 in column 6.
Columns 1 through 5 may contain a statement label (
or each of the columns 1 through 5 must contain the
is any line that
contains any character of the FORTRAN character set
other than the character blank or the digit 0 in column 6
and contains only blank characters in columns 1 through 5.
A statement must not have more than nineteen
The statements of the FORTRAN language are described in
Sections 7 through 16 and are used to form program units.
Each statement is written in columns 7 through 72 of an
initial line and as many as nineteen continuation lines.
An END statement is written only in columns 7 through 72
of an initial line.
No other statement in a program unit
may have an initial line that appears to be an END
Note that a statement must contain no more
than 1320 characters.
Except as part of a logical IF
11.5), no statement may begin on a line that
contains any part of the previous statement.
Blank characters preceding, within, or following a statement
do not change the interpretation of the statement, except
when they appear within the datum strings of character
constants or the H or apostrophe edit descriptors in FORMAT
However, blank characters do count as
characters in the limit of total characters allowed in any
Statement labels provide a means of referring to individual
Any statement may be labeled, but only labeled
executable statements and FORMAT statements may be referred
to by the use of statement labels.
The form of a statement label is a sequence of one
to five digits, one of which must be nonzero. The statement
label may be placed anywhere in columns 1 through 5 of the
initial line of the statement.
The same statement label
must not be given to more than one statement in a program
unit. Blanks and leading zeros are not significant in
distinguishing between statement labels.
A PROGRAM statement may appear only as the first statement
of a main program.
The first statement of a subprogram
must be either a FUNCTION, SUBROUTINE, or BLOCK DATA
Within a program unit that permits the statements:
- FORMAT statements may appear anywhere;
- all specification statements must precede all DATA
statements, statement function statements, and
- all statement function statements must precede all
- DATA statements may appear anywhere after the
specification statements; and
- ENTRY statements may appear anywhere except between
a block IF statement and its corresponding
END IF statement, or between
a DO statement and the terminal statement of its DO-loop.
Within the specification statements of a program unit,
IMPLICIT statements must precede all other specification
statements except PARAMETER statements.
Any specification statement that specifies the type of a
symbolic name of a constant must precede the PARAMETER
statement that defines that particular symbolic
name of a constant;
statement must precede all other statements containing the
symbolic names of constants that are defined in the PARAMETER
The last line of a program unit must be an END statement.
- Figure 1
- Required Order of Statements and Comment Lines
| | |
| | PROGRAM, FUNCTION, SUBROUTINE, or |
| | ______________BLOCK_DATA_Statement_____________|
| | | | |
| | | | IMPLICIT |
| | | | Statements |
| | | PARAMETER |_________________|
| Comment | FORMAT | Statements | Other |
| Lines | and | | Specification |
| | ENTRY | | Statements |
| | Statements |______________|_________________|
| | | | Statement |
| | | | Function |
| | | DATA | Statements |
| | | Statements |_________________|
| | | | Executable |
| | | | Statements |
Figure 1 is a diagram of the required order of statements
and comment lines for a program unit.
delineate varieties of statements that may be interspersed.
For example, FORMAT statements may be interspersed with
statement function statements and executable statements.
Horizontal lines delineate varieties of statements that
must not be interspersed.
For example, statement function
statements must not be interspersed with executable
Note that an END statement is also an
executable statement and must appear only as the last
statement of a program unit.
Normal execution sequence
is the execution of executable
statements in the order in which they appear in a program
Execution of an executable program begins with the
execution of the first executable statement of the main
When an external procedure specified in a
subprogram is referenced, execution
begins with the first executable statement
that follows the FUNCTION, SUBROUTINE, or ENTRY statement
that specifies the referenced procedure
as the name of a procedure.
transfer of control
is an alteration of the normal
Statements that may cause a transfer of control
- GO TO
- Arithmetic IF
- An input/output statement containing an error
specifier or end-of-file specifier
- CALL with an alternate return specifier
- A logical IF statement containing any of the above
- Block IF and ELSE IF
- The last statement, if any, of an
IF-block or ELSE IF-block
- The terminal statement of a DO-loop
The effect of these statements on the execution sequence
is described in Sections
The normal execution sequence is not affected by the
appearance of nonexecutable statements or comment lines
between executable statements.
Execution of a function reference or a CALL statement is not considered
a transfer of control in the program unit that contains the
reference, except when control is returned to a statement
identified by an alternate return specifier in a CALL statement.
Execution of a RETURN or END statement in a referenced procedure,
or execution of a transfer of control within a referenced procedure,
is not considered a transfer of control in the program unit
that contains the reference.
In the execution of an executable program, a procedure
subprogram must not be referenced a second time without
the prior execution of a RETURN or END statement in that
webmaster MFA (main)