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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-146
Unconditional PERFORM
°
When proc-2 does appear and is a paragraph-name, the return occurs after
the execution of the last statement in that paragraph.
°
When proc-2 does appear and is a section-name, the return occurs after the
execution of the last statement of the last paragraph of that section.
The preceding conditions for the return of control might be unsatisfied when the
range includes a GO TO statement. If the flow of control does not pass through the
last statement indicated above, the condition for return cannot be satisfied. Such a
PERFORM cycle ends only when the program terminates, which it can do by
executing one of these statements:
°
A STOP RUN statement
°
An EXIT PROGRAM statement (from within in a called program)
°
The last statement in the program
Avoid including a GOTO statement in the range of a PERFORM statement. A
GOTO statement can cause a run-time diagnostic indicating that the PERFORM
stack is full.
Procedure Relationships and the Ends of PERFORM Cycles
There is no necessary relationship between proc-1 and proc-2, except that a
PERFORM cycle begun at the procedure named by proc-1 ends when control
reaches the return point following the last statement of the procedure named by
proc-2. GO TO statements, PERFORM statements, CALL or ENTER statements,
and so forth, can occur in the logical sequence of statements executed during a
PERFORM cycle. If there are two or more logical points at which a cycle could
end, then proc-2 can name a paragraph consisting solely of the EXIT statement,
and all execution paths can terminate cleanly by transferring control to that
paragraph.
The existence of a return point following the end of an execution range is a
dynamic characteristic of an executing program. If control reaches the return point
defined for a PERFORM statement that is not in the process of execution (that is,
is not currently performing a cycle), then control passes through to the next
paragraph in accordance with the normal rules for implicit transfer of control from
one statement to the next.
In-line and Out-of-Line PERFORM Statements
The PERFORM imperative-statement END-PERFORM form of the
statement is an “in-line PERFORM statement.” The PERFORM procedure-
group form of the statement is an “out-of-line PERFORM statement.”