You are on page 1of 5

******************************************************************

IDENTIFICATION DIVISION.
******************************************************************
PROGRAM-ID. TCHPG004.
******************************************************************
ENVIRONMENT DIVISION.
******************************************************************
DATA DIVISION.
******************************************************************
WORKING-STORAGE SECTION.
******************************************************************
01 WS-SWITCH.
05 WS-VALID-DATA-SW
PIC X(01) VALUE 'Y'.
88 WS-VALID-DATA
VALUE 'Y'.
*
01 WS-FLAGS.
05 WS-SEND-FLAG
PIC X(01).
88 WS-SEND-ERASE
VALUE '1'.
88 WS-SEND-DATAONLY
VALUE '2'.
88 WS-SEND-DATAONLY-ALARM
VALUE '3'.
*
01 WS-PROGRAM-TBL.
05 WS-PROGRAM-LIST.
10 WS-PROGRAM1
PIC X(08)
VALUE 'CUSTINQ1'.
10 WS-PROGRAM2
PIC X(08)
VALUE 'CUSTMNT2'.
10 WS-PROGRAM3
PIC X(08)
VALUE 'ORDRENT'.
05 WS-PROGRAM-NAME
REDEFINES WS-PROGRAM-LIST
OCCURS 3 TIMES
PIC X(08).
*
01 WS-SUBSCRIPTS.
05 WS-ACTION-SUB
PIC 9(01) COMP-3.
*
01 WS-END-OF-SESSION-MESSAGE
PIC X(13)
VALUE 'SESSION ENDED'.
*
01 WS-RESP-CODE
PIC S9(08) COMP.
*
01 WS-COMMUNICATION-AREA
PIC X(01).
*
******************************************************************
* SYMBOLIC MAP DECLARATION BEGINS
******************************************************************
01 MENMAP1I.
02 FILLER PIC X(12).
02 TRANIDL
COMP PIC S9(4).
02 TRANIDF
PICTURE X.
02 FILLER REDEFINES TRANIDF.
03 TRANIDA
PICTURE X.
02 FILLER
PICTURE X(2).
02 TRANIDI PIC X(4).
02 ACTIONL
COMP PIC S9(4).
02 ACTIONF
PICTURE X.
02 FILLER REDEFINES ACTIONF.

03 ACTIONA
PICTURE X.
FILLER
PICTURE X(2).
ACTIONI PIC X(1).
MESSAGEL
COMP PIC S9(4).
MESSAGEF
PICTURE X.
FILLER REDEFINES MESSAGEF.
03 MESSAGEA
PICTURE X.
02 FILLER
PICTURE X(2).
02 MESSAGEI PIC X(79).
02 DUMMYL
COMP PIC S9(4).
02 DUMMYF
PICTURE X.
02 FILLER REDEFINES DUMMYF.
03 DUMMYA
PICTURE X.
02 FILLER
PICTURE X(2).
02 DUMMYI PIC X(1).
MENMAP1O REDEFINES MENMAP1I.
02 FILLER PIC X(12).
02 FILLER PICTURE X(3).
02 TRANIDC
PICTURE X.
02 TRANIDH
PICTURE X.
02 TRANIDO PIC X(4).
02 FILLER PICTURE X(3).
02 ACTIONC
PICTURE X.
02 ACTIONH
PICTURE X.
02 ACTIONO PIC X(1).
02 FILLER PICTURE X(3).
02 MESSAGEC
PICTURE X.
02 MESSAGEH
PICTURE X.
02 MESSAGEO PIC X(79).
02 FILLER PICTURE X(3).
02 DUMMYC
PICTURE X.
02 DUMMYH
PICTURE X.
02 DUMMYO PIC X(1).
02
02
02
02
02

01

*
******************************************************************
* SYMBOLIC MAP DECLARATION ENDS
******************************************************************
*
01
DFHAID.
02 DFHNULL
PIC X VALUE IS ' '.
02 DFHENTER PIC X VALUE IS ''''.
02 DFHCLEAR PIC X VALUE IS '_'.
02 DFHCLRP
PIC X VALUE IS '?'.
02 DFHPEN
PIC X VALUE IS '='.
02 DFHOPID
PIC X VALUE IS 'W'.
02 DFHMSRE
PIC X VALUE IS 'X'.
02 DFHSTRF
PIC X VALUE IS 'h'.
02 DFHTRIG
PIC X VALUE IS '"'.
02 DFHPA1
PIC X VALUE IS '%'.
02 DFHPA2
PIC X VALUE IS '>'.
02 DFHPA3
PIC X VALUE IS ','.
02 DFHPF1
PIC X VALUE IS '1'.
02 DFHPF2
PIC X VALUE IS '2'.
02 DFHPF3
PIC X VALUE IS '3'.
02 DFHPF4
PIC X VALUE IS '4'.
02 DFHPF5
PIC X VALUE IS '5'.
02 DFHPF6
PIC X VALUE IS '6'.

02
02
02
02
02
02
02
02
02
02
02
02
02
02
02
02
02
02

DFHPF7
DFHPF8
DFHPF9
DFHPF10
DFHPF11
DFHPF12
DFHPF13
DFHPF14
DFHPF15
DFHPF16
DFHPF17
DFHPF18
DFHPF19
DFHPF20
DFHPF21
DFHPF22
DFHPF23
DFHPF24

PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC

X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X

VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE

IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS
IS

'7'.
'8'.
'9'.
':'.
'#'.
'@'.
'A'.
'B'.
'C'.
'D'.
'E'.
'F'.
'G'.
'H'.
'I'.
'?'.
'.'.
'<'.

*
******************************************************************
LINKAGE SECTION.
*
01 DFHCOMMAREA
PIC X(01).
******************************************************************
PROCEDURE DIVISION.
*
0000-PROCESS-MASTER-MENU.
*
EVALUATE TRUE
WHEN EIBCALEN = ZERO
MOVE LOW-VALUES TO MENMAP1O
SET WS-SEND-ERASE TO TRUE
PERFORM 1400-SEND-MENU-MAP
*
WHEN EIBAID
= DFHCLEAR
MOVE LOW-VALUES TO MENMAP1O
SET WS-SEND-ERASE TO TRUE
PERFORM 1400-SEND-MENU-MAP
*
WHEN EIBAID
= DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
*
WHEN EIBAID
= DFHPF3 OR DFHPF12
PERFORM 2000-SEND-TERMINATION-MESSAGE
EXEC CICS
RETURN
END-EXEC
*
WHEN EIBAID = DFHENTER
PERFORM 1000-PROCESS-MENU-MAP
*
WHEN OTHER
MOVE 'INVALID KEY PRESSED.' TO MESSAGEO
SET WS-SEND-DATAONLY-ALARM TO TRUE
PERFORM 1400-SEND-MENU-MAP
*
END-EVALUATE.

EXEC CICS
RETURN TRANSID('T004')
COMMAREA(WS-COMMUNICATION-AREA)
END-EXEC.
1000-PROCESS-MENU-MAP.

PERFORM 1100-RECEIVE-MENU-MAP
PERFORM 1200-EDIT-MENU-DATA
IF WS-VALID-DATA
MOVE ACTIONI TO WS-ACTION-SUB
PERFORM 1300-BRANCH-TO-PROGRAM
END-IF
SET WS-SEND-DATAONLY-ALARM TO TRUE
PERFORM 1400-SEND-MENU-MAP.
*

1100-RECEIVE-MENU-MAP.
EXEC CICS
RECEIVE MAP('MENMAP1')
MAPSET('TCHM004')
INTO(MENMAP1I)
END-EXEC.

1200-EDIT-MENU-DATA.

IF ACTIONI NOT = '1' AND '2' AND '3'


MOVE ATTR-REVERSE TO ACTIONH
EXEC CICS
ABEND ABCODE('XXXX')
NODUMP
END-EXEC
MOVE 'YOU MUST ENTER 1, 2, OR 3.' TO MESSAGEO
MOVE 'N' TO WS-VALID-DATA-SW
END-IF.

*
*
*

1300-BRANCH-TO-PROGRAM.

EXEC CICS
XCTL PROGRAM(WS-PROGRAM-NAME(WS-ACTION-SUB))
RESP(WS-RESP-CODE)
END-EXEC
*

MOVE 'THAT PROGRAMS IS NOT AVAILABLE.' TO MESSAGEO.

1400-SEND-MENU-MAP.

MOVE 'MENU' TO TRANIDO


EVALUATE TRUE
WHEN WS-SEND-ERASE
EXEC CICS
SEND MAP('MENMAP1')
MAPSET('TCHM004')
FROM(MENMAP1O)
ERASE
END-EXEC
WHEN WS-SEND-DATAONLY

EXEC CICS
SEND MAP('MENMAP1')
MAPSET('TCHM004')
FROM(MENMAP1O)
DATAONLY
END-EXEC
WHEN WS-SEND-ERASE
EXEC CICS
SEND MAP('MENMAP1')
MAPSET('TCHM004')
FROM(MENMAP1O)
DATAONLY
ALARM
END-EXEC
END-EVALUATE.
2000-SEND-TERMINATION-MESSAGE.
EXEC CICS
SEND TEXT FROM(WS-END-OF-SESSION-MESSAGE)
ERASE
FREEKB
END-EXEC.