Creating Customer (BNK1CCS)
The BNK1CCS
The BNK1CCS
Here is a high level diagram of the program:
Initialization and Setup
Check if first time through
First, the code checks if this is the first time through by evaluating if EIBCALEN
EVALUATE TRUE
*
* Is it the first time through? If so, send the map
* with erased (empty) data fields.
*
WHEN EIBCALEN = ZERO
Initialize customer data fields
Next, the code initializes various customer data fields to empty values. This includes setting BNK1CCO
LOW-VALUE
CUSTTITO
CHRISTNO
CUSTINSO
CUSTSNO
CUSTAD1O
CUSTAD2O
CUSTAD3O
MOVE LOW-VALUE TO BNK1CCO
MOVE SPACES TO CUSTTITO
MOVE SPACES TO CHRISTNO
MOVE SPACES TO CUSTINSO
MOVE SPACES TO CUSTSNO
MOVE SPACES TO CUSTAD1O
MOVE SPACES TO CUSTAD2O
MOVE SPACES TO CUSTAD3O
Set SEND-ERASE
flag
SEND-ERASE
Then, the code sets the SEND-ERASE
-1
CUSTTITL
SEND-ERASE
MOVE -1 TO CUSTTITL
SET SEND-ERASE TO TRUE
MOVE SPACES TO MESSAGEO
Perform STORE-TERM-DEF
STORE-TERM-DEF
Moving to the next step, the code performs the STORE-TERM-DEF
PERFORM STORE-TERM-DEF
Perform SEND-MAP
SEND-MAP
Finally, the code performs the SEND-MAP
PERFORM SEND-MAP
Key Handling
Handling PA Key Presses
First, the code checks if a PA key (DFHPA1
DFHPA2
DFHPA3
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
Handling PF3 Key Press
Next, if the PF3 key is pressed, the terminal's UCTRAN setting is restored to its original state by calling RESTORE-TERM-DEF
WHEN EIBAID = DFHPF3
*
* Set the terminal UCTRAN back to
* its starting position
*
PERFORM RESTORE-TERM-DEF
EXEC CICS RETURN
TRANSID('OMEN')
IMMEDIATE
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
Handling PF12 Key Press
Then, if the PF12 key is pressed, a termination message is sent by calling SEND-TERMINATION-MSG
RESTORE-TERM-DEF
WHEN EIBAID = DFHPF12
PERFORM SEND-TERMINATION-MSG
*
* Set the terminal UCTRAN back to
* its starting position
*
PERFORM RESTORE-TERM-DEF
EXEC CICS
RETURN
END-EXEC
Handling CLEAR Key Press
When the CLEAR key is pressed, the program sends a map (BNK1CCM
RESTORE-TERM-DEF
WHEN EIBAID = DFHCLEAR
EXEC CICS SEND MAP('BNK1CCM')
MAPONLY
ERASE
FREEKB
END-EXEC
*
* Set the terminal UCTRAN back to
* its starting position
*
PERFORM RESTORE-TERM-DEF
EXEC CICS RETURN TRANSID('OCCS')
COMMAREA(WS-COMM-AREA)
END-EXEC
Handling ENTER Key Press
If the ENTER key is pressed, the program processes the content by calling PROCESS-MAP
WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP
Handling Other Key Presses
Finally, if any other key is pressed, the program moves the DFHCOMMAREA to WS-COMM-AREA
WHEN OTHER
MOVE DFHCOMMAREA TO WS-COMM-AREA
MOVE LOW-VALUES TO BNK1CCO
MOVE SPACES TO MESSAGEO
MOVE 'Invalid key pressed.' TO MESSAGEO
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP
END-EVALUATE.
SEND-TERMINATION-MSG
SEND-TERMINATION-MSG
The SEND-TERMINATION-MSG
SEND-TERMINATION-MSG SECTION.
STM010.
*
* Send the termination message
*
EXEC CICS SEND TEXT
FROM(END-OF-SESSION-MESSAGE)
ERASE
FREEKB
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
* program.
*
INITIALIZE ABNDINFO-REC
RESTORE-TERM-DEF
RESTORE-TERM-DEF
The RESTORE-TERM-DEF
RESTORE-TERM-DEF SECTION.
RTD010.
*
* We must now restore the UCTRAN setting back to what it
* was at the start
*
MOVE DFHCOMMAREA TO WS-COMM-AREA.
MOVE WS-COMM-TERM TO WS-UCTRANS.
EXEC CICS SET TERMINAL(EIBTRMID)
UCTRANST(WS-UCTRANS)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
*
* Preserve the RESP and RESP2, then set up the
* standard ABEND info before getting the applid,
* date/time etc. and linking to the Abend Handler
Interim Summary
So far, we saw how the initialization and setup process works, including checking if it's the first time through, initializing customer data fields, setting the SEND-ERASE
STORE-TERM-DEF
Return and Error Handling
Return CICS Transaction
First, the code returns the CICS transaction with the transaction ID 'OCCS' and the communication area WS-COMM-AREA
WS-CICS-RESP
WS-CICS-RESP2
EXEC CICS
RETURN TRANSID('OCCS')
COMMAREA(WS-COMM-AREA)
LENGTH(248)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Check Response
Next, the code checks if the response WS-CICS-RESP
DFHRESP(NORMAL)
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
Initialize Abend Info
Then, the code initializes the ABNDINFO-REC
EIBRESP
EIBRESP2
ABND-RESPCODE
ABND-RESP2CODE
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
Get Supplemental Info
Moving to the next step, the code gets supplemental information by assigning the application ID to ABND-APPLID
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
Populate Time and Date
Next, the code performs the POPULATE-TIME-DATE
PERFORM POPULATE-TIME-DATE
POPULATE-TIME-DATE
POPULATE-TIME-DATE
The POPULATE-TIME-DATE
WS-ORIG-DATE
WS-TIME-NOW
POPULATE-TIME-DATE SECTION.
PTD10.
EXEC CICS ASKTIME
ABSTIME(WS-U-TIME)
END-EXEC.
EXEC CICS FORMATTIME
ABSTIME(WS-U-TIME)
DDMMYYYY(WS-ORIG-DATE)
TIME(WS-TIME-NOW)
DATESEP
END-EXEC.
PTD999.
EXIT.
Move Date and Time
Then, the code moves the original date WS-ORIG-DATE
ABND-DATE
ABND-TIME
WS-TIME-NOW-GRP-HH
WS-TIME-NOW-GRP-MM
WS-TIME-NOW-GRP-MM
MOVE WS-ORIG-DATE TO ABND-DATE
STRING WS-TIME-NOW-GRP-HH DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE,
':' DELIMITED BY SIZE,
WS-TIME-NOW-GRP-MM DELIMITED BY SIZE
INTO ABND-TIME
Assign Program
Next, the code assigns the current program name to ABND-PROGRAM
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
Move SQL Code
Then, the code moves zeros to ABND-SQLCODE
MOVE ZEROS TO ABND-SQLCODE
Create Freeform String
Moving forward, the code creates a freeform string ABND-FREEFORM
STRING 'A010 -RETURN TRANSID(OCCS) FAIL'
DELIMITED BY SIZE,
'EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
Link to Abend Handler
Next, the code links to the Abend Handler program WS-ABEND-PGM
ABNDINFO-REC
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
Initialize Fail Info
Then, the code initializes the fail information WS-FAIL-INFO
WS-CICS-FAIL-MSG
WS-CICS-RESP-DISP
WS-CICS-RESP2-DISP
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CCS - A010 - RETURN TRANSID(OCCS) FAIL' TO
WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
Perform Restore Term Def
Next, the code performs the RESTORE-TERM-DEF
PERFORM RESTORE-TERM-DEF
Perform Abend Task
Finally, the code performs the ABEND-THIS-TASK
PERFORM ABEND-THIS-TASK
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human