COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
IDENTIFICATION DIVISION.
PROGRAM-ID. COBSUB2.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP System.
OBJECT-COMPUTER. HP System.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 DATA-MESSAGE PIC X(80) VALUE "I'M COBSUB2 ALIVE AND WELL".
LINKAGE SECTION.
01 PARM1 PIC 99.
01 PARM2 PIC XX.
PROCEDURE DIVISION USING PARM1, PARM2.
START-PROGRAM.
DISPLAY DATA-MESSAGE
DISPLAY PARM1
DISPLAY PARM2
DISPLAY "I WILL NOW RETURN TO THE MAIN PGM VIA COBSUB1".
For the programs in Example 79 to work properly, they must be compiled in this order:
>COBOL85 /IN SUB2SRC, / SUB2OBJ
>COBOL85 /IN SUB1SRC, / SUB1OBJ
>COBOL85 /IN MAINSRC, / MAINOBJ
If you want to eliminate the SPECIAL-NAMES paragraphs from the programs in Example 79,
compile them, in the same order, with these additional directives:
In COBSUB1: ?SEARCH SUBOBJ2
In COBOLMAIN: ?SEARCH SUBOBJ1
Output from running the programs in Example 79 as a single run unit looks like this:
I'M THE MAIN AND I'M ALIVE
SAVE-TABLE-INDEX = 005
I'M SUBCOB1 ALIVE AND WELL
SAVE-SUB-INDEX = 005
10
AB
I'M COBSUB2 ALIVE AND WELL
10
AB
I WILL NOW RETURN TO THE MAIN PGM VIA COBSUB1
I'M COBSUB1 AND I'M RETURNING TO MAIN NOW
PROGRAM END
CANCEL
CANCEL signals that you are done with a program that you called. On some computer systems,
CANCEL releases memory used by a program that is no longer needed. On NonStop systems,
CANCEL restores each specified program to its initial state (see Initial State (page 596)). Nothing
happens if a CANCEL statement specifies an initial program, a program that was not called, or a
program that has already been cancelled.
program-name
is a nonnumeric literal whose value is the program-name in the PROGRAM-ID paragraph
of the COBOL program to be cancelled.
CANCEL 301










