Java Reference
In-Depth Information
IF MYSUB-ACTION-SET-AND-EVALUATE
MOVE TEXT-STRING TO MSG-TEXT.
EXIT-PROGRAM.
EXIT PROGRAM.
Using this interface definition, the CALLER program can ask MYSUB to store the
TEXT-STRING in MSG-TEXT. It can also ask MYSUB to evaluate TEXT-STRING in
order to determine whether it contains only spaces. The result is stored in MSG-SIZE.
CALLER COBOL
Alternatively, the CALLER can ask MYSUB to simply perform the evaluation and
not store the TEXT-STRING in MSG-TEXT. This would be a slight variation on
MYSUB's basic function. CALLER can then request either of these two functions by
setting ACTION-SW to the appropriate value. Here is an example:
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLER.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 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 TEXT-STRING PIC X(20).
PROCEDURE DIVISION.
START-PROGRAM SECTION.
START-PROGRAM-S.
*
Set ACTION-SWITCH to the function required (set and evaluate).
MOVE "S" TO MYSUB-ACTION-SWITCH.
*
Prepare the text parameter to this subroutine
MOVE "ANYTEXT" TO TEXT-STRING.
*
Call the subroutine to perform this function
CALL "MYSUB" USING MYSUB-CONTROL, TEXT-STRING.
DISPLAY "MSG-TEXT: ", MSG-TEXT,
"MSG-SIZE: ", MSG-SIZE.
Search WWH ::




Custom Search