The procedure(s) referenced in the basic PERFORM statement are executed once, and control then passes to the next executable statement following the PERFORM statement.
Note: A PERFORM statement must not cause itself to be executed. Such a recursive PERFORM statement can cause unpredictable results.
___ Format 1 ___________________________________________________________ | | | >>__PERFORM__________________________________________________________> | | | | >__ _procedure-name-1__ _______________________________ _ __________>< | | | |_ _THROUGH_ __procedure-name-2_| | | | | |_THRU____| | | | | (1) | | | |_imperative-statement-1_____END-PERFORM______________| | | | | Note: | X | (1) Imperative-statement-1 is optional as an IBM extension. | | | |________________________________________________________________________|
When both procedure-name-1 and procedure-name-2 are specified, if either is a procedure-name in a declarative procedure, both must be procedure-names in the same declarative procedure.
If procedure-name-1 is specified, imperative-statement-1 and the END-PERFORM phrase must not be specified.
If procedure-name-1 is omitted, imperative-statement and the END-PERFORM phrase must be specified.
Whenever an out-of-line PERFORM statement is executed, control is transferred to the first statement of the procedure named procedure-name-1. Control is always returned to the statement following the PERFORM statement. The point from which this control is returned is determined as follows:
PERFORM statements can be specified within the performed procedure. If there are two or more logical paths to the return point, then procedure-name-2 can name a paragraph that consists only of an EXIT statement; all the paths to the return point must then lead to this paragraph.
When the performed procedures include another PERFORM statement, the sequence of procedures associated with the embedded PERFORM statement must be totally included in or totally excluded from the performed procedures of the first PERFORM statement. That is, an active PERFORM statement whose execution point begins within the range of performed procedures of another active PERFORM statement must not allow control to pass through
Figure 11 illustrates valid sequences of execution for PERFORM statements.
x PERFORM a THRU m x PERFORM a THRU m
a ___________________ a ___________________ | | d PERFORM f THRU j | d PERFORM f THRU j | | | f ________ | h | | | | j ________| | m ___________________| | m ___________________| f _______ | j _______|
x PERFORM a THRU m X x PERFORM a THRU m
a _______________ X a ___________________ | X | f ________ | X d PERFORM j THRU m | | | X | m ________|______| X f | | X | j ________| X j ____________ |
X | | d PERFORM f thru j X m EXIT. ______|______|
Figure 11. Valid PERFORM Statement Execution Sequences
When control passes to the sequence of procedures by means other than a PERFORM statement, control passes through the exit point to the next executable statement, as if no PERFORM statement referred to these procedures.
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.