Skip to main content

Managing Account Control Operations (ACCTCTRL)

The ACCTCTRL program is responsible for managing account control operations. It starts by initializing necessary variables and retrieving the number of accounts associated with a given sort code. The program then displays the output data and ends the process.

The flow begins with the PREMIERE section, which initializes the process and retrieves the number of accounts. Next, the GET-NUMBER-OF-ACCOUNTS-DB2 section executes an SQL query to count the accounts and sets a success flag based on the query result. Finally, the GET-ME-OUT-OF-HERE section ends the program.

Lets' zoom into the flow:


PREMIERE Section

The PREMIERE section initiates the process by moving the SORTCODE to REQUIRED-SORT-CODE, then performs the GET-NUMBER-OF-ACCOUNTS-DB2 section to retrieve the number of accounts associated with the sort code, displays the output data, and finally performs the GET-ME-OUT-OF-HERE section to end the program.

       PREMIERE SECTION.
P010.



MOVE SORTCODE TO
REQUIRED-SORT-CODE.

PERFORM GET-NUMBER-OF-ACCOUNTS-DB2


D DISPLAY 'OUTPUT DATA IS='
D DFHCOMMAREA.


PERFORM GET-ME-OUT-OF-HERE.

P999.
EXIT.


GET-NUMBER-OF-ACCOUNTS-DB2 Section

The GET-NUMBER-OF-ACCOUNTS-DB2 section initializes the DFHCOMMAREA, moves the REQUIRED-SORT-CODE to HV-ACCOUNT-SORTCODE, and executes an SQL query to count the number of accounts with the given sort code. If the SQL query is successful, it sets the ACCOUNT-CONTROL-SUCCESS-FLAG to 'Y' and moves the count to NUMBER-OF-ACCOUNTS. Otherwise, it sets the flag to 'N' and moves the SQLCODE to SQLCODE-DISPLAY.

       GET-NUMBER-OF-ACCOUNTS-DB2 SECTION.
WCD010.

INITIALIZE DFHCOMMAREA.


MOVE REQUIRED-SORT-CODE TO HV-ACCOUNT-SORTCODE

EXEC SQL
SELECT COUNT(*)
INTO :HV-NUMBER-OF-ACCOUNTS
FROM ACCOUNT
WHERE ACCOUNT_SORTCODE = :HV-ACCOUNT-SORTCODE
END-EXEC.

IF SQLCODE = ZERO
MOVE 'Y' TO ACCOUNT-CONTROL-SUCCESS-FLAG
MOVE HV-NUMBER-OF-ACCOUNTS TO NUMBER-OF-ACCOUNTS
ELSE
MOVE 'N' TO ACCOUNT-CONTROL-SUCCESS-FLAG
MOVE SQLCODE TO SQLCODE-DISPLAY


GET-ME-OUT-OF-HERE Section

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

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

EXEC CICS RETURN
END-EXEC.

GMOFH999.
EXIT.

 

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