Skip to main content

Updating Account (BNK1UAC)

The BNK1UAC program is responsible for evaluating user input and handling various key presses in a banking application. It ensures that user interactions are processed correctly by checking the input and performing the appropriate actions based on the key pressed. The program achieves this by using a series of conditional statements to determine the action to take for each key press, such as sending a map, returning to the main menu, or processing the map content.

The BNK1UAC program evaluates user input and handles key presses in a banking application. It checks which key is pressed and performs actions like sending a map, returning to the main menu, or processing the map content. This ensures that user interactions are processed correctly.

Here is a high level diagram of the program:

Evaluate User Input


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


Handling PA Key Presses

Moving to the next condition, if a PA key is pressed (EIBAID equals DFHPA1, DFHPA2, or DFHPA3), the code simply continues without any specific action.

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


Handling PF3 Key Press

Next, if the PF3 key is pressed (EIBAID equals DFHPF3), the code returns to the main menu by executing a CICS RETURN command with the transaction ID 'OMEN'.

      *
* 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 AID or PF12 Key Presses

Then, if the AID or PF12 key is pressed (EIBAID equals DFHAID or DFHPF12), the code performs SEND-TERMINATION-MSG and executes a CICS RETURN command.

      *       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 Press

When the CLEAR key is pressed (EIBAID equals DFHCLEAR), the code sends a control command to erase the screen and free the keyboard, then returns.

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

EXEC CICS RETURN
END-EXEC


Handling ENTER or PF5 Key Presses

When the ENTER or PF5 key is pressed (EIBAID equals DFHENTER or DFHPF5), the code performs PROCESS-MAP to process the content.

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

*
* When Pf5 is pressed then process the content
*
WHEN EIBAID = DFHPF5
PERFORM PROCESS-MAP



Handling Other Key Presses

Finally, for any other key presses, the code moves low values to BNK1UAO, sets the message to 'Invalid key pressed.', 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 BNK1UAO
MOVE 'Invalid key pressed.' TO MESSAGEO
MOVE -1 TO ACCNOL
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP

END-EVALUATE.

Set Return Information

This is the next section of the flow.


Checking if EIBCALEN is not zero

First, we check if EIBCALEN (which indicates the length of the communication area) is not zero. This condition ensures that the communication area has been initialized and contains data from a previous transaction.

           IF EIBCALEN NOT = ZERO


Moving COMM-EYE to WS-COMM-EYE

Next, we move the value of COMM-EYE (which holds a specific piece of customer data) to WS-COMM-EYE (a working storage variable). This step is part of the process of transferring data from the communication area to working storage for further processing.

              MOVE COMM-EYE            TO WS-COMM-EYE


Moving COMM-CUSTNO to WS-COMM-CUSTNO

Moving to the next step, we transfer the customer number from COMM-CUSTNO to WS-COMM-CUSTNO. This ensures that the customer number is available in working storage for any subsequent operations.

              MOVE COMM-CUSTNO         TO WS-COMM-CUSTNO


Moving COMM-SCODE to WS-COMM-SCODE

Then, we move the service code from COMM-SCODE to WS-COMM-SCODE. The service code is used to identify the type of service or transaction being processed.

              MOVE COMM-SCODE          TO WS-COMM-SCODE


Moving COMM-ACCNO to WS-COMM-ACCNO

Next, we transfer the account number from COMM-ACCNO to WS-COMM-ACCNO. This step is crucial for identifying the specific account involved in the transaction.

              MOVE COMM-ACCNO          TO WS-COMM-ACCNO


Moving COMM-ACC-TYPE to WS-COMM-ACC-TYPE

We then move the account type from COMM-ACC-TYPE to WS-COMM-ACC-TYPE. The account type indicates whether the account is a savings, checking, or another type of account.

              MOVE COMM-ACC-TYPE       TO WS-COMM-ACC-TYPE


Moving COMM-INT-RATE to WS-COMM-INT-RATE

Moving forward, we transfer the interest rate from COMM-INT-RATE to WS-COMM-INT-RATE. The interest rate is important for calculating interest on the account balance.

              MOVE COMM-INT-RATE       TO WS-COMM-INT-RATE


Moving COMM-OPENED to WS-COMM-OPENED

Next, we move the account opening date from COMM-OPENED to WS-COMM-OPENED. This date is used to track how long the account has been active.

              MOVE COMM-OPENED         TO WS-COMM-OPENED


Moving COMM-OVERDRAFT to WS-COMM-OVERDRAFT

We then transfer the overdraft limit from COMM-OVERDRAFT to WS-COMM-OVERDRAFT. The overdraft limit indicates the maximum amount the account can be overdrawn.

              MOVE COMM-OVERDRAFT      TO WS-COMM-OVERDRAFT


Moving COMM-LAST-STMT-DT to WS-COMM-LAST-STMT-DT

Next, we move the last statement date from COMM-LAST-STMT-DT to WS-COMM-LAST-STMT-DT. This date is used to determine when the last account statement was generated.

              MOVE COMM-LAST-STMT-DT   TO WS-COMM-LAST-STMT-DT


Moving COMM-NEXT-STMT-DT to WS-COMM-NEXT-STMT-DT

We then transfer the next statement date from COMM-NEXT-STMT-DT to WS-COMM-NEXT-STMT-DT. This date indicates when the next account statement will be generated.

              MOVE COMM-NEXT-STMT-DT   TO WS-COMM-NEXT-STMT-DT


Moving COMM-AVAIL-BAL to WS-COMM-AVAIL-BAL

Next, we move the available balance from COMM-AVAIL-BAL to WS-COMM-AVAIL-BAL. The available balance is the amount of money that is currently available for withdrawal.

              MOVE COMM-AVAIL-BAL      TO WS-COMM-AVAIL-BAL


Moving COMM-ACTUAL-BAL to WS-COMM-ACTUAL-BAL

Finally, we transfer the actual balance from COMM-ACTUAL-BAL to WS-COMM-ACTUAL-BAL. The actual balance is the total amount of money in the account, including any pending transactions.

              MOVE COMM-ACTUAL-BAL     TO WS-COMM-ACTUAL-BAL

Return to CICS with COMMAREA

This is the next section of the flow.


Returning Control to CICS

First, the EXEC CICS RETURN command is used to return control to the CICS system. This is essential for ending the current transaction and allowing CICS to manage the next steps in the workflow.

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



Setting Transaction ID

Next, the transaction ID is set to 'OUAC'. This ID is used by CICS to determine the next transaction to be executed.

              RETURN TRANSID('OUAC')


Setting Communication Area

Then, the communication area (COMMAREA) is set to WS-COMM-AREA. This area is used to pass data between transactions.

              COMMAREA(WS-COMM-AREA)


Setting Length

The length of the communication area is set to 99. This specifies the size of the data being passed.

              LENGTH(99)


Setting Response Codes

Finally, the response codes (RESP and RESP2) are set to WS-CICS-RESP and WS-CICS-RESP2 respectively. These codes are used to capture the status of the RETURN command execution.

              RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)

Interim Summary

So far, we saw how the program evaluates user input and handles various key presses such as PA, PF3, AID, PF12, CLEAR, ENTER, and PF5. We also covered how the program processes invalid key presses. Now, we will focus on setting return information and returning control to CICS with the communication area.

Error Handling


Check CICS Response

First, we check if the CICS response code WS-CICS-RESP is not equal to DFHRESP(NORMAL). This indicates an abnormal response that requires error handling.

           IF WS-CICS-RESP NOT = DFHRESP(NORMAL)


Initialize ABNDINFO-REC

Moving to the next step, we initialize the ABNDINFO-REC record and move the response codes EIBRESP and EIBRESP2 to ABND-RESPCODE and ABND-RESP2CODE respectively. This preserves the original response codes for logging.

              INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE


Assign APPLID and Task Information

Then, we assign the application ID to ABND-APPLID and move the task number EIBTASKN and transaction ID EIBTRNID to ABND-TASKNO-KEY and ABND-TRANID respectively. This gathers additional context for the error.

              EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC

MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID


Perform POPULATE-TIME-DATE

Next, we perform the POPULATE-TIME-DATE section to get the current date and time.

              PERFORM POPULATE-TIME-DATE


POPULATE-TIME-DATE

The POPULATE-TIME-DATE section uses CICS commands to get the current time and format it into WS-ORIG-DATE and WS-TIME-NOW. This information is used for timestamping the error.

       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.


Format Date and Time

Then, we move the original date WS-ORIG-DATE to ABND-DATE and format the current time into ABND-TIME. This provides a timestamp for the error log.

              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


Assign Additional Information

We then move the universal time WS-U-TIME to ABND-UTIME-KEY and assign the code 'HBNK' to ABND-CODE. We also assign the current program name to ABND-PROGRAM. This adds more context to the error log.

              MOVE WS-U-TIME   TO ABND-UTIME-KEY
MOVE 'HBNK' TO ABND-CODE

EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC


Format Error Message

Next, we move zeros to ABND-SQLCODE and format a detailed error message into ABND-FREEFORM. This message includes the response codes and a description of the error.

              MOVE ZEROS      TO ABND-SQLCODE

STRING 'A010 - RETURN TRANSID(OUAC) 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


We then link to the abend handler program WS-ABEND-PGM with the ABNDINFO-REC as the communication area. This triggers the abend handling process.

              EXEC CICS LINK PROGRAM(WS-ABEND-PGM)
COMMAREA(ABNDINFO-REC)
END-EXEC


Initialize Failure Information

Finally, we initialize the WS-FAIL-INFO record and move the error message and response codes to display fields. We then perform the ABEND-THIS-TASK section to abend the current task.

              INITIALIZE WS-FAIL-INFO
MOVE 'BNK1UAC - A010 - RETURN TRANSID(OUAC) 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 ABEND-THIS-TASK

 

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