Creating Account (BNK1CAC)
The Creating Account (BNK1CAC) program involves verifying input data and linking to the CREACC
program to add the new account to the account datastore.
The BNK1CAC
Here is a high level diagram of the program:
Handling Initial Setup and Key Inputs
Checking if it's the first time
First, the code checks if it's the first time through by evaluating if EIBCALEN
SEND-ERASE
EVALUATE TRUE
*
* Is it the first time through? If so, send the map
* with erased (empty) data fields.
*
WHEN EIBCALEN = ZERO
MOVE LOW-VALUE TO BNK1CAO
MOVE -1 TO CUSTNOL
SET SEND-ERASE TO TRUE
MOVE SPACES TO MESSAGEO
PERFORM SEND-MAP
Handling PA keys
Moving to the next condition, if a PA key (Program Attention key) is pressed, the program simply continues without taking any specific action. This allows the user to press these keys without disrupting the flow.
* If a PA key is pressed, just carry on
*
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
Returning to the main menu
Next, if the PF3 key is pressed, the program returns to the main menu by executing a CICS RETURN command with the transaction ID 'OMEN'. This provides a way for the user to navigate back to the main menu.
* When Pf3 is pressed, return to the main menu
*
WHEN EIBAID = DFHPF3
EXEC CICS RETURN
TRANSID('OMEN')
IMMEDIATE
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC
Sending termination message
Then, if either the AID key or PF12 key is pressed, the program performs the SEND-TERMINATION-MSG
* If the aid or Pf12 is pressed, then send a termination
* message.
*
WHEN EIBAID = DFHAID OR DFHPF12
PERFORM SEND-TERMINATION-MSG
EXEC CICS
RETURN
END-EXEC
Handling CLEAR key
When the CLEAR key is pressed, the program sends a control command to erase the screen and free the keyboard, then returns control to CICS. This clears the current screen for the user.
* When CLEAR is pressed
*
WHEN EIBAID = DFHCLEAR
EXEC CICS SEND CONTROL
ERASE
FREEKB
END-EXEC
EXEC CICS RETURN
END-EXEC
Processing content on ENTER key
When the ENTER key is pressed, the program performs the PROCESS-MAP
* When enter is pressed then process the content
*
WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP
Handling invalid keys
Finally, if any other key is pressed, the program sends an invalid key message to the user by setting the SEND-DATAONLY-ALARM
SEND-MAP
* When anything else happens, send the invalid key message
*
WHEN OTHER
MOVE LOW-VALUES TO BNK1CAO
MOVE SPACES TO MESSAGEO
MOVE 'Invalid key pressed.' TO MESSAGEO
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP
Setting Up Returned Information
This is the next section of the flow.
Checking EIBCALEN
First, we check if EIBCALEN
IF EIBCALEN NOT = 0
Moving Customer Information
If EIBCALEN
SUBPGM-CUSTNO
WS-COMM-CUSTNO
SUBPGM-ACC-TYPE
WS-COMM-ACCTYPE
SUBPGM-INT-RT
WS-COMM-INTRT
SUBPGM-OVERDR-LIM
WS-COMM-OVERDR
MOVE SUBPGM-CUSTNO TO WS-COMM-CUSTNO
MOVE SUBPGM-ACC-TYPE TO WS-COMM-ACCTYPE
MOVE SUBPGM-INT-RT TO WS-COMM-INTRT
MOVE SUBPGM-OVERDR-LIM TO WS-COMM-OVERDR
Initializing Communication Area
If EIBCALEN
WS-COMM-AREA
ELSE
INITIALIZE WS-COMM-AREA
END-IF.
Interim Summary
So far, we saw how the program handles various key inputs, including checking if it's the first time, handling PA keys, returning to the main menu, sending termination messages, handling the CLEAR key, processing content on the ENTER key, and handling invalid keys. Now, we will focus on setting up the returned information, including checking EIBCALEN, moving customer information, and initializing the communication area.
Returning to CICS Task
Handling Transaction Return
First, the transaction is returned using the RETURN TRANSID('OCAC')
COMMAREA(WS-COMM-AREA)
LENGTH(32)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
RETURN TRANSID('OCAC')
COMMAREA(WS-COMM-AREA)
LENGTH(32)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Checking Response Codes
Next, the response code WS-CICS-RESP
DFHRESP(NORMAL)
RETURN TRANSID('OCAC')
COMMAREA(WS-COMM-AREA)
LENGTH(32)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Populating Time and Date
Then, the POPULATE-TIME-DATE
EXEC CICS ASKTIME
WS-U-TIME
EXEC CICS FORMATTIME
WS-ORIG-DATE
WS-TIME-NOW
POPULATE-TIME-DATE SECTION.
PTD010.
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.
Error Handling for Abnormal Responses
Initializing Error Handling Information
First, we initialize WS-FAIL-INFO
WS-CICS-FAIL-MSG
WS-CICS-RESP
WS-CICS-RESP2
WS-CICS-RESP-DISP
WS-CICS-RESP2-DISP
INITIALIZE WS-FAIL-INFO
MOVE 'BNK1CAC - A010 - RETURN TRANSID(OCAC) FAIL' TO
WS-CICS-FAIL-MSG
MOVE WS-CICS-RESP TO WS-CICS-RESP-DISP
MOVE WS-CICS-RESP2 TO WS-CICS-RESP2-DISP
Setting Up ABEND Information
Next, we initialize ABNDINFO-REC
EIBRESP
EIBRESP2
ABND-RESPCODE
ABND-RESP2CODE
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
Gathering Supplemental Information
Then, we gather supplemental information by assigning the application ID to ABND-APPLID
EIBTASKN
EIBTRNID
ABND-TASKNO-KEY
ABND-TRANID
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
Populating Date and Time
Moving to the next step, we perform the POPULATE-TIME-DATE
WS-ORIG-DATE
ABND-DATE
WS-TIME-NOW-GRP-HH
WS-TIME-NOW-GRP-MM
WS-TIME-NOW-GRP-MM
ABND-TIME
PERFORM POPULATE-TIME-DATE
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
END-STRING
Finalizing ABEND Information
Next, we move the universal time WS-U-TIME
ABND-UTIME-KEY
HBNK
ABND-CODE
ABND-PROGRAM
ABND-FREEFORM
MOVE WS-U-TIME TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
MOVE ZEROS TO ABND-SQLCODE
STRING 'A010- RETURN TRANSID(OCAC) ' DELIMITED BY SIZE,
' EIBRESP=' DELIMITED BY SIZE,
ABND-RESPCODE DELIMITED BY SIZE,
' RESP2=' DELIMITED BY SIZE,
ABND-RESP2CODE DELIMITED BY SIZE
INTO ABND-FREEFORM
END-STRING
Linking to ABEND Handler
Finally, we link to the ABEND handler program WS-ABEND-PGM
ABNDINFO-REC
ABEND-THIS-TASK
EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human