Skip to main content

Listing Accounts (BNK1CCA)

The BNK1CCA program handles keypress events and prepares return setups in a banking application. It checks the type of key pressed and performs corresponding actions such as sending maps, returning to the main menu, or processing map content. The program also includes error handling and abend information preparation to manage and log errors effectively.

The BNK1CCA program starts by checking if it's the first time through and sends a map with erased data fields if true. It then handles different keypress events: PA keys continue without action, PF3 returns to the main menu, AID or PF12 sends a termination message, CLEAR erases the screen, ENTER processes the map content, and other keys send an invalid key message. The program also includes error handling to log and manage errors by checking CICS responses, initializing error records, and linking to an abend handler.

Here is a high level diagram of the program:

Keypress Event Handling and Return Setup


Initial Check

First, the code checks if it is the first time through by evaluating if EIBCALEN is zero. If true, it moves LOW-VALUE to BNK1ACCO, sets CUSTNOL 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 BNK1ACCO
MOVE -1 TO CUSTNOL
SET SEND-ERASE TO TRUE
PERFORM SEND-MAP


Handling PA Key Presses

Moving to the next condition, 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

Next, if the PF3 key (DFHPF3) is pressed, 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 Press

Then, if the AID key (DFHAID) or PF12 key (DFHPF12) is pressed, the code performs the SEND-TERMINATION-MSG operation and then 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 (DFHCLEAR) 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 (DFHENTER) is pressed, the code performs the PROCESS-MAP operation to process the content entered by the user.

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


Handling Other Key Presses

For any other key presses, the code moves LOW-VALUES to BNK1ACCO, sets the message to 'Invalid key pressed.', sets CUSTNOL to -1, and sets SEND-DATAONLY-ALARM to true. Then, it performs the SEND-MAP operation to send the invalid key message.

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


Final Return

Finally, the code executes a CICS RETURN command with the transaction ID 'OCCA', passing the communication area WS-COMM-AREA with a length of 248.

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

Error Handling and Abend Information Preparation


Checking CICS Response

First, the code checks if the CICS response (WS-CICS-RESP) is not normal. This is crucial to determine if there was an error in the previous CICS command execution.

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


Initializing ABNDINFO-REC

Next, the ABNDINFO-REC structure is initialized to store abend information. This structure will hold various details about the error for logging and debugging purposes.

              INITIALIZE ABNDINFO-REC


Moving Response Codes

Then, the response codes EIBRESP and EIBRESP2 are moved to ABND-RESPCODE and ABND-RESP2CODE respectively. These codes provide specific details about the error encountered.

              MOVE EIBRESP    TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE


Assigning APPLID

The application ID (APPLID) is assigned to ABND-APPLID. This helps in identifying the application where the error occurred.

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


Moving Task and Transaction IDs

The task number (EIBTASKN) and transaction ID (EIBTRNID) are moved to ABND-TASKNO-KEY and ABND-TRANID respectively. These identifiers are useful 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

The POPULATE-TIME-DATE function is performed to get the current date and time. This information is crucial for logging the exact time of the error.

              PERFORM POPULATE-TIME-DATE


POPULATE-TIME-DATE Function

The POPULATE-TIME-DATE function uses CICS commands to get the current time (ASKTIME) and format it (FORMATTIME). The formatted date and time are stored in WS-ORIG-DATE and WS-TIME-NOW respectively.

       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

The original date (WS-ORIG-DATE) and the current time (WS-TIME-NOW-GRP-HH, WS-TIME-NOW-GRP-MM) are moved to ABND-DATE and ABND-TIME. This ensures that the error log contains 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


Moving Unique Time and Code

The unique time (WS-U-TIME) and a specific code ('HBNK') are moved to ABND-UTIME-KEY and ABND-CODE. These values help in uniquely identifying the error instance.

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


Assigning Program

The program name is assigned to ABND-PROGRAM. This indicates which program was executing when the error occurred.

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


Moving SQL Code

The SQL code is set to zero (ZEROS). This is a placeholder indicating that no SQL error occurred.

              MOVE ZEROS      TO ABND-SQLCODE


Formatting Error Message

An error message is formatted and moved to ABND-FREEFORM. This message includes details about the error, such as the response codes and a specific error description.

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

The WS-ABEND-PGM is linked with the ABNDINFO-REC as the communication area. This step transfers control to the abend handler program to process the error.

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


Initializing Fail Info

The WS-FAIL-INFO structure is initialized to store failure information. This structure will hold details about the failure for further processing.

              INITIALIZE WS-FAIL-INFO


Moving Failure Message

A failure message is moved to WS-CICS-FAIL-MSG. This message provides a description of the failure for logging purposes.

              MOVE 'BNK1CCA - A010 - RETURN TRANSID(OCCA) FAIL' TO
WS-CICS-FAIL-MSG

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