Table 2. Statement Order
|(1)PROGRAM, FUNCTION, SUBROUTINE, MODULE, or BLOCK DATA Statement|
|(3)DATA, FORMAT, and ENTRY Statements||(4)Derived-Type Definitions, Interface Blocks, Type Declaration Statements, Specification Statements, IMPLICIT Statements, and PARAMETER Statements|
|(7)Internal Subprograms or Module Subprograms|
Vertical lines delineate varieties of statements that can be interspersed,
while horizontal lines delineate varieties of statements that cannot be
interspersed. The numbers in the diagram reappear later in the book to
identify groups of statements that are allowed in particular contexts.
A reference back to this section is included in the places where these numbers
are used in the rest of this book.
Refer to Chapter 7, Program Units and Procedures or Chapter 10, Statements for more details on rules and restrictions concerning statement order.
Normal execution sequence is the processing of references to specification functions in any order, followed by the processing of executable statements in the order they appear in a scoping unit.
A transfer of control is an alteration of the normal execution sequence. Some statements that you can use to control the execution sequence are:
When you reference a procedure that is defined by a subprogram, the execution of the program continues with any specification functions referenced in the scoping unit of the subprogram that defines the procedure. The program resumes with the first executable statement following the FUNCTION, SUBROUTINE or ENTRY statement that defines the procedure. When you return from the subprogram, execution of the program continues from the point at which the procedure was referenced or to a statement referenced by an alternate return specifier.
In this book, any description of the sequence of events in a specific transfer of control assumes that no event, such as the occurrence of an error or the execution of a STOP statement, changes that normal sequence.