Skip to main content

Credit/Debit (BNK1CRA)

The BNK1CRA program handles user inputs and maps them accordingly in a banking application. It ensures data preservation for subsequent processing and manages system returns and error handling. The program achieves this by evaluating key presses, processing user inputs, and preserving data for continuity and accuracy in the user's session.

The BNK1CRA program starts by checking if it's the first time through and sends a map with erased data fields if true. It then handles various key presses such as PA, PF3, AID, PF12, CLEAR, ENTER, and invalid keys by performing specific actions for each. The program also preserves data for subsequent processing by moving account numbers, signs, and amounts to working storage areas. Finally, it manages system returns and error handling by checking CICS responses, initializing abend information, and linking to the abend handler program.

Here is a high level diagram of the program:

Handling User Inputs and Mapping


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 BNK1CDO, sets ACCNOL to -1, and sets SEND-ERASE to true. Then, it performs the SEND-MAP operation 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 BNK1CDO
MOVE -1 TO ACCNOL
SET SEND-ERASE TO TRUE
PERFORM SEND-MAP


Handling PA Key Press

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

              WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE


Handling PF3 Key Press

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

              WHEN EIBAID = DFHPF3
EXEC CICS RETURN
TRANSID('OMEN')
IMMEDIATE
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC


Handling AID or PF12 Key Press

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

              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, followed by a CICS RETURN command.

              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 (EIBAID equals DFHENTER), the code performs the PROCESS-MAP operation to process the content entered by the user.

              WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP



Handling Invalid Key Press

Finally, if any other key is pressed, the code moves low values to BNK1CDO, sets the message to 'Invalid key pressed.', sets ACCNOL to 8, and sets SEND-DATAONLY-ALARM to true. It then performs the SEND-MAP operation to send the invalid key message.

              WHEN OTHER
MOVE LOW-VALUES TO BNK1CDO
MOVE 'Invalid key pressed.' TO MESSAGEO
MOVE 8 TO ACCNOL
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP

Data Preservation for Subsequent Processing

This is the next section of the flow.


Checking EIBCALEN

First, the code checks if EIBCALEN (which indicates the length of the communication area) is not zero. This condition ensures that the data transfer only occurs if it is not the first time through the program.

           IF EIBCALEN NOT = ZERO


Moving Account Number

Next, the account number from the communication area (COMM-ACCNO) is moved to the working storage area (WS-COMM-ACCNO). This step ensures that the account number is available for further processing.

              MOVE COMM-ACCNO  TO WS-COMM-ACCNO


Moving Sign

Then, the sign from the communication area (COMM-SIGN) is moved to the working storage area (WS-COMM-SIGN). This step ensures that the sign information is available for further processing.

              MOVE COMM-SIGN   TO  WS-COMM-SIGN


Moving Amount

Finally, the amount from the communication area (COMM-AMT) is moved to the working storage area (WS-COMM-AMT). This step ensures that the amount information is available for further processing.

              MOVE COMM-AMT    TO WS-COMM-AMT

Interim Summary

So far, we saw how the program handles various key presses, including PA, PF3, AID, PF12, CLEAR, ENTER, and invalid keys, and how it processes user inputs and maps them accordingly. Now, we will focus on how the program preserves data for subsequent processing to ensure continuity and accuracy in the user's session.

System Return and Error Handling


Checking CICS Response

First, we check if WS-CICS-RESP is not equal to DFHRESP(NORMAL). This condition determines if there was an error in the previous CICS transaction.

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


Initializing Abend Information

Next, we initialize the ABNDINFO-REC and move the response codes EIBRESP and EIBRESP2 to ABND-RESPCODE and ABND-RESP2CODE respectively. This step preserves the error codes for further processing.

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


Assigning Application ID

Then, we assign the application ID to ABND-APPLID using the CICS ASSIGN command. This helps in identifying the application where the error occurred.

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


Moving Task and Transaction IDs

We move the task number EIBTASKN to ABND-TASKNO-KEY and the transaction ID EIBTRNID to ABND-TRANID. These values are essential for tracking the specific task and transaction that encountered the error.

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


Populating Time and Date

Next, we perform the POPULATE-TIME-DATE section to get the current time and date. This information is crucial for logging and debugging purposes.

              PERFORM POPULATE-TIME-DATE


Populating Time and Date Details

The POPULATE-TIME-DATE section uses CICS commands ASKTIME and FORMATTIME to get the current time in WS-U-TIME and format it into WS-ORIG-DATE and WS-TIME-NOW. This formatted time and date are then used in the abend information.

       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.


Moving Date and Time

We 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. This step ensures that the abend record has accurate date and time information.

              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


Assigning Program Name

We assign the current program name to ABND-PROGRAM using the CICS ASSIGN command. This helps in identifying which program encountered the error.

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


Constructing Freeform Message

We construct a freeform message ABND-FREEFORM that includes the error message, response codes, and other relevant information. This message is useful for debugging and logging purposes.

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


Linking to Abend Handler

Finally, we link to the abend handler program WS-ABEND-PGM with the ABNDINFO-REC commarea. This step transfers control to the abend handler to process the error.

              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