COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-159
Unconditional PERFORM
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.”
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.