
FORTRAN Concepts |
2.1.2 The PROG RAM Statement
The PROGRAM statement is used to name a program. This statement is optional, but when present must be the first statement of a main program. It has the format
PROGRAM name
where 'name' is the symbolic name of the program. Only one PROGRAM statement is allowed per program. The main program can contain any other statement except FUNCTION, SUBROUTINE, BLOCK DATA, SAVE, or RETURN.
The scope of symbolic names is discussed later in this chapter (section 2.5.5). For the moment, suffice it to say that the program name is 'global' to the entire executable program. It cannot be the same as the name of an external procedure, BLOCK DATA subprogram, common block, or 'local' symbol name in the main program.
2.1.3 Statements and Lines
A
Compiler controls direct the operation of a particular FORTRAN compiler, telling it what kind of output to produce, the form of list output, etc. Controls are discuss- ed in detail in the compiler operator's manual, and a few will be mentioned in this manual where relevant. In general, controls can be embedded in FORTRAN source code and are identified by a '$' in the first character position ('column' 1).
All but two types of FORTRAN statement begin with a keyword and are identified by that keyword. For example, the PROGRAM statement just described begins with the keyword 'PROGRAM.' Only 'assignment' and 'statement function' statements do not begin with keywords. The 'AVG = HITS/AB' statement in Figure
2.1.3.1Statement Labels. Any statement can be labeled; any statement to be referenced from elsewhere in the program must be labeled. The label is a
2.1.3.2Line Format. A FORTRAN statement consists of one or more lines. The first line of a statement is called the initial line; subsequent lines in the same state- ment are called continuation lines.
A FORTRAN line can have up to 72 characters. The first six character positions (referred to as 'columns'
An integer anywhere in columns
Specific Intel FORTRAN compilers may allow exceptions to the standard line for- mat. See Section F.2.4 of Appendix F for details.