The FORTRAN character set consists of twenty-six letters,
ten digits, and thirteen special characters.
A
letter
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
A
digit
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
appropriate.
An
alphanumeric character
is a letter or a digit.
A
special character
is one of the thirteen characters:
__________________________________
| | |
|_Character|__Name_of_Character___|
| | |
| | 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
3.1.1 specifies
the collating sequence for the letters; A is less than
Z.
The order in which the digits are listed in
3.1.2 specifies
the collating sequence for the digits; 0 is less than
9.
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.
The
order in which the special characters are listed in
3.1.4
does not imply a collating sequence.
Except for the currency symbol, the graphics used for the
forty-nine characters must be as given in
3.1.1,
3.1.2, and
3.1.4.
However,
the style of any graphic is not specified.
With the exception of the uses specified (
3.2.2,
3.2.3,
3.3,
4.8,
4.8.1,
13.5.1, and
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
(
3.3).
A
line
in a program unit is a sequence of 72 characters.
All characters must be from the FORTRAN character set,
except as described in
3.2.1,
4.8,
12.2.2, and
13.2.1.
The character positions in a line are called
columns
and
are numbered consecutively 1, 2, through 72.
The number
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.
A
comment line
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.
An
initial line
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 (
3.4),
or each of the columns 1 through 5 must contain the
character blank.
A
continuation line
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
continuation lines.
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
statement.
Note that a statement must contain no more
than 1320 characters.
Except as part of a logical IF
statement (
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
statements.
However, blank characters do count as
characters in the limit of total characters allowed in any
one statement.
Statement labels provide a means of referring to individual
statements.
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
statement.
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
executable statements;
- all statement function statements must precede all
executable statements;
- 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;
the PARAMETER
statement must precede all other statements containing the
symbolic names of constants that are defined in the PARAMETER
statement.
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 |
|__________________________________________________________|
| |
|______________________END_Statement_______________________|
Figure 1 is a diagram of the required order of statements
and comment lines for a program unit.
Vertical lines
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
statements.
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
unit.
Execution of an executable program begins with the
execution of the first executable statement of the main
program.
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.
A
transfer of control
is an alteration of the normal
execution sequence.
Statements that may cause a transfer of control
are:
- GO TO
- Arithmetic IF
- RETURN
- STOP
- 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
forms
- Block IF and ELSE IF
- The last statement, if any, of an
IF-block or ELSE IF-block
- DO
- The terminal statement of a DO-loop
- END
The effect of these statements on the execution sequence
is described in Sections
11,
12, and
15.
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
procedure.
'
[Contents] [Previous] [Next]
This document was translated by troff2html v0.21 on August 16, 1995.