Java Reference
In-Depth Information
MYSUB COBOL
MYSUB will return to CALLER before it is completely finished so that CALLER can
perform some additional logic. When CALLER calls MYSUB again, MYSUB will
complete its logic.
IDENTIFICATION DIVISION.
PROGRAM-ID. MYSUB.
************************************************************************
* This routine accepts a text item as a parameter and *
* evaluates the text. If the text is all spaces, *
* MSG-SIZE will be set to 0. *
* If requested, the text item will also be stored in the *
* passed control structure. *
* If the text item is not passed, then MSG-TEXT *
* will be evaluated instead. *
* MYSUB will count the number of times it has been called *
* with a particular MYSUBx-CONTROL and the number of *
* times it has been called using all CONTROLs. *
* *
* MYSUB must be called with the INITIALIZE action when *
* any new CONTROL is to be used. *
* *
* MYSUB can return before completing the text evaluation *
* functions so that the caller can extend this function. *
************************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CALL-COUNTER PIC 9(10) VALUE 0.
01 ARGUMENT-COUNT PIC 9.
01 LOCAL-TEXT PIC X(20).
LINKAGE SECTION.
*
Next is a view of MYSUB-CONTROL that is used by the
*
MYSUB subroutine:
01 MYSUB-CONTROL.
03 MYSUB-ACTION-SWITCH PIC X.
88 MYSUB-ACTION-INITIALIZE VALUE "I".
88 MYSUB-ACTION-EVALUATE VALUE "E".
88 MYSUB-ACTION-SET-AND-EVALUATE VALUE "S".
88 MYSUB-ACTION-GET-CALL-COUNTER VALUE "G".
03 MYSUB-ACTION-EXTENDED-SWITCH PIC X.
88 MYSUB-ACTION-EXTENDED VALUE "E".
Search WWH ::




Custom Search