IBM Books

Language Reference


Order of Statements and Execution Sequence


Table 2. Statement Order
(1)PROGRAM, FUNCTION, SUBROUTINE, MODULE, or BLOCK DATA Statement
(2)USE Statements
(3)DATA, FORMAT, and ENTRY Statements (4)Derived-Type Definitions, Interface Blocks, Type Declaration Statements, Specification Statements, IMPLICIT Statements, and PARAMETER Statements
(5)Executable constructs
(6)CONTAINS Statement
(7)Internal Subprograms or Module Subprograms
(8)END Statement

Statement Order

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 are used later in the book to identify groups of statements that are allowed in particular contexts.

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 executable statements in the order they appear in a scoping unit. It begins with the first executable statement in a main program. Nonexecutable statements and comment lines do not affect the normal execution sequence.

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, the execution of the program continues with the first executable statement following the FUNCTION, SUBROUTINE, or ENTRY statement in the referenced procedure (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.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]