COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-80
EXIT
EXIT PROGRAM Statement in a Called Initial Program
If an initial program that was called by another program executes an EXIT
PROGRAM statement, the called program is cancelled (see CANCEL).
EXIT PROGRAM Statement in a Called Program That is Not Initial
If a program that was called by another program and is not initial executes an EXIT
PROGRAM statement, program execution continues with the executable statement
following the CALL statement in the calling program.
The program state of the calling program is the same as it was when it executed
the CALL statement, except for possible changes in the contents of data items and
files that the calling and called programs shared.
The only change in the program state of the called program is that the ends of the
ranges of all PERFORM statements that it executed are considered to have been
reached.
EXIT PERFORM in Nested In-Line PERFORM Statements
An EXIT PERFORM statement in a nested in-line PERFORM statement causes
the innermost PERFORM statement to be exited.
Example 9-25. EXIT Statement in Nested In-Line PERFORM Statement
...
PERFORM REPORT-EXPLOSION THROUGH REPORT-EXPLOSION-END.
...
REPORT-EXPLOSION.
READ MASTER-EXP RECORD
AT END GO TO REPORT-EXPLOSION-END
END-READ
GO TO SUB-ASSY-1
SUB-ASSY-2
...
SUB-ASSY-23 DEPENDING ON SUB-ASSY OF MASTER-EXP
PERFORM REPORT-BAD-SUB-ASSEMBLY
GO TO REPORT-EXPLOSION-END.
SUB-ASSY-1.
...
SUB-ASSY-2.
...
REPORT-EXPLOSION-END.
EXIT.