Transferring Funds (BNK1TFN)
The BNK1TFN
The flow starts by evaluating the key pressed by the user. Depending on the key, it performs actions like sending maps with erased data fields, continuing without action, returning to the main menu, sending termination messages, erasing the screen, processing entered content, or notifying the user of an invalid key press. After handling the key press, the program returns control to the main transaction, ensuring the application flow continues smoothly. If an error occurs, it logs the error details and calls the abend handler for further processing.
Here is a high level diagram of the program:
Evaluate and Control Actions
Handling First Time Through
First, the code checks if it is the first time through by evaluating if EIBCALENBNK1TFOSEND-ERASESEND-MAP
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 BNK1TFO
SET SEND-ERASE TO TRUE
PERFORM SEND-MAP
Handling PA Key Presses
Moving to the next condition, if a PA key (DFHPA1DFHPA2DFHPA3
* If a PA key is pressed, just carry on
*
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
Handling Pf3 Key Press
Pf3Next, if the Pf3DFHPF3
* 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
Pf12Then, if the aid key (DFHAIDPf12DFHPF12SEND-TERMINATION-MSG
* 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
* 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 (DFHENTERPROCESS-MAP
* When enter is pressed then process the content
*
WHEN EIBAID = DFHENTER
PERFORM PROCESS-MAP
Handling Invalid Key Press
Finally, if any other key is pressed, the program moves low values to BNK1TFOMESSAGEOSEND-DATAONLY-ALARMSEND-MAP
*
WHEN OTHER
MOVE LOW-VALUES TO BNK1TFO
MOVE 'Invalid key pressed.' TO MESSAGEO
* MOVE 10 TO CUSTNOL
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM SEND-MAP
Return to CICS
This is the next section of the flow.
Return Control to Main Transaction
First, the RETURN command is used to pass control back to the main transaction. This is essential for ensuring that the application flow continues as expected after the current processing is complete.
*
* Now RETURN
*
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Specify Transaction ID
Next, the TRANSID('OTFN')
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Pass Communication Area
Then, the COMMAREA(WS-COMMAREA)
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Set Length of Communication Area
The LENGTH(29)
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Handle Response Codes
Finally, the RESP(WS-CICS-RESP)RESP2(WS-CICS-RESP2)
EXEC CICS
RETURN TRANSID('OTFN')
COMMAREA(WS-COMMAREA)
LENGTH(29)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.
Interim Summary
So far, we saw how the program handles different key presses such as PA keys, Pf3Pf12
Error Handling
Checking CICS Response
First, we check if WS-CICS-RESPDFHRESP(NORMAL)
IF WS-CICS-RESP NOT = DFHRESP(NORMAL)
Preserving Response Codes
Next, we preserve the response codes by moving EIBRESPABND-RESPCODEEIBRESP2ABND-RESP2CODE
INITIALIZE ABNDINFO-REC
MOVE EIBRESP TO ABND-RESPCODE
MOVE EIBRESP2 TO ABND-RESP2CODE
Assigning Application ID
Then, we assign the application ID to ABND-APPLIDEXEC CICS ASSIGN
EXEC CICS ASSIGN APPLID(ABND-APPLID)
END-EXEC
Moving Task and Transaction IDs
We move the task number and transaction ID to ABND-TASKNO-KEYABND-TRANID
MOVE EIBTASKN TO ABND-TASKNO-KEY
MOVE EIBTRNID TO ABND-TRANID
Populating Time and Date
We perform the POPULATE-TIME-DATE
PERFORM POPULATE-TIME-DATE
Populating Time and Date Details
The POPULATE-TIME-DATEEXEC CICS ASKTIMEEXEC CICS FORMATTIME
POPULATE-TIME-DATE SECTION.
PTD010.
*
* Fomate the date and time
*
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 to ABND-DATEWS-TIME-NOW-GRP-HHWS-TIME-NOW-GRP-MMWS-TIME-NOW-GRP-MMABND-TIME
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-PROGRAMEXEC CICS ASSIGN
EXEC CICS ASSIGN PROGRAM(ABND-PROGRAM)
END-EXEC
Constructing Freeform Message
We construct a freeform message that includes the error codes and a descriptive message. This message is stored in ABND-FREEFORM
STRING 'A010 - RETURN TRANSID(OCCS) 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 using EXEC CICS LINK PROGRAM(WS-ABEND-PGM) COMMAREA(ABNDINFO-REC). This passes the abend information to the handler for further processing.
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