Sample Multiple Working-set Application
Main program
The main program, shown below, simply opens the main container and then
enters a loop that determines which set is to become active, and calls the
subroutine that manages that working-set.
The initial value of ACTIVE-SET is 1, which will cause the first panel in set
1 to be the first panel displayed.
Switching working-sets
When the user asks to open a new working-set, or when the user changes from
one set to a different one, the panel becoming inactivated receives a panel-EVENT-INACTIVATED,
along with the name and working-set of the panel which is to become
active. This is returned to the main program, which examines ACTIVE-SET to
determine which subroutine needs to be called.
ACTIVE-SET is unknown
If ACTIVE-SET is unknown, the logic in this program will cause working-set 1
to become active by default.
End of job
If END-OF-JOB is TRUE (ACTIVE-SET is zero), it indicates that the application
is to be closed. The program will terminate the PERFORMed loop and fall
through to the statements to close the main and STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. SETDEMO.
DATE-COMPILED.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-PC.
OBJECT-COMPUTER. IBM-PC.
DATA DIVISION.
WORKING-STORAGE SECTION.
* ------------------------: Main panel copybook:
COPY PSETDEMO.
* ------------------------: Arguments for working-sets
01 WORKING-SET-DATA.
05
ACTIVE-PANEL PIC X(8).
05
ACTIVE-SET PIC
S9(4) COMP-5 VALUE 1.
88
END-OF-JOB
VALUE 0.
PROCEDURE DIVISION.
0001-BEGIN.
* ------------------------: Open the container window.
PERFORM DISPLAY-MAIN.
* ------------------------: Call subroutine for the desired
*
: working-set until END-OF-JOB (Set 0)
PERFORM WITH TEST AFTER
UNTIL END-OF-JOB
EVALUATE ACTIVE-SET
WHEN 2
CALL 'SET2'
USING WORKING-SET-DATA
WHEN 3
CALL 'SET3'
USING WORKING-SET-DATA
WHEN 4
CALL 'SET4'
USING WORKING-SET-DATA
WHEN OTHER
MOVE 1 TO
ACTIVE-SET
CALL 'SET1'
USING WORKING-SET-DATA
END-EVALUATE
END-PERFORM.
* ------------------------: Close the main and STOP RUN.
SET PSETDEMO-DO-CLOSE TO TRUE.
PERFORM DISPLAY-MAIN.
STOP RUN.
DISPLAY-MAIN.
* ------------------------: Performed routines.
CALL 'GS' USING PSETDEMO-1
PSETDEMO-2
PSETDEMO-3
PSETDEMO-4. |