Java Reference
In-Depth Information
PROCEDURE DIVISION.
START-PROGRAM SECTION.
START-PROGRAM-S.
EXIT PROGRAM.
Not much there!
NEWSUB COBOL: MYSUB
Now, this is the definition for NEWSUB after NEWSUB inherits from MYSUB:
IDENTIFICATION DIVISION.
PROGRAM-ID. NEWSUB.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 PASSED-MYSUB-CONTROL.
03 MYSUB-ACTION-SWITCH PIC X.
88 MYSUB-ACTION-EVALUATE VALUE "E".
88 MYSUB-ACTION-SET-AND-EVALUATE VALUE "S".
03 MSG-TEXT PIC X(20).
03 MSG-SIZE PIC 9(8).
01 PASSED-TEXT-STRING PIC X(20).
PROCEDURE DIVISION USING PASSED-MYSUB-CONTROL,
PASSED-TEXT-STRING.
START-PROGRAM SECTION.
START-PROGRAM-S.
*
Check the passed parameters to see if you should just call MYSUB.
IF MYSUB-ACTION-EVALUATE OF PASSED-MYSUB-CONTROL OR
MYSUB-ACTION-SET-AND-EVALUATE OF PASSED-MYSUB-CONTROL
CALL "MYSUB" USING PASSED-MYSUB-CONTROL,
PASSED-TEXT-STRING.
EXIT PROGRAM.
As a result of this change, NEWSUB appears to have some of the same proper-
ties of MYSUB. A program (perhaps CALLER) can call either MYSUB or NEW-
SUB, with the same control structures and get the same results.
Search WWH ::




Custom Search