Skip to main content

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 program starts by checking if it's the first time the user is interacting with the application. It then handles different key inputs like PA keys, PF3 key, AID key, PF12 key, CLEAR key, and ENTER key. Depending on the key pressed, it performs actions like sending an empty map, returning to the main menu, sending a termination message, erasing the screen, processing user input, or sending an invalid key message. The program also sets up returned information by checking the communication area length and moving customer information or initializing the communication area. Finally, it handles transaction returns and error responses, ensuring proper communication with the CICS system.

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 is zero. If it is, it initializes the map with empty data fields and sets the SEND-ERASE flag to true. This ensures that the user sees a blank form when they first interact with the application.

           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 routine and returns control to CICS. This is used to send a termination message to the user.

      *       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 routine to process the content entered by the user. This is where the main processing of user input occurs.

      *       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 flag to true and performing the SEND-MAP routine. This informs the user that an invalid key was pressed.

      *       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 (which indicates the length of the communication area) is not zero. This helps determine if this is the first time through the process or not.

            IF EIBCALEN NOT = 0


Moving Customer Information

If EIBCALEN is not zero, we move the customer number from SUBPGM-CUSTNO to WS-COMM-CUSTNO, the account type from SUBPGM-ACC-TYPE to WS-COMM-ACCTYPE, the interest rate from SUBPGM-INT-RT to WS-COMM-INTRT, and the overdraft limit from SUBPGM-OVERDR-LIM to WS-COMM-OVERDR. This updates the working storage communication area with the relevant customer information.

               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 is zero, we initialize the WS-COMM-AREA. This sets up the communication area for the first time, ensuring that all fields are properly initialized.

            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') statement. This specifies the transaction ID to which control should be returned. The COMMAREA(WS-COMM-AREA) specifies the communication area to be used, and LENGTH(32) sets the length of the communication area. The RESP(WS-CICS-RESP) and RESP2(WS-CICS-RESP2) are used to capture the primary and secondary response codes from the CICS command.

               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 is checked to see if it is not equal to DFHRESP(NORMAL). If the response is not normal, it indicates that an error has occurred, and further action is required.

               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 section is called if the response is not normal. This section uses the EXEC CICS ASKTIME command to get the current time and stores it in WS-U-TIME. It then formats the time using EXEC CICS FORMATTIME, storing the formatted date in WS-ORIG-DATE and the current time in 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 and set up the failure message WS-CICS-FAIL-MSG to indicate the transaction ID failure. We then move the response codes WS-CICS-RESP and WS-CICS-RESP2 to their respective display fields WS-CICS-RESP-DISP and 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 and move the response codes EIBRESP and EIBRESP2 to ABND-RESPCODE and ABND-RESP2CODE respectively. This sets up the standard ABEND information.

                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, and moving the task number EIBTASKN and transaction ID EIBTRNID to ABND-TASKNO-KEY and ABND-TRANID respectively.

                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 routine to get the current date and time. We then move the original date WS-ORIG-DATE to ABND-DATE and construct the time string from WS-TIME-NOW-GRP-HH, WS-TIME-NOW-GRP-MM, and WS-TIME-NOW-GRP-MM into 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 to ABND-UTIME-KEY and set the code HBNK to ABND-CODE. We assign the program name to ABND-PROGRAM and set the SQL code to zeros. We then construct a freeform message with the response codes and move it to 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 with the communication area ABNDINFO-REC and perform the ABEND-THIS-TASK routine to handle the abend.

                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