COBOL Manual for TNS and TNS/R Programs
Procedure Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
8-20
Procedure Execution
4. A STOP RUN statement is executed within any program. In this case, execution of
the run unit terminates.
5. The last statement in the Declaratives Portion of a program completes execution
without causing an explicit transfer of control, and its paragraph is not the
designated end of a PERFORM … THROUGH procedure group. Following the
execution of such a statement in these circumstances, control reaches the end of
the Declaratives Portion, causing execution of both the program and the run unit to
terminate abnormally.
Both the program and the run unit terminate abnormally because execution of a
declarative section is expected to be done by a PERFORM statement with these
characteristics:
•
An explicit PERFORM statement in the Declaratives Portion or somewhere in
the rest of the Procedure Division
•
An implicit PERFORM statement executed due to either the use of the COBOL
debugging module or an input-output statement’s encountering an error
In the latter case, if the error was recoverable, control returns to the statement
following the input-output statement; if the error was not recoverable, execution of
the run unit terminates.
If you transfer control directly to a procedure in a declarative section from a GO TO
statement anywhere in the Procedure Division, there is no next executable
statement when execution reaches the end of the declarative section.
Procedure Execution
A procedure is a paragraph, a group of successive paragraphs, a section, or a group of
successive sections executed as a unit. See Paragraph Execution and Section
Execution.
Declaratives Portion Execution
The sections of the Declaratives Portion are executed individually when certain
conditions arise during execution of statements in the rest of the Procedure Division
(see Section Execution).