Updating Customer (UPDCUST)
The UPDCUST program is responsible for updating customer information in the banking system. It is used once in a flow starting from the BNK1DCS program. The program achieves its role by performing a series of steps including setting up data, validating customer titles, processing the update, and finalizing the transaction.
The UPDCUST program starts by setting up necessary data and clearing previous values. It then validates the customer's title against a list of acceptable titles. If the title is valid, it proceeds to update the customer information in the datastore. Finally, it completes the process by finalizing the transaction and returning control to CICS.
Where is this program used?
This program is used once, in a flow starting from BNK1DCS
as represented in the following diagram:
Here is a high level diagram of the program:
Setups
Moving SORTCODE to COMM-SCODE
COMM-SCODE
First, the SORTCODE
COMM-SCODE
MOVE SORTCODE TO COMM-SCODE
DESIRED-SORT-CODE.
Clearing WS-UNSTR-TITLE
WS-UNSTR-TITLE
Next, spaces are moved to WS-UNSTR-TITLE
MOVE SPACES TO WS-UNSTR-TITLE.
Unstringing COMM-NAME
COMM-NAME
Then, the COMM-NAME
WS-UNSTR-TITLE
UNSTRING COMM-NAME DELIMITED BY SPACE
INTO WS-UNSTR-TITLE.
Evaluating WS-UNSTR-TITLE
WS-UNSTR-TITLE
Moving to the evaluation of WS-UNSTR-TITLE
WS-TITLE-VALID
EVALUATE WS-UNSTR-TITLE
WHEN 'Professor'
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Mr '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Mrs '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Miss '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Ms '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Dr '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Drs '
MOVE 'Y' TO WS-TITLE-VALID
Handling Invalid Titles
If the title is not valid (WS-TITLE-VALID
COMM-UPD-SUCCESS
COMM-UPD-FAIL-CD
IF WS-TITLE-VALID = 'N'
MOVE 'N' TO COMM-UPD-SUCCESS
MOVE 'T' TO COMM-UPD-FAIL-CD
GOBACK
END-IF
Updating Customer Data
If the title is valid, the code performs the UPDATE-CUSTOMER-VSAM
PERFORM UPDATE-CUSTOMER-VSAM
*
Finalizing the Update
Finally, the code performs the GET-ME-OUT-OF-HERE
PERFORM GET-ME-OUT-OF-HERE.
Validation
Validating Customer Titles
First, the code initializes the variable WS-TITLE-VALID
WS-UNSTR-TITLE
WS-TITLE-VALID
WS-TITLE-VALID
MOVE ' ' TO WS-TITLE-VALID.
EVALUATE WS-UNSTR-TITLE
WHEN 'Professor'
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Mr '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Mrs '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Miss '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Ms '
MOVE 'Y' TO WS-TITLE-VALID
WHEN 'Dr '
MOVE 'Y' TO WS-TITLE-VALID
Handling Invalid Titles
Next, the code checks if WS-TITLE-VALID
COMM-UPD-SUCCESS
COMM-UPD-FAIL-CD
GOBACK
IF WS-TITLE-VALID = 'N'
MOVE 'N' TO COMM-UPD-SUCCESS
MOVE 'T' TO COMM-UPD-FAIL-CD
GOBACK
Interim Summary
So far, we saw how the program handles the setup and validation of customer titles, including moving and unstringing data, and evaluating the validity of titles. Now, we will focus on the process and finalization steps, where the program updates the customer information and finalizes the transaction.
Process & Finalization
Update Customer Information
First, we perform the UPDATE-CUSTOMER-VSAM
* Update the CUSTOMER datastore
*
PERFORM UPDATE-CUSTOMER-VSAM
Finalize Process
Next, we perform the GET-ME-OUT-OF-HERE
* The COMMAREA values have now been set so all we need to do
* is finish
*
PERFORM GET-ME-OUT-OF-HERE.
GET-ME-OUT-OF-HERE
GET-ME-OUT-OF-HERE
The GET-ME-OUT-OF-HERE
GET-ME-OUT-OF-HERE SECTION.
GMOOH010.
EXEC CICS RETURN
END-EXEC.
GMOOH999.
EXIT.
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human