Deleting Customer (DELCUS)
The DELCUS program is responsible for deleting a customer record from the system. This process involves initializing the deletion, verifying the customer's existence, retrieving and deleting associated accounts, and finally removing the customer record from the VSAM file. The program ensures that all related data is properly handled before completing the deletion process.
The flow starts by setting up the necessary information to identify the customer. It then verifies if the customer exists, retrieves any associated accounts, deletes those accounts, and finally removes the customer record from the system. Each step ensures that the data is correctly processed and the deletion is successful.
Where is this program used?
This program is used once, in a flow starting from BNK1DCS
as represented in the following diagram:
Lets' zoom into the flow:
Initializing Customer Deletion
First, the PREMIERE
PREMIERE SECTION.
A010.
MOVE SORTCODE TO REQUIRED-SORT-CODE
REQUIRED-SORT-CODE OF CUSTOMER-KY
DESIRED-KEY-SORTCODE.
MOVE COMM-CUSTNO OF DFHCOMMAREA
TO DESIRED-KEY-CUSTOMER.
Calling INQCUST Program
Next, the program calls INQCUST
INITIALIZE INQCUST-COMMAREA.
MOVE COMM-CUSTNO OF DFHCOMMAREA TO
INQCUST-CUSTNO.
EXEC CICS LINK PROGRAM(INQCUST-PROGRAM)
COMMAREA(INQCUST-COMMAREA)
END-EXEC.
Handling INQCUST Response
Then, the program checks the response from INQCUST
More about INQCUST:
IF INQCUST-INQ-SUCCESS = 'N'
MOVE 'N' TO COMM-DEL-SUCCESS
MOVE INQCUST-INQ-FAIL-CD TO COMM-DEL-FAIL-CD
EXEC CICS RETURN
END-EXEC
END-IF.
Retrieving Customer Accounts
Moving to the next step, the program performs GET-ACCOUNTS
PERFORM GET-ACCOUNTS
*
* If there are related accounts found then delete
* them.
*
IF NUMBER-OF-ACCOUNTS > 0
PERFORM DELETE-ACCOUNTS
END-IF
The GET-ACCOUNTS
INQACCCU
More about INQACCCU:
GET-ACCOUNTS SECTION.
GAC010.
*
* Link to INQACCCU to get all of the accounts for a
* given customer number.
*
MOVE COMM-CUSTNO OF DFHCOMMAREA
TO CUSTOMER-NUMBER OF INQACCCU-COMMAREA.
MOVE 20 TO NUMBER-OF-ACCOUNTS IN INQACCCU-COMMAREA.
SET COMM-PCB-POINTER OF INQACCCU-COMMAREA
TO DELACC-COMM-PCB1
EXEC CICS LINK PROGRAM('INQACCCU')
COMMAREA(INQACCCU-COMMAREA)
SYNCONRETURN
END-EXEC.
The DELETE-ACCOUNTS
DELACC
More about DELACC:
DELETE-ACCOUNTS SECTION.
DA010.
*
* Go through the entries (accounts) in the array,
* and for each one link to DELACC to delete that
* account.
*
PERFORM VARYING WS-INDEX FROM 1 BY 1
UNTIL WS-INDEX > NUMBER-OF-ACCOUNTS
INITIALIZE DELACC-COMMAREA
MOVE WS-APPLID TO DELACC-COMM-APPLID
MOVE COMM-ACCNO(WS-INDEX) TO DELACC-COMM-ACCNO
EXEC CICS LINK PROGRAM('DELACC ')
COMMAREA(DELACC-COMMAREA)
END-EXEC
END-PERFORM.
Deleting Customer Record
After deleting the accounts, the program performs DEL-CUST-VSAM
*
* Having deleted the accounts and written the
* details to the PROCTRAN datastore, if we haven't abended
* then we must go on to delete the CUSTOMER record
*
PERFORM DEL-CUST-VSAM
Finalizing Deletion Process
Finally, the program sets the deletion success flag to 'Y' and clears any failure codes. It then performs GET-ME-OUT-OF-HERE
MOVE 'Y' TO COMM-DEL-SUCCESS.
MOVE ' ' TO COMM-DEL-FAIL-CD.
PERFORM GET-ME-OUT-OF-HERE.
A999.
EXIT.
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human