Program statements are grouped into two general classes: executable and nonexecutable. An executable statement specifies an action to be performed. A nonexecutable statement describes program attributes, such as the arrangement and characteristics of data, as well as editing and data-conversion information.
Order of Statements in a Program Unit
Figure 2-1 shows the required order of statements in a Fortran program unit. In this figure, vertical lines separate statement types that can be interspersed. For example, you can intersperse DATA statements with executable constructs.
Horizontal lines indicate statement types that cannot be interspersed. For example, you cannot intersperse DATA statements with CONTAINS statements.
Figure 2-1 Required Order of Statements
Table 2-1 shows other statements restricted from different types of scoping units.
Table 2-1 Statements Restricted in Scoping Units
Scoping Unit | Restricted Statements |
---|---|
Main program | ENTRY and RETURN statements |
Module1 | ENTRY, FORMAT, OPTIONAL, and INTENT statements, statement functions, and executable statements |
Block data program unit | CONTAINS, ENTRY, and FORMAT statements, interface blocks, statement functions, and executable statements |
Internal subprogram | CONTAINS and ENTRY statements |
Interface body | CONTAINS, DATA, ENTRY, SAVE, and FORMAT statements, statement functions, and executable statements |
1 The scoping unit of a module does not include any module subprograms that the module contains. |
For More Information:
For details on scoping units, see Section 16.1.