COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-158
Unconditional PERFORM
proc-2
identifies the last procedure in the group.
imperative-statement
is defined under Imperative Statement.
END-PERFORM
ends the scope of the PERFORM statement, causing the PERFORM to be a
delimited-scope statement. If the PERFORM statement does not end with an END-
PERFORM phrase, it is an out-of-line PERFORM. If the PERFORM statement
ends with an END-PERFORM phrase, it is an in-line PERFORM.
Usage Considerations:
•
Execution Cycle of a PERFORM Statement (PERFORM Cycle)
Each execution of the range of a PERFORM statement is called a “PERFORM
cycle.” It begins with the implicit transfer of control to the first statement of the
range of the PERFORM and ends with an implicit transfer of control back to the
internal decision logic of the PERFORM statement. The point at which the return
occurs depends upon the proc-1 THROUGH proc-2 phrase:
°
When proc-2 does not appear and proc-1 is a paragraph-name, the return
occurs after the execution of the last statement in the specified paragraph.
°
When proc-2 does not appear and proc-1 is a section-name, the return
occurs after the execution of the last statement of the last paragraph of that
section.
°
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. For a
program compiled by the COBOL85 compiler, a GOTO statement can cause a
stack overflow. For a program compiled by the NMCOBOL compiler, a GOTO
statement can cause a run-time diagnostic indicating that the PERFORM stack is
full.