COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-147
Unconditional PERFORM
The descriptions of the action of the PERFORM statement in this section are
expressed in terms of the out-of-line PERFORM statement. The execution of an in-
line PERFORM statement is exactly equivalent to that of an out-of-line PERFORM
statement, with the exception that the statements contained in imperative-
statement in the in-line PERFORM statement are executed in place of the
statements within the range of procedure-group. Unless specially qualified by
the term in-line or out-of-line, all the considerations that apply to the out-of-line
PERFORM statement also apply to the in-line PERFORM statement.
Execution and Transfers of Control
Section 8, Procedure Division, explains the execution of sections and paragraphs
as well as explicit and implicit transfers of control.
Range of the PERFORM Statement
The range of an out-of-line PERFORM statement is the statements contained
within the range of procedure-group.
The range of an in-line PERFORM statement is the statements contained within
the PERFORM statement.
Logical Range of the PERFORM Statement
The logical range of any PERFORM statement is all statements that are executed
as a result of the PERFORM statement, including the transfer of control to the
statement following the PERFORM statement (or to the statement following the
END-PERFORM). The logical range includes all statements executed as a result of
a GO TO, PERFORM, or CALL statement in the range of the original PERFORM
statement, as well as all statements in the Declaratives Portion that might be
executed. There is no requirement for statements in the range of a PERFORM
statement to appear consecutively.
Nested PERFORM Statements
The logical range of a PERFORM cycle can include another PERFORM statement
(called a nested PERFORM statement), but these restrictions apply:
°
The logical range of the nested PERFORM statement must be either totally
included in or totally excluded from the logical range of the outer PERFORM
statement; therefore, an active PERFORM statement whose execution point
begins within the range of another active PERFORM statement must not allow
control to pass to the exit of the other active PERFORM statement.
°
The final paragraph in the range of one active PERFORM statement cannot be
the same as the final paragraph in the range of any other active PERFORM
statement, because the program terminates only one PERFORM cycle for
each such final paragraph. The final paragraph would have to be executed
twice to terminate both cycles.