Skip to main content

Managing Customer Data (CUSTCTRL)

The CUSTCTRL program is responsible for managing customer data within the banking application. It retrieves the number of customers from a VSAM file, displays the retrieved data, and exits the program gracefully. This is achieved through a series of operations including initializing required codes, performing CICS READ operations, and handling system ID errors.

The flow starts with initializing the required sort code, then retrieves the number of customers from the VSAM file, displays the output data, and finally exits the program. The program handles system ID errors by retrying the read operation up to 100 times with a delay.

Lets' zoom into the flow:


Initializing the Required Sort Code

First, the PREMIERE section initializes the REQUIRED-SORT-CODE by moving the value from SORTCODE. This sets up the necessary sort code for subsequent operations.

       PREMIERE SECTION.
P010.
MOVE SORTCODE TO
REQUIRED-SORT-CODE.


Retrieving Number of Customers from VSAM

Next, the program performs the GET-NUMBER-OF-CUSTOMERS-VSAM section to retrieve the number of customers from the VSAM file. This involves reading the customer data into DFHCOMMAREA.

           PERFORM GET-NUMBER-OF-CUSTOMERS-VSAM


GET-NUMBER-OF-CUSTOMERS-VSAM

The GET-NUMBER-OF-CUSTOMERS-VSAM section initializes DFHCOMMAREA, sets up the control sort code and number, and performs a CICS READ operation to fetch customer data. If a system ID error occurs, it retries the read operation up to 100 times with a delay. If the read is unsuccessful, it sets a failure flag and code.

       GET-NUMBER-OF-CUSTOMERS-VSAM SECTION.
WCV010.

INITIALIZE DFHCOMMAREA.


MOVE ZERO TO CUSTOMER-CONTROL-SORTCODE
MOVE ALL '9' TO CUSTOMER-CONTROL-NUMBER


EXEC CICS READ
FILE('CUSTOMER')
INTO(DFHCOMMAREA)
RIDFLD(CUSTOMER-CONTROL-KEY)
KEYLENGTH(16)
RESP(WS-CICS-RESP)
RESP2(WS-CICS-RESP2)
END-EXEC.

if ws-cics-resp = dfhresp(sysiderr)
perform varying SYSIDERR-RETRY from 1 by 1


Displaying Output Data

Then, the program displays the output data stored in DFHCOMMAREA. This provides a way to verify the retrieved customer data.

      D    DISPLAY 'OUTPUT DATA IS='
D DFHCOMMAREA.


Exiting the Program

Finally, the program performs the GET-ME-OUT-OF-HERE section to exit the program gracefully.

           PERFORM GET-ME-OUT-OF-HERE.


GET-ME-OUT-OF-HERE

The GET-ME-OUT-OF-HERE section executes a CICS RETURN command to exit the program.

       GET-ME-OUT-OF-HERE SECTION.
GMOFH010.

EXEC CICS RETURN
END-EXEC.

 

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