Skip to main content

Managing Account (BNK1DAC)

The BNK1DAC program is responsible for handling various key presses and preparing data for communication in the CICS Bank Sample Application. It evaluates key inputs, performs corresponding actions, and manages the communication area (COMMAREA) data. The program ensures that the correct data is prepared and returned based on the key pressed by the user.

The BNK1DAC program starts by checking if it is the first time through and sends a map with erased data fields if true. It then handles different key presses such as PA, PF3, PF5, PF12, CLEAR, ENTER, and invalid keys by performing specific actions like continuing, returning to the main menu, processing the map, sending termination messages, erasing the screen, and sending invalid key messages. The program also prepares the COMMAREA data by transferring account information or initializing the communication area based on the account type. Finally, it handles the response of a transaction initiation and performs error handling by capturing and logging relevant information.

Here is a high level diagram of the program:

Key Evaluation and Action Perform


Handling First Time Through

First, the code checks if it is the first time through by evaluating if EIBCALEN is zero. If it is, it moves low values to BNK1DAO, sets ACCNOL to -1, sets SEND-ERASE to true, initializes WS-COMM-AREA, and performs SEND-MAP to send the map with erased data fields.

           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 BNK1DAO
MOVE -1 TO ACCNOL
SET SEND-ERASE TO TRUE
INITIALIZE WS-COMM-AREA
PERFORM SEND-MAP


Handling PA Key Press

Next, if a PA key (DFHPA1, DFHPA2, or DFHPA3) is pressed, the code simply continues without any additional actions.

      *       If a PA key is pressed, just carry on
*
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE


Handling PF3 Key Press

When the PF3 key is pressed, the code executes a CICS RETURN command to return to the main menu by setting the transaction ID to 'OMEN' and handling the response codes.

      *       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


Handling PF5 Key Press

When the PF5 key is pressed, the code performs the PROCESS-MAP routine to process the map.

      *       When Pf5 is pressed, process the map
*
WHEN EIBAID = DFHPF5
PERFORM PROCESS-MAP


Handling PF12 Key Press

When the PF12 key is pressed, the code performs the SEND-TERMINATION-MSG routine to send a termination message and then executes a CICS RETURN command.

      *       When Pf12 is pressed, send a termination
* message.
*
WHEN EIBAID = DFHPF12
PERFORM SEND-TERMINATION-MSG

EXEC CICS
RETURN
END-EXEC


Handling CLEAR Key Press

When the CLEAR key is pressed, the code sends a control command to erase the screen and free the keyboard, followed by a CICS RETURN command.

      *       When CLEAR is pressed
*
WHEN EIBAID = DFHCLEAR
EXEC CICS SEND CONTROL
ERASE
FREEKB
END-EXEC

EXEC CICS RETURN
END-EXEC


Handling ENTER Key Press

When the ENTER key is pressed, the code performs the PROCESS-MAP routine to process the map.

      *       When enter is pressed then process the content
*
WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP



Handling Invalid Key Press

When any other key is pressed, the code moves low values to BNK1DAO, sets an 'Invalid key pressed.' message to MESSAGEO, sets ACCNOL to -1, sets SEND-DATAONLY-ALARM to true, and performs SEND-MAP to send the invalid key message.

      *       When anything else happens, send the invalid key message
*
WHEN OTHER
MOVE LOW-VALUES TO BNK1DAO
MOVE 'Invalid key pressed.' TO MESSAGEO
MOVE -1 TO ACCNOL
SET SEND-DATAONLY-ALARM TO TRUE

PERFORM SEND-MAP


COMMAREA Data Preparation

This is the next section of the flow.


Checking Account Type

First, we check if INQACC-EYE (which holds the account type) is equal to 'ACCT'. This condition determines if the subsequent account information transfer should occur.

              IF INQACC-EYE = 'ACCT'


Transferring Account Information

Moving to the next step, if the account type is 'ACCT', we transfer various fields from INQACC (which holds the inquiry account details) to WS-COMM (which is the working storage communication area). This includes customer number, account number, account type, interest rate, and balance details. This transfer ensures that the working storage area has the latest account information for further processing.

                 MOVE INQACC-EYE          TO WS-COMM-EYE
MOVE INQACC-CUSTNO TO WS-COMM-CUSTNO
MOVE INQACC-SCODE TO WS-COMM-SCODE
MOVE INQACC-ACCNO TO WS-COMM-ACCNO
MOVE INQACC-ACC-TYPE TO WS-COMM-ACC-TYPE
MOVE INQACC-INT-RATE TO WS-COMM-INT-RATE
MOVE INQACC-OPENED TO WS-COMM-OPENED
MOVE INQACC-OVERDRAFT TO WS-COMM-OVERDRAFT
MOVE INQACC-LAST-STMT-DT TO WS-COMM-LAST-STMT-DT
MOVE INQACC-NEXT-STMT-DT TO WS-COMM-NEXT-STMT-DT
MOVE INQACC-AVAIL-BAL TO WS-COMM-AVAIL-BAL
MOVE INQACC-ACTUAL-BAL TO WS-COMM-ACTUAL-BAL
MOVE INQACC-SUCCESS TO WS-COMM-SUCCESS


Initializing Communication Area

Then, if the account type is not 'ACCT', we initialize WS-COMM-AREA to reset any previous data. This ensures that no outdated or irrelevant data is carried forward.

              ELSE
INITIALIZE WS-COMM-AREA
END-IF

Interim Summary

So far, we saw how different key presses are handled in the CICS Bank Sample Application, including actions for PA, PF3, PF5, PF12, CLEAR, ENTER, and invalid keys. Now, we will focus on the preparation of the COMMAREA data.

CICS Return Setup


Handling the Response of a Transaction Initiation

First, the transaction is initiated with the RETURN TRANSID('ODAC') command, which specifies the transaction ID. The COMMAREA is set to WS-COMM-AREA, which is the communication area for passing data. The LENGTH is set to 102, indicating the length of the communication area. The RESP and RESP2 fields are used to capture the primary and secondary response codes from the transaction initiation.

              RETURN TRANSID('ODAC')
COMMAREA(WS-COMM-AREA)
LENGTH(102)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.



Checking the Transaction Response

Next, the response of the transaction initiation is checked. If WS-CICS-RESP is not equal to DFHRESP(NORMAL), it indicates that the transaction did not complete successfully. In this case, the POPULATE-TIME-DATE section is called to log the current time and date.

              RETURN TRANSID('ODAC')
COMMAREA(WS-COMM-AREA)
LENGTH(102)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.



Populating the Current Time and Date

The POPULATE-TIME-DATE section is responsible for capturing the current time and date. It first displays a message indicating that the section is being executed. Then, it uses the EXEC CICS ASKTIME command to get the current time in WS-U-TIME. This is followed by the EXEC CICS FORMATTIME command, which formats the time into a readable date (WS-ORIG-DATE) and time (WS-TIME-NOW).

       POPULATE-TIME-DATE SECTION.
PTD010.
D DISPLAY 'POPULATE-TIME-DATE SECTION'.

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.

This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human