Skip to main content

Retrieving Customer Accounts (INQACCCU)

The INQACCCU program is responsible for inquiring about customer accounts. It is used in multiple parts of the system to retrieve and verify customer information. The program achieves this by performing a series of checks and database operations to ensure the customer exists and their account details are accurate.

The flow starts with initializing communication codes and setting up an ABEND handler. It then checks if the customer exists in the database. If the customer is not found, it exits the process. If the customer is found, it retrieves account information from the database and completes the transaction.

Where is this program used?

This program is used multiple times in the codebase as represented in the following diagram:

Lets' zoom into the flow:


Start PREMIERE Section

First, the PREMIERE section initializes communication success and failure codes. It then sets up an ABEND (abnormal end) handler to manage unexpected terminations. This ensures that any issues during execution are properly handled.

       PREMIERE SECTION.
A010.
MOVE 'N' TO COMM-SUCCESS
MOVE '0' TO COMM-FAIL-CODE

EXEC CICS HANDLE ABEND
LABEL(ABEND-HANDLING)
END-EXEC.

MOVE SORTCODE TO REQUIRED-SORT-CODE OF CUSTOMER-KY.



Perform CUSTOMER-CHECK

Next, the CUSTOMER-CHECK paragraph is performed to retrieve customer information. This step is crucial as it determines if the customer exists in the database.

           PERFORM CUSTOMER-CHECK.


CUSTOMER-CHECK Paragraph

The CUSTOMER-CHECK paragraph checks if the customer number is valid. If the customer number is zero or a specific invalid number, it sets CUSTOMER-FOUND to 'N'. Otherwise, it links to the INQCUST program to retrieve customer information and sets CUSTOMER-FOUND based on the success of this operation.

More about INQCUST: Get Customer Record (INQCUST)

       CUSTOMER-CHECK SECTION.
CC010.
*
* Retrieve customer information by linking to INQCUST
*

IF CUSTOMER-NUMBER IN DFHCOMMAREA = ZERO
MOVE 'N' TO CUSTOMER-FOUND
MOVE ZERO TO NUMBER-OF-ACCOUNTS
GO TO CC999
END-IF.

IF CUSTOMER-NUMBER IN DFHCOMMAREA = '9999999999'
MOVE 'N' TO CUSTOMER-FOUND
MOVE ZERO TO NUMBER-OF-ACCOUNTS
GO TO CC999
END-IF.

INITIALIZE INQCUST-COMMAREA.

MOVE CUSTOMER-NUMBER IN DFHCOMMAREA TO INQCUST-CUSTNO.


Check CUSTOMER-FOUND

Then, the code checks if CUSTOMER-FOUND is 'N'. If true, it sets the communication success to 'N' and the failure code to '1', and performs the GET-ME-OUT-OF-HERE paragraph to exit the process.

           IF CUSTOMER-FOUND = 'N'
MOVE 'N' TO COMM-SUCCESS
MOVE '1' TO COMM-FAIL-CODE
PERFORM GET-ME-OUT-OF-HERE
END-IF


GET-ME-OUT-OF-HERE Paragraph

The GET-ME-OUT-OF-HERE paragraph returns control back to CICS, effectively ending the current transaction.

       GET-ME-OUT-OF-HERE SECTION.
GMOFH010.
*
* Return control back to CICS
*
EXEC CICS RETURN
END-EXEC.

GOBACK.

GMOFH999.
EXIT.


Perform READ-ACCOUNT-DB2

If the customer is found, the READ-ACCOUNT-DB2 paragraph is performed to retrieve account information from the database.

           PERFORM READ-ACCOUNT-DB2


READ-ACCOUNT-DB2 Paragraph

The READ-ACCOUNT-DB2 paragraph opens a DB2 cursor to fetch account data associated with the customer. It handles SQL errors and performs necessary rollback operations if any issues occur. Finally, it closes the cursor and sets the communication success flag.

       READ-ACCOUNT-DB2 SECTION.
RAD010.
*
* Get accounts from account datastore
*

*
* Open the DB2 CURSOR
*

MOVE CUSTOMER-NUMBER IN DFHCOMMAREA TO HV-ACCOUNT-CUST-NO.
MOVE SORTCODE TO HV-ACCOUNT-SORTCODE.

EXEC SQL OPEN
ACC-CURSOR
END-EXEC.

MOVE SQLCODE TO SQLCODE-DISPLAY.

IF SQLCODE NOT = 0
MOVE SQLCODE TO SQLCODE-DISPLAY


Perform GET-ME-OUT-OF-HERE

Finally, the GET-ME-OUT-OF-HERE paragraph is performed again to return control back to CICS, completing the transaction.

           PERFORM GET-ME-OUT-OF-HERE.

 

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