Java Reference
In-Depth Information
01 MYSUB2-CONTROL.
03 MSG-TEXT PIC X(20).
03 MSG-SIZE PIC 9(8).
01 DISPLAY-MESSAGE PIC X(20).
01 TEXT-STRING PIC X(20).
PROCEDURE DIVISION.
PROGRAM-START SECTION.
PROGRAM-START-S.
* Prepare the first set of parameters, and call MYSUB.
MOVE "ANYTEXT" TO TEXT-STRING.
CALL "MYSUB" USING MYSUB1-CONTROL, TEXT-STRING.
* Prepare the second set and call MYSUB.
MOVE SPACES TO TEXT-STRING.
CALL "MYSUB" USING MYSUB2-CONTROL, TEXT-STRING.
* Evaluate the data associated with the first set and then the second
* set.
IF MSG-SIZE OF MYSUB1-CONTROL > 0
MOVE MSG-TEXT OF MYSUB1-CONTROL TO DISPLAY-MESSAGE
ELSE IF MSG-SIZE OF MYSUB2-CONTROL > 0
MOVE MSG-TEXT OF MYSUB2-CONTROL TO DISPLAY-MESSAGE.
DISPLAY "DISPLAY-MESSAGE: ", DISPLAY-MESSAGE.
EXIT-PROGRAM.
EXIT PROGRAM.
STOP RUN.
You can consider all instances of MYSUB-CONTROL (after MYSUB has been
called) to be class instances, or objects . In the example, MYSUB1-CONTROL is
one object, and MYSUB2-CONTROL is a second. It is up to the calling program
(the consumer of MYSUB) to manage these objects (i.e., the two instances of MY-
SUBx-CONTROL) as part of the application logic.
For example, if one MYSUBx-CONTROL contains an error message from the
database system, and the other MYSUBx-CONTROL contains an error message
from the communications system, it is up to the calling application to decide which
one to display at the correct time.
Search WWH ::




Custom Search