Post monthly interest to savings accounts

Cobol · COBOL · intermediate · modification

Adds the monthly interest posting step to the INTPOST nightly batch, as specified: savings accounts only, rate applied pro-rata per month, one posting record per account. Ran it against the regression account file and the posting totals line up.

This batch runs nightly over roughly 2 million savings accounts, and POST-FILE feeds the general-ledger posting job that follows it.

Requirements

Files touched

--- src/batch/INTPOST.cbl
            05  WS-READ-COUNT      PIC 9(7) VALUE ZERO.
            05  WS-POST-COUNT      PIC 9(7) VALUE ZERO.
+       01  WS-RATES.
+           05  WS-ANNUAL-RATE     PIC V9(5) VALUE .04250.
+       01  WS-MONTHLY-INT         PIC S9(9)V99 COMP-3.
        PROCEDURE DIVISION.
        100-MAIN.
        200-PROCESS-ACCOUNT.
            ADD 1 TO WS-READ-COUNT.
+           IF ACCT-TYPE = 'S'
+               PERFORM 300-POST-INTEREST
+           END-IF.
+       300-POST-INTEREST.
+           COMPUTE WS-MONTHLY-INT =
+               ACCT-BALANCE * WS-ANNUAL-RATE / 12
+           MOVE ACCT-ID TO POST-ACCT-ID
+           MOVE WS-MONTHLY-INT TO POST-AMOUNT
+           WRITE POST-REC
+           ADD 1 TO WS-POST-COUNT.
 

Review this PR

Cobol practice