COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-160
Unconditional PERFORM
•
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.
°
The sequence of statements executed in any cycle of one PERFORM
statement must not allow control to reach the return point for any other active
PERFORM statement in which it is nested. If this does happen, neither
PERFORM cycle terminates, and control falls through to succeeding
statements.
°
The sequence of statements executed in any cycle of one PERFORM
statement must not allow control to reach any active PERFORM statement,
including itself.
°
As a consequence of the preceding rules, a cycle of an active PERFORM
statement cannot end until after any PERFORM statements nested within it
complete their execution.
For the COBOL85 compiler, the maximum number of PERFORM statements that
can be nested varies from 0 to approximately 15,000, depending on the space
available on the stack.
For the NMCOBOL compiler, the maximum number of PERFORM statements that
can be nested is 50. Violation of the preceding rules often causes run-time
diagnostic 148.