Skip to main content

Cash Transactions (DBCRFUN)

The DBCRFUN program is responsible for updating account information in the database. It is used in a flow starting from the BNK1CRA program. The process involves initializing communication codes, updating account records in the database, and handling any errors or abnormal terminations.

The flow starts with the BNK1CRA program, which calls the DBCRFUN program. The DBCRFUN program first initializes communication codes and sets up error handling. It then updates the account information in the database by moving the account number and sort code to host variables, retrieving account information, and updating balances based on debit or credit transactions. Finally, it logs the processed transaction and exits the program.

Where is this program used?

This program is used once, in a flow starting from BNK1CRA as represented in the following diagram:

Lets' zoom into the flow:


PREMIERE Section

First, the PREMIERE section initializes the communication success and failure codes. It sets up Abend handling to manage any abnormal terminations. Then, it moves the SORTCODE to COMM-SORTC and DESIRED-SORT-CODE. This prepares the necessary data for the account update process. The section then performs the UPDATE-ACCOUNT-DB2 paragraph to update the account record in the database. Finally, it performs the GET-ME-OUT-OF-HERE paragraph to complete the process and exit.

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

*
* Set up some Abend handling
*
EXEC CICS HANDLE ABEND
LABEL(ABEND-HANDLING)
END-EXEC.

MOVE SORTCODE TO COMM-SORTC.
MOVE SORTCODE TO DESIRED-SORT-CODE.

*
* Determine what kind of ACCOUNT datastore we should
* be accessing
*




UPDATE-ACCOUNT-DB2 Section

Moving to the UPDATE-ACCOUNT-DB2 section, it starts by moving the account number and sort code to the host variables. It then retrieves the account information from the database using an SQL SELECT statement. If the SQLCODE is not zero, it handles the error by setting the communication success to 'N' and the failure code accordingly. If the amount requested is a debit, it checks if the available balance is sufficient. If not, it sets the failure code and exits. If the amount is a credit, it updates the account balances and writes the updated information back to the database. Finally, it performs the WRITE-TO-PROCTRAN paragraph to log the processed transaction.

       UPDATE-ACCOUNT-DB2 SECTION.
UAD010.

MOVE COMM-ACCNO TO DESIRED-ACC-NO.
MOVE DESIRED-SORT-CODE TO HV-ACCOUNT-SORTCODE.
MOVE DESIRED-ACC-NO TO HV-ACCOUNT-ACC-NO.

*
* Retrieve the account information
*
EXEC SQL
SELECT ACCOUNT_EYECATCHER,
ACCOUNT_CUSTOMER_NUMBER,
ACCOUNT_SORTCODE,
ACCOUNT_NUMBER,
ACCOUNT_TYPE,
ACCOUNT_INTEREST_RATE,
ACCOUNT_OPENED,
ACCOUNT_OVERDRAFT_LIMIT,
ACCOUNT_LAST_STATEMENT,
ACCOUNT_NEXT_STATEMENT,


GET-ME-OUT-OF-HERE Section

Then, the GET-ME-OUT-OF-HERE section is executed. This section simply returns control to CICS and exits the program. This marks the end of the PREMIERE function's execution.

       GET-ME-OUT-OF-HERE SECTION.
GMOOH010.
EXEC CICS RETURN
END-EXEC.
GOBACK.

GMOOH999.
EXIT.

 

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