Chapter 41 Exercises: Capstone Project -- Building a Complete Banking Application
These exercises extend the Community Bank capstone application. Each exercise adds a new feature, enhances existing functionality, or improves performance. You should have a working capstone project before attempting these exercises, as they build on the existing codebase.
Tier 1: Recall and Recognition (Exercises 1-8)
Exercise 1: Component Identification
The capstone banking application uses multiple technologies. For each component listed below, identify the technology (DB2, VSAM, CICS, JCL, Copybook, Batch COBOL, or Sequential File) that it primarily belongs to:
- a) Customer master record storage with keyed access
- b) BMS map for the account inquiry screen
- c) Overnight interest calculation processing
- d) CAPSTONE-CUSTOMER.CPY
- e) The job stream that orchestrates end-of-day processing
- f) The ACCOUNT table with columns for balance and status
- g) The pseudo-conversational transaction that handles deposits
- h) The transaction input file containing the day's activity
Exercise 2: Copybook Field Mapping
Using the CAPSTONE-ACCOUNT.CPY copybook, answer the following:
- a) What is the PICTURE clause for ACCT-CURRENT-BALANCE?
- b) What are the five possible values for ACCT-STATUS and what does each mean?
- c) What is the alternate key for the account VSAM file and is it unique?
- d) How many bytes is the account record?
- e) What flags are defined under ACCT-FLAGS and what do they control?
Exercise 3: Transaction Type Constants
Refer to CAPSTONE-CONSTANTS.CPY. Write the EVALUATE statement that would decode a transaction type code into a human-readable description for a report line. Cover all seven transaction types defined in WS-TRANSACTION-TYPES.
EVALUATE TXN-TYPE
WHEN ______
MOVE ______ TO WS-TXN-DESC
* ... complete for all seven types
END-EVALUATE
Exercise 4: Return Code Flow
The capstone uses a standard return code scheme: 0 (success), 4 (warning), 8 (error), 12 (severe), 16 (fatal). For each of the following scenarios, state which return code the batch program should set and explain why:
- a) All 50,000 transactions processed successfully
- b) 3 out of 50,000 transactions had invalid account numbers and were written to an error file
- c) The DB2 ACCOUNT table could not be opened at program start
- d) 150 transactions had duplicate transaction IDs; processing continued but a warning report was generated
- e) The VSAM customer file returned a file status of 97 (implicit verify failed)
Exercise 5: JCL Step Identification
A typical end-of-day job stream for the capstone includes these steps. Place them in the correct execution order and explain why each step depends on the previous one:
- Generate customer statements
- Post transactions to account balances
- Sort the daily transaction file by account number
- Calculate and post daily interest
- Produce the general ledger trial balance
- Backup the VSAM files before processing
- Validate the transaction input file
Exercise 6: CICS Communication Area
Examine the WS-COMM-AREA structure in CAPSTONE-CONSTANTS.CPY. Answer the following:
- a) What is the purpose of COMM-FUNCTION and how many functions does it support?
- b) Why does the communication area include both COMM-ACCT-NUMBER and COMM-TARGET-ACCT?
- c) What field would carry the error message back to the calling program?
- d) Why is COMM-AMOUNT defined as PIC S9(11)V99 COMP-3 rather than a display numeric?
Exercise 7: Fee Schedule Application
Using the WS-FEE-SCHEDULE from the constants copybook, write the COBOL statements that would apply the correct fee for each of the following customer actions:
- a) Monthly maintenance fee for a checking account
- b) An overdraft on a checking account
- c) A domestic wire transfer
- d) An international wire transfer
- e) Closing an account within 90 days of opening
Exercise 8: Data Architecture Tracing
Trace the data flow for a single deposit transaction from entry to final posting. Identify every file or table the data touches and what operation (read, write, update) occurs at each step. Use the following components: transaction input file, VSAM account file, DB2 ACCOUNT table, transaction history VSAM, general ledger journal entry file.
Solutions for Exercises 1-8:
Exercise 1 Solution: - a) VSAM (KSDS for keyed access to customer records) - b) CICS (BMS maps define screen layouts for online transactions) - c) Batch COBOL (overnight interest runs as a batch program) - d) Copybook (shared data definition included via COPY statement) - e) JCL (job control language orchestrates batch step execution) - f) DB2 (relational database table for account data) - g) CICS (pseudo-conversational transaction program) - h) Sequential File (daily transactions arrive as sequential input)
Exercise 2 Solution: - a) PIC S9(11)V99 COMP-3 (signed packed decimal, 11 integer digits, 2 decimal) - b) 'A' = Active, 'C' = Closed, 'F' = Frozen, 'D' = Dormant, 'P' = Pending - c) ACCT-CUST-NUMBER at positions 11-20, non-unique (one customer can have multiple accounts) - d) 400 bytes (as stated in the copybook header) - e) Six flags: ACCT-FLAG-NO-ATM (blocks ATM access), ACCT-FLAG-NO-OD (overdraft opt-out), ACCT-FLAG-ESCHEAT (escheatment flag), ACCT-FLAG-GARNISH (garnishment hold), ACCT-FLAG-1099 (1099 exemption), ACCT-FLAG-STMT (statement delivery preference: E=electronic, P=paper, B=both)
Exercise 3 Solution:
EVALUATE TXN-TYPE
WHEN 'DP'
MOVE 'Deposit ' TO WS-TXN-DESC
WHEN 'WD'
MOVE 'Withdrawal ' TO WS-TXN-DESC
WHEN 'XF'
MOVE 'Transfer ' TO WS-TXN-DESC
WHEN 'IN'
MOVE 'Interest ' TO WS-TXN-DESC
WHEN 'FE'
MOVE 'Fee/Charge ' TO WS-TXN-DESC
WHEN 'AJ'
MOVE 'Adjustment ' TO WS-TXN-DESC
WHEN 'RV'
MOVE 'Reversal ' TO WS-TXN-DESC
WHEN OTHER
MOVE 'Unknown ' TO WS-TXN-DESC
END-EVALUATE
Exercise 4 Solution: - a) RC = 0. All records processed without errors. - b) RC = 4. A small number of records failed but the program completed and wrote them to an error file. This is a warning condition. - c) RC = 16. Inability to open a critical resource is fatal; the program cannot continue. - d) RC = 4. Duplicates are a data quality issue but processing completed. Warning is appropriate. - e) RC = 12 or 16. File status 97 means the VSAM file is damaged. This is severe; the file should not be processed without repair.
Exercise 5 Solution: Correct order: 6, 7, 3, 2, 4, 1, 5. Reasoning: 1. (Step 6) Backup VSAM files first so recovery is possible if later steps fail. 2. (Step 7) Validate the transaction file to catch errors before processing begins. 3. (Step 3) Sort transactions by account number for efficient sequential processing. 4. (Step 2) Post transactions to update account balances. 5. (Step 4) Calculate interest on the updated balances (must happen after posting). 6. (Step 1) Generate statements reflecting all posted transactions and interest. 7. (Step 5) Produce the trial balance after all postings are complete to verify debits equal credits.
Exercise 6 Solution: - a) COMM-FUNCTION is a 4-byte field with 11 defined 88-level conditions: OPEN, CLOS, MODI, DEPT, WITH, XFER, INQR, HIST, INTR, STMT, REPT. - b) COMM-TARGET-ACCT is needed for transfer operations (TXN-TYPE-TRANSFER) where money moves from one account to another. COMM-ACCT-NUMBER is the source account. - c) COMM-ERROR-MSG (PIC X(80)). - d) COMP-3 is used because financial amounts must be stored in packed decimal to avoid binary-to-decimal conversion rounding errors, and COMP-3 is more storage-efficient than display numeric for large amounts.
Exercise 7 Solution:
* a) Monthly maintenance fee
ADD FEE-MONTHLY-CHK TO WS-FEE-TOTAL
* b) Overdraft fee
ADD FEE-OVERDRAFT TO WS-FEE-TOTAL
* c) Domestic wire transfer
ADD FEE-WIRE-DOMESTIC TO WS-FEE-TOTAL
* d) International wire transfer
ADD FEE-WIRE-INTL TO WS-FEE-TOTAL
* e) Early account closure
ADD FEE-EARLY-CLOSE TO WS-FEE-TOTAL
Exercise 8 Solution: 1. Transaction input file: READ the deposit record. 2. VSAM account file: READ the account record to verify account exists and is active. 3. VSAM account file: REWRITE the account record with updated ACCT-CURRENT-BALANCE, ACCT-AVAILABLE-BALANCE, ACCT-MTD-DEPOSITS, ACCT-YTD-DEPOSITS, ACCT-MTD-TXN-COUNT, ACCT-LAST-TXN-DATE. 4. DB2 ACCOUNT table: UPDATE the corresponding DB2 row to keep it synchronized with VSAM. 5. Transaction history VSAM: WRITE a new history record with the deposit details, balance before, and balance after. 6. General ledger journal entry file: WRITE a debit entry (cash/bank) and a credit entry (customer deposit liability) to maintain double-entry bookkeeping.
Tier 2: Comprehension and Explanation (Exercises 9-16)
Exercise 9: Add a Wire Transfer Transaction Type
Extend the capstone to support wire transfers as a new transaction type. Wire transfers require: - A routing number (9 digits) and beneficiary account number (up to 17 digits) - Different fee amounts for domestic vs. international (already defined in the fee schedule) - A separate wire transfer log file for regulatory compliance
Write the copybook additions for the wire transfer record, the validation paragraph that checks the routing number using the ABA check-digit algorithm, and the fee posting logic.
*================================================================*
* CAPSTONE-WIRE-TRANSFER.CPY *
* Wire Transfer Extension Record Layout *
*================================================================*
* Complete this copybook with appropriate fields for:
* - Wire type (domestic/international)
* - Originator information
* - Beneficiary information
* - Intermediary bank (for international)
* - Regulatory fields (OFAC check flag, BSA flag)
Exercise 10: Overdraft Protection Processing
Implement overdraft protection logic for the capstone. When a withdrawal would bring ACCT-CURRENT-BALANCE below zero: 1. Check if ACCT-OVERDRAFT-LINKED contains a valid savings account number 2. If so, transfer enough funds from the linked savings account to cover the shortfall 3. Post the transfer as a separate transaction with type 'XF' 4. If the savings account has insufficient funds, transfer what is available and reject the remaining amount 5. If no linked account exists and ACCT-OD-OPTOUT is not set, allow the overdraft up to ACCT-OVERDRAFT-LIMIT and charge FEE-OVERDRAFT
Write the complete PERFORM paragraph for this logic.
Solution:
3500-PROCESS-OVERDRAFT.
* Calculate the shortfall amount
COMPUTE WS-SHORTFALL =
WS-TXN-AMOUNT - ACCT-CURRENT-BALANCE
IF ACCT-OVERDRAFT-LINKED NOT = SPACES
* Attempt linked account transfer
MOVE ACCT-OVERDRAFT-LINKED
TO WS-LINKED-ACCT-NUM
PERFORM 3510-READ-LINKED-ACCOUNT
IF WS-LINKED-ACCT-FOUND
IF LINKED-ACCT-BALANCE >= WS-SHORTFALL
* Full coverage from linked account
MOVE WS-SHORTFALL TO WS-TRANSFER-AMT
PERFORM 3520-POST-LINKED-TRANSFER
MOVE 'Y' TO WS-OD-COVERED-SW
ELSE
* Partial coverage
MOVE LINKED-ACCT-BALANCE
TO WS-TRANSFER-AMT
PERFORM 3520-POST-LINKED-TRANSFER
COMPUTE WS-REMAINING-SHORTFALL =
WS-SHORTFALL - WS-TRANSFER-AMT
PERFORM 3530-CHECK-OD-LIMIT
END-IF
ELSE
PERFORM 3530-CHECK-OD-LIMIT
END-IF
ELSE
PERFORM 3530-CHECK-OD-LIMIT
END-IF
.
3510-READ-LINKED-ACCOUNT.
MOVE WS-LINKED-ACCT-NUM TO ACCT-NUMBER
READ ACCOUNT-FILE INTO LINKED-ACCOUNT-RECORD
INVALID KEY
MOVE 'N' TO WS-LINKED-ACCT-FOUND-SW
NOT INVALID KEY
MOVE 'Y' TO WS-LINKED-ACCT-FOUND-SW
MOVE ACCT-CURRENT-BALANCE
TO LINKED-ACCT-BALANCE
END-READ
.
3520-POST-LINKED-TRANSFER.
* Debit the linked savings account
SUBTRACT WS-TRANSFER-AMT
FROM LINKED-ACCT-BALANCE
MOVE LINKED-ACCT-BALANCE
TO ACCT-CURRENT-BALANCE
REWRITE ACCOUNT-RECORD
* Credit the checking account
ADD WS-TRANSFER-AMT
TO WS-CHECKING-BALANCE
* Post transfer transaction for audit trail
MOVE TXN-TYPE-TRANSFER TO WS-AUTO-TXN-TYPE
MOVE WS-TRANSFER-AMT TO WS-AUTO-TXN-AMOUNT
PERFORM 3525-WRITE-AUTO-TRANSFER-TXN
.
3530-CHECK-OD-LIMIT.
IF ACCT-OD-OPTOUT
MOVE 'R' TO TXN-STATUS
MOVE 'NSFI' TO TXN-REASON-CODE
ADD 1 TO CTR-RECORDS-REJECTED
ELSE
IF WS-REMAINING-SHORTFALL <=
ACCT-OVERDRAFT-LIMIT
* Allow overdraft and charge fee
SUBTRACT WS-REMAINING-SHORTFALL
FROM ACCT-CURRENT-BALANCE
ADD FEE-OVERDRAFT
TO WS-FEE-TOTAL
PERFORM 3535-POST-OD-FEE
MOVE 'T' TO TXN-STATUS
ELSE
MOVE 'R' TO TXN-STATUS
MOVE 'ODEX' TO TXN-REASON-CODE
ADD 1 TO CTR-RECORDS-REJECTED
END-IF
END-IF
.
Exercise 11: Monthly Statement Generation Enhancement
The capstone generates basic monthly statements. Enhance the statement program to include: - A running balance column on each transaction line - Year-to-date interest earned and fees charged in the summary section - Average daily balance for the statement period - A message line that varies based on account type and balance tier
Write the calculation paragraph for average daily balance and the report formatting paragraph for the enhanced summary section.
Solution:
4100-CALC-AVERAGE-DAILY-BALANCE.
* Calculate average daily balance for the period
* Sum of each day's ending balance / number of days
MOVE ZERO TO WS-DAILY-BAL-SUM
MOVE ZERO TO WS-DAY-COUNT
MOVE ACCT-OPENING-BALANCE TO WS-RUNNING-BALANCE
PERFORM VARYING WS-STMT-DAY
FROM 1 BY 1
UNTIL WS-STMT-DAY > WS-DAYS-IN-PERIOD
* Add transactions for this day
PERFORM 4110-ADD-DAYS-TRANSACTIONS
* Accumulate the daily ending balance
ADD WS-RUNNING-BALANCE TO WS-DAILY-BAL-SUM
ADD 1 TO WS-DAY-COUNT
END-PERFORM
IF WS-DAY-COUNT > ZERO
COMPUTE WS-AVG-DAILY-BALANCE ROUNDED =
WS-DAILY-BAL-SUM / WS-DAY-COUNT
ELSE
MOVE ZERO TO WS-AVG-DAILY-BALANCE
END-IF
.
4200-FORMAT-ENHANCED-SUMMARY.
MOVE WS-AVG-DAILY-BALANCE TO RPT-AVG-BAL
MOVE ACCT-YTD-INTEREST TO RPT-YTD-INTEREST
MOVE ACCT-YTD-FEES TO RPT-YTD-FEES
MOVE ACCT-MTD-DEPOSITS TO RPT-MTD-DEPOSITS
MOVE ACCT-MTD-WITHDRAWALS TO RPT-MTD-WITHDRAWALS
* Determine tier message
EVALUATE TRUE
WHEN WS-AVG-DAILY-BALANCE >= 100000.00
MOVE 'Premium Banking: You qualify for '
& 'our highest rewards tier.'
TO RPT-TIER-MESSAGE
WHEN WS-AVG-DAILY-BALANCE >= 25000.00
MOVE 'Preferred Client: Enjoy reduced '
& 'fees and bonus rate.'
TO RPT-TIER-MESSAGE
WHEN WS-AVG-DAILY-BALANCE >= 5000.00
MOVE 'Standard Banking: Maintain $25,0'
& '00 for Preferred status.'
TO RPT-TIER-MESSAGE
WHEN OTHER
MOVE 'Basic Banking: Build your balanc'
& 'e to unlock benefits.'
TO RPT-TIER-MESSAGE
END-EVALUATE
WRITE RPT-RECORD FROM WS-SUMMARY-HEADER
AFTER ADVANCING 2 LINES
WRITE RPT-RECORD FROM WS-SUMMARY-LINE-1
AFTER ADVANCING 1 LINE
WRITE RPT-RECORD FROM WS-SUMMARY-LINE-2
AFTER ADVANCING 1 LINE
WRITE RPT-RECORD FROM WS-TIER-MESSAGE-LINE
AFTER ADVANCING 2 LINES
.
Exercise 12: Branch Code Validation Subroutine
Create a reusable subprogram (called via CALL) that validates a branch code against a DB2 reference table. The subprogram should: - Accept a branch code and return a status flag plus the branch name and region - Cache the last 50 lookups in a working-storage table to reduce DB2 calls - Handle DB2 errors gracefully and return appropriate reason codes
Write the complete subprogram including the LINKAGE SECTION and the cache lookup logic.
Solution:
IDENTIFICATION DIVISION.
PROGRAM-ID. CAPBRNCH.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-CACHE-TABLE.
05 WS-CACHE-COUNT PIC 9(02) VALUE ZERO.
05 WS-CACHE-MAX PIC 9(02) VALUE 50.
05 WS-CACHE-NEXT PIC 9(02) VALUE 1.
05 WS-CACHE-ENTRY OCCURS 50 TIMES.
10 WS-CACHE-BRANCH PIC X(04).
10 WS-CACHE-NAME PIC X(30).
10 WS-CACHE-REGION PIC X(04).
10 WS-CACHE-VALID PIC X(01).
01 WS-CACHE-IDX PIC 9(02).
01 WS-FOUND-IN-CACHE PIC X(01) VALUE 'N'.
88 CACHE-HIT VALUE 'Y'.
88 CACHE-MISS VALUE 'N'.
EXEC SQL INCLUDE SQLCA END-EXEC.
01 HV-BRANCH-CODE PIC X(04).
01 HV-BRANCH-NAME PIC X(30).
01 HV-BRANCH-REGION PIC X(04).
LINKAGE SECTION.
01 LS-BRANCH-CODE PIC X(04).
01 LS-RETURN-STATUS PIC X(01).
88 LS-BRANCH-VALID VALUE 'V'.
88 LS-BRANCH-INVALID VALUE 'I'.
88 LS-BRANCH-DB2-ERROR VALUE 'E'.
01 LS-BRANCH-NAME PIC X(30).
01 LS-BRANCH-REGION PIC X(04).
01 LS-REASON-CODE PIC S9(04) COMP.
PROCEDURE DIVISION USING LS-BRANCH-CODE
LS-RETURN-STATUS
LS-BRANCH-NAME
LS-BRANCH-REGION
LS-REASON-CODE.
0000-MAIN.
MOVE ZERO TO LS-REASON-CODE
PERFORM 1000-SEARCH-CACHE
IF CACHE-MISS
PERFORM 2000-LOOKUP-DB2
END-IF
GOBACK.
1000-SEARCH-CACHE.
SET CACHE-MISS TO TRUE
PERFORM VARYING WS-CACHE-IDX
FROM 1 BY 1
UNTIL WS-CACHE-IDX > WS-CACHE-COUNT
OR CACHE-HIT
IF WS-CACHE-BRANCH(WS-CACHE-IDX)
= LS-BRANCH-CODE
SET CACHE-HIT TO TRUE
IF WS-CACHE-VALID(WS-CACHE-IDX) = 'Y'
SET LS-BRANCH-VALID TO TRUE
MOVE WS-CACHE-NAME(WS-CACHE-IDX)
TO LS-BRANCH-NAME
MOVE WS-CACHE-REGION(WS-CACHE-IDX)
TO LS-BRANCH-REGION
ELSE
SET LS-BRANCH-INVALID TO TRUE
END-IF
END-IF
END-PERFORM
.
2000-LOOKUP-DB2.
MOVE LS-BRANCH-CODE TO HV-BRANCH-CODE
EXEC SQL
SELECT BRANCH_NAME, REGION_CODE
INTO :HV-BRANCH-NAME, :HV-BRANCH-REGION
FROM BRANCH_MASTER
WHERE BRANCH_CODE = :HV-BRANCH-CODE
END-EXEC
EVALUATE SQLCODE
WHEN 0
SET LS-BRANCH-VALID TO TRUE
MOVE HV-BRANCH-NAME TO LS-BRANCH-NAME
MOVE HV-BRANCH-REGION TO LS-BRANCH-REGION
PERFORM 2100-ADD-TO-CACHE-VALID
WHEN +100
SET LS-BRANCH-INVALID TO TRUE
PERFORM 2200-ADD-TO-CACHE-INVALID
WHEN OTHER
SET LS-BRANCH-DB2-ERROR TO TRUE
MOVE SQLCODE TO LS-REASON-CODE
END-EVALUATE
.
2100-ADD-TO-CACHE-VALID.
MOVE LS-BRANCH-CODE TO
WS-CACHE-BRANCH(WS-CACHE-NEXT)
MOVE HV-BRANCH-NAME TO
WS-CACHE-NAME(WS-CACHE-NEXT)
MOVE HV-BRANCH-REGION TO
WS-CACHE-REGION(WS-CACHE-NEXT)
MOVE 'Y' TO WS-CACHE-VALID(WS-CACHE-NEXT)
PERFORM 2300-ADVANCE-CACHE-POINTER
.
2200-ADD-TO-CACHE-INVALID.
MOVE LS-BRANCH-CODE TO
WS-CACHE-BRANCH(WS-CACHE-NEXT)
MOVE SPACES TO WS-CACHE-NAME(WS-CACHE-NEXT)
MOVE SPACES TO WS-CACHE-REGION(WS-CACHE-NEXT)
MOVE 'N' TO WS-CACHE-VALID(WS-CACHE-NEXT)
PERFORM 2300-ADVANCE-CACHE-POINTER
.
2300-ADVANCE-CACHE-POINTER.
IF WS-CACHE-COUNT < WS-CACHE-MAX
ADD 1 TO WS-CACHE-COUNT
END-IF
ADD 1 TO WS-CACHE-NEXT
IF WS-CACHE-NEXT > WS-CACHE-MAX
MOVE 1 TO WS-CACHE-NEXT
END-IF
.
Exercise 13: Dormant Account Detection
Write a batch program that scans all accounts and flags those with no activity for 365 days or more as dormant. The program should: - Read the VSAM account file sequentially - Compare ACCT-LAST-TXN-DATE to the current date - Update ACCT-STATUS to 'D' (dormant) for qualifying accounts - Generate a report listing all newly dormant accounts with their last activity date and balance - Post a general ledger entry reclassifying dormant balances
Write the main processing loop and the date comparison logic.
Exercise 14: End-of-Month Interest Accrual
The capstone calculates daily interest. Write the end-of-month processing paragraph that: - Reads each account's ACCT-ACCRUED-INTEREST field - Rounds the accrued interest to the nearest cent using ROUNDED - Posts the interest as a transaction of type 'IN' - Resets ACCT-ACCRUED-INTEREST to zero - Updates ACCT-MTD-INTEREST and ACCT-YTD-INTEREST - Generates a 1099-INT extract record for accounts exceeding the IRS threshold ($10)
Write the complete processing paragraph and the 1099 extract record layout.
Exercise 15: Transaction Reversal Processing
Implement a transaction reversal feature. Given a transaction ID, the reversal program should: - Look up the original transaction in the history VSAM file - Verify the original transaction was posted (status 'T') - Create a reversal transaction with the opposite sign amount - Update the account balance to reflect the reversal - Link the reversal to the original via TXN-REVERSAL-ID - Update the original transaction status to 'V' (reversed)
Write the complete reversal processing logic including all validation checks.
Exercise 16: Currency Rounding Validation
Financial systems must handle rounding consistently. Write a test program that verifies the capstone's interest calculation produces correct results. The program should: - Define 10 test cases with known balances, rates, and expected daily interest amounts - Compute interest using the same formula as the capstone - Compare computed results to expected results - Report any discrepancies showing the balance, rate, expected amount, computed amount, and difference
Solution:
IDENTIFICATION DIVISION.
PROGRAM-ID. CAPRNDTST.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TEST-CASES.
05 WS-TC-COUNT PIC 9(02) VALUE 10.
05 WS-TC-ENTRY OCCURS 10 TIMES.
10 WS-TC-BALANCE PIC S9(11)V99 COMP-3.
10 WS-TC-RATE PIC 9V9(6).
10 WS-TC-EXPECTED PIC S9(9)V99 COMP-3.
10 WS-TC-COMPUTED PIC S9(9)V99 COMP-3.
10 WS-TC-PASS PIC X(01).
01 WS-IDX PIC 9(02).
01 WS-DAILY-RATE PIC 9V9(10).
01 WS-PASS-COUNT PIC 9(02) VALUE ZERO.
01 WS-FAIL-COUNT PIC 9(02) VALUE ZERO.
PROCEDURE DIVISION.
0000-MAIN.
PERFORM 1000-LOAD-TEST-CASES
PERFORM 2000-RUN-TESTS
PERFORM 3000-REPORT-RESULTS
STOP RUN.
1000-LOAD-TEST-CASES.
* TC1: Simple savings at 2.5%
MOVE 10000.00 TO WS-TC-BALANCE(1)
MOVE 0.025000 TO WS-TC-RATE(1)
MOVE 0.68 TO WS-TC-EXPECTED(1)
* TC2: Checking at 1% - small balance
MOVE 250.50 TO WS-TC-BALANCE(2)
MOVE 0.010000 TO WS-TC-RATE(2)
MOVE 0.01 TO WS-TC-EXPECTED(2)
* TC3: Money market at 4%
MOVE 50000.00 TO WS-TC-BALANCE(3)
MOVE 0.040000 TO WS-TC-RATE(3)
MOVE 5.48 TO WS-TC-EXPECTED(3)
* TC4: Large CD at 5.25%
MOVE 250000.00 TO WS-TC-BALANCE(4)
MOVE 0.052500 TO WS-TC-RATE(4)
MOVE 35.96 TO WS-TC-EXPECTED(4)
* TC5: Zero balance
MOVE 0.00 TO WS-TC-BALANCE(5)
MOVE 0.025000 TO WS-TC-RATE(5)
MOVE 0.00 TO WS-TC-EXPECTED(5)
* TC6: One penny
MOVE 0.01 TO WS-TC-BALANCE(6)
MOVE 0.050000 TO WS-TC-RATE(6)
MOVE 0.00 TO WS-TC-EXPECTED(6)
* TC7: Rounding boundary
MOVE 7300.00 TO WS-TC-BALANCE(7)
MOVE 0.025000 TO WS-TC-RATE(7)
MOVE 0.50 TO WS-TC-EXPECTED(7)
* TC8: Negative balance (overdraft)
MOVE -500.00 TO WS-TC-BALANCE(8)
MOVE 0.010000 TO WS-TC-RATE(8)
MOVE 0.00 TO WS-TC-EXPECTED(8)
* TC9: Maximum balance scenario
MOVE 99999999.99 TO WS-TC-BALANCE(9)
MOVE 0.052500 TO WS-TC-RATE(9)
MOVE 14383.56 TO WS-TC-EXPECTED(9)
* TC10: Half-cent rounding
MOVE 3650.00 TO WS-TC-BALANCE(10)
MOVE 0.050000 TO WS-TC-RATE(10)
MOVE 0.50 TO WS-TC-EXPECTED(10)
.
2000-RUN-TESTS.
PERFORM VARYING WS-IDX FROM 1 BY 1
UNTIL WS-IDX > WS-TC-COUNT
* Daily interest = balance * rate / 365
IF WS-TC-BALANCE(WS-IDX) > ZERO
COMPUTE WS-TC-COMPUTED(WS-IDX) ROUNDED =
WS-TC-BALANCE(WS-IDX) *
WS-TC-RATE(WS-IDX) / 365
ELSE
MOVE ZERO TO WS-TC-COMPUTED(WS-IDX)
END-IF
IF WS-TC-COMPUTED(WS-IDX) =
WS-TC-EXPECTED(WS-IDX)
MOVE 'P' TO WS-TC-PASS(WS-IDX)
ADD 1 TO WS-PASS-COUNT
ELSE
MOVE 'F' TO WS-TC-PASS(WS-IDX)
ADD 1 TO WS-FAIL-COUNT
END-IF
END-PERFORM
.
3000-REPORT-RESULTS.
DISPLAY '=== INTEREST ROUNDING TEST RESULTS ==='
DISPLAY 'TEST BALANCE RATE '
'EXPECTED COMPUTED RESULT'
DISPLAY '---- ------------- ------- '
'-------- -------- ------'
PERFORM VARYING WS-IDX FROM 1 BY 1
UNTIL WS-IDX > WS-TC-COUNT
DISPLAY WS-IDX ' '
WS-TC-BALANCE(WS-IDX) ' '
WS-TC-RATE(WS-IDX) ' '
WS-TC-EXPECTED(WS-IDX) ' '
WS-TC-COMPUTED(WS-IDX) ' '
WS-TC-PASS(WS-IDX)
END-PERFORM
DISPLAY '======================================'
DISPLAY 'PASSED: ' WS-PASS-COUNT
' FAILED: ' WS-FAIL-COUNT
.
Tier 3: Application and Implementation (Exercises 17-24)
Exercise 17: Add a Certificate of Deposit (CD) Maturity Processor
Write a batch program that processes CD maturity events. On the maturity date: - Calculate final interest and add it to the CD balance - If the customer has elected auto-renewal, open a new CD at the current rate - If no auto-renewal, transfer the full amount (principal plus interest) to the customer's default checking or savings account - Generate a maturity notice record for the statement system - Post the appropriate general ledger entries
Write the complete batch program including JCL.
Solution:
IDENTIFICATION DIVISION.
PROGRAM-ID. CAPCDMAT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ACCT-FILE
ASSIGN TO ACCTFILE
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ACCT-NUMBER
FILE STATUS IS WS-ACCT-STATUS.
SELECT MATURITY-RPT
ASSIGN TO MATRPT
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS WS-RPT-STATUS.
SELECT GL-JOURNAL
ASSIGN TO GLJRNL
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS WS-GL-STATUS.
DATA DIVISION.
FILE SECTION.
FD ACCT-FILE
RECORD CONTAINS 400 CHARACTERS.
COPY CAPSTONE-ACCOUNT.
FD MATURITY-RPT
RECORD CONTAINS 132 CHARACTERS.
01 RPT-RECORD PIC X(132).
FD GL-JOURNAL
RECORD CONTAINS 200 CHARACTERS.
01 GL-RECORD PIC X(200).
WORKING-STORAGE SECTION.
COPY CAPSTONE-CONSTANTS.
01 WS-FILE-STATS.
05 WS-ACCT-STATUS PIC X(02).
05 WS-RPT-STATUS PIC X(02).
05 WS-GL-STATUS PIC X(02).
01 WS-PROCESS-DATE PIC X(10).
01 WS-FINAL-INTEREST PIC S9(9)V99 COMP-3.
01 WS-MATURED-BALANCE PIC S9(11)V99 COMP-3.
01 WS-EOF-SW PIC X(01) VALUE 'N'.
88 END-OF-FILE VALUE 'Y'.
01 WS-MATURITY-COUNT PIC 9(05) VALUE ZERO.
01 WS-RENEWAL-COUNT PIC 9(05) VALUE ZERO.
01 WS-TRANSFER-COUNT PIC 9(05) VALUE ZERO.
PROCEDURE DIVISION.
0000-MAIN.
PERFORM 1000-INITIALIZE
PERFORM 2000-PROCESS-ACCOUNTS
UNTIL END-OF-FILE
PERFORM 9000-TERMINATE
STOP RUN.
1000-INITIALIZE.
ACCEPT WS-PROCESS-DATE FROM DATE YYYYMMDD
OPEN I-O ACCT-FILE
OPEN OUTPUT MATURITY-RPT GL-JOURNAL
READ ACCT-FILE NEXT RECORD
AT END SET END-OF-FILE TO TRUE
END-READ
.
2000-PROCESS-ACCOUNTS.
IF ACCT-IS-CD AND ACCT-IS-ACTIVE
IF ACCT-CD-MATURITY-DATE = WS-PROCESS-DATE
PERFORM 2100-PROCESS-MATURITY
END-IF
END-IF
READ ACCT-FILE NEXT RECORD
AT END SET END-OF-FILE TO TRUE
END-READ
.
2100-PROCESS-MATURITY.
ADD 1 TO WS-MATURITY-COUNT
* Calculate final interest
COMPUTE WS-FINAL-INTEREST ROUNDED =
ACCT-CD-ORIGINAL-AMT *
ACCT-INTEREST-RATE /
12 * ACCT-CD-TERM-MONTHS
- ACCT-YTD-INTEREST
COMPUTE WS-MATURED-BALANCE =
ACCT-CURRENT-BALANCE + WS-FINAL-INTEREST
* Check for auto-renewal product code
IF ACCT-PRODUCT-CODE(1:2) = 'AR'
PERFORM 2200-AUTO-RENEW
ELSE
PERFORM 2300-TRANSFER-TO-DEFAULT
END-IF
PERFORM 2400-WRITE-MATURITY-NOTICE
PERFORM 2500-POST-GL-ENTRIES
.
2200-AUTO-RENEW.
ADD 1 TO WS-RENEWAL-COUNT
* Reset CD with new maturity date
MOVE WS-MATURED-BALANCE
TO ACCT-CURRENT-BALANCE
MOVE WS-MATURED-BALANCE
TO ACCT-CD-ORIGINAL-AMT
MOVE WS-MATURED-BALANCE
TO ACCT-AVAILABLE-BALANCE
* Advance maturity by term months
PERFORM 2210-CALC-NEW-MATURITY
MOVE ZERO TO ACCT-YTD-INTEREST
MOVE ZERO TO ACCT-MTD-INTEREST
MOVE ZERO TO ACCT-ACCRUED-INTEREST
MOVE WS-PROCESS-DATE TO ACCT-LAST-TXN-DATE
REWRITE ACCOUNT-RECORD
.
2210-CALC-NEW-MATURITY.
* Add ACCT-CD-TERM-MONTHS to the process date
* for the new maturity date
CONTINUE
.
2300-TRANSFER-TO-DEFAULT.
ADD 1 TO WS-TRANSFER-COUNT
* Close the CD account
MOVE 'C' TO ACCT-STATUS
MOVE WS-PROCESS-DATE TO ACCT-CLOSE-DATE
MOVE ZERO TO ACCT-CURRENT-BALANCE
MOVE ZERO TO ACCT-AVAILABLE-BALANCE
REWRITE ACCOUNT-RECORD
* Credit the customer default account
* (would need customer lookup for default acct)
.
2400-WRITE-MATURITY-NOTICE.
INITIALIZE RPT-RECORD
STRING 'CD MATURITY: ACCT=' DELIMITED SIZE
ACCT-NUMBER DELIMITED SIZE
' BAL=' DELIMITED SIZE
WS-MATURED-BALANCE DELIMITED SIZE
INTO RPT-RECORD
WRITE RPT-RECORD
.
2500-POST-GL-ENTRIES.
* Debit: CD liability account
* Credit: Interest expense (for accrued interest)
* Debit/Credit: Transfer accounts if applicable
CONTINUE
.
9000-TERMINATE.
DISPLAY 'CDS MATURED: ' WS-MATURITY-COUNT
DISPLAY 'AUTO-RENEWED: ' WS-RENEWAL-COUNT
DISPLAY 'TRANSFERRED: ' WS-TRANSFER-COUNT
CLOSE ACCT-FILE MATURITY-RPT GL-JOURNAL
.
Exercise 18: CICS Account History Screen
Design and implement a CICS BMS map and corresponding program for an account transaction history inquiry. The screen should: - Accept an account number and date range - Display the last 20 transactions in reverse chronological order - Support forward and backward paging through the history - Show running balance for each transaction line - Allow drill-down into a specific transaction by entering a line selection
Write the BMS map definition and the pseudo-conversational CICS program.
Exercise 19: Daily Reconciliation Report
Write a batch program that produces a daily reconciliation report comparing: - Sum of all account balances in VSAM vs. sum in DB2 - Total debits posted vs. total credits posted - Opening balance + credits - debits = closing balance for each account - General ledger trial balance (total debits must equal total credits)
The report should flag any discrepancies with severity levels: INFO (within $0.01 rounding tolerance), WARNING (within $1.00), ERROR (greater than $1.00).
Exercise 20: Customer Relationship Summary
Write a CICS program that displays a complete customer relationship view on a single screen. Given a customer number, the program should: - Display customer demographic information from the VSAM customer file - List all accounts with current balances (from DB2) - Show the total relationship value (sum of all deposit balances minus loan balances) - Display the customer's risk rating and CIF score - Show the last activity date across all accounts
Write the DB2 cursor declaration, the CICS program logic, and the BMS map definition.
Exercise 21: Batch Transaction Posting with Checkpoint/Restart
Enhance the transaction posting batch program with checkpoint/restart capability. The program should: - Commit to DB2 every 500 transactions - Write a checkpoint record to a sequential file with the last transaction ID processed and running totals - On restart, read the last checkpoint and resume from the next unprocessed transaction - Handle the case where a restart occurs mid-commit
Write the checkpoint and restart logic paragraphs.
Exercise 22: JSON API Response Builder
Write a COBOL program that builds a JSON response for an account inquiry API. Given an account number, the program should produce a JSON document containing: - Account details (number, type, status, balances) - The last 5 transactions - Customer name and contact information
Use the JSON GENERATE statement and handle the case where optional fields may be empty.
Exercise 23: Performance-Optimized Interest Calculation
The standard interest calculation processes accounts sequentially. Write an optimized version that: - Uses a DB2 cursor with FOR FETCH ONLY and OPTIMIZE FOR 1000 ROWS - Processes accounts in blocks of 1000 using multi-row FETCH - Minimizes I/O by batching VSAM updates - Commits DB2 changes in groups rather than per-account - Reports processing rate (accounts per second) at regular intervals
Write the key paragraphs showing the multi-row fetch and batched update logic.
Exercise 24: Regulatory Report Generator (CTR)
Write a batch program that generates Currency Transaction Reports (CTRs) as required by the Bank Secrecy Act. The program should: - Scan the daily transaction file for cash transactions at or above $10,000 - Also detect structuring: multiple cash transactions by the same customer totaling $10,000 or more in a single day - Generate a CTR extract file with all required FinCEN fields - Produce a management summary report showing the number of CTRs filed and the total dollar amounts
Write the structuring detection logic and the CTR record layout.
Solution:
IDENTIFICATION DIVISION.
PROGRAM-ID. CAPCTR.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY CAPSTONE-CONSTANTS.
COPY CAPSTONE-TRANSACTION.
01 WS-CTR-THRESHOLD PIC S9(9)V99 COMP-3
VALUE +10000.00.
01 WS-STRUCTURING-THRESHOLD PIC S9(9)V99 COMP-3
VALUE +10000.00.
* Customer daily cash accumulator table
* Tracks cash total per customer for structuring
01 WS-CUST-CASH-TABLE.
05 WS-CCT-COUNT PIC 9(05) VALUE ZERO.
05 WS-CCT-ENTRY OCCURS 5000 TIMES
ASCENDING KEY IS WS-CCT-CUST-NUM
INDEXED BY WS-CCT-IDX.
10 WS-CCT-CUST-NUM PIC X(10).
10 WS-CCT-DAILY-CASH PIC S9(11)V99 COMP-3.
10 WS-CCT-TXN-COUNT PIC 9(03).
10 WS-CCT-FLAGGED PIC X(01).
88 CCT-ALREADY-FLAGGED VALUE 'Y'.
01 WS-SINGLE-CTR-COUNT PIC 9(05) VALUE ZERO.
01 WS-STRUCT-CTR-COUNT PIC 9(05) VALUE ZERO.
01 WS-TOTAL-CTR-AMOUNT PIC S9(13)V99 COMP-3
VALUE ZERO.
01 WS-CTR-RECORD.
05 CTR-FILING-TYPE PIC X(01).
88 CTR-SINGLE-TXN VALUE 'S'.
88 CTR-STRUCTURING VALUE 'M'.
05 CTR-CUST-NUMBER PIC X(10).
05 CTR-CUST-NAME PIC X(50).
05 CTR-CUST-SSN PIC X(09).
05 CTR-CUST-DOB PIC X(10).
05 CTR-CUST-ADDRESS PIC X(80).
05 CTR-ACCT-NUMBER PIC X(10).
05 CTR-TXN-DATE PIC X(10).
05 CTR-TXN-AMOUNT PIC S9(11)V99 COMP-3.
05 CTR-TOTAL-CASH-AMT PIC S9(11)V99 COMP-3.
05 CTR-TXN-COUNT PIC 9(03).
05 CTR-CHANNEL PIC X(02).
05 CTR-BRANCH-CODE PIC X(04).
05 CTR-TELLER-ID PIC X(08).
05 CTR-FILING-DATE PIC X(10).
PROCEDURE DIVISION.
0000-MAIN.
PERFORM 1000-INITIALIZE
PERFORM 2000-PROCESS-TRANSACTIONS
UNTIL END-OF-TXN-FILE
PERFORM 3000-CHECK-STRUCTURING
PERFORM 8000-WRITE-SUMMARY
PERFORM 9000-TERMINATE
STOP RUN.
2000-PROCESS-TRANSACTIONS.
* Check if this is a cash transaction
IF TXN-IS-DEPOSIT OR TXN-IS-WITHDRAWAL
IF TXN-CHANNEL-BRANCH OR TXN-CHANNEL-ATM
* This is a cash transaction
PERFORM 2100-ACCUMULATE-CUSTOMER-CASH
IF TXN-AMOUNT >= WS-CTR-THRESHOLD
* Single transaction CTR
PERFORM 2200-FILE-SINGLE-CTR
END-IF
END-IF
END-IF
PERFORM 2900-READ-NEXT-TXN
.
2100-ACCUMULATE-CUSTOMER-CASH.
* Search for existing customer entry
SET WS-CCT-IDX TO 1
SEARCH ALL WS-CCT-ENTRY
AT END
* New customer - add to table
ADD 1 TO WS-CCT-COUNT
MOVE TXN-ACCT-NUMBER
TO WS-CCT-CUST-NUM(WS-CCT-COUNT)
MOVE TXN-AMOUNT
TO WS-CCT-DAILY-CASH(WS-CCT-COUNT)
MOVE 1
TO WS-CCT-TXN-COUNT(WS-CCT-COUNT)
MOVE 'N'
TO WS-CCT-FLAGGED(WS-CCT-COUNT)
WHEN WS-CCT-CUST-NUM(WS-CCT-IDX) =
TXN-ACCT-NUMBER
* Existing customer - accumulate
ADD TXN-AMOUNT
TO WS-CCT-DAILY-CASH(WS-CCT-IDX)
ADD 1
TO WS-CCT-TXN-COUNT(WS-CCT-IDX)
END-SEARCH
.
2200-FILE-SINGLE-CTR.
SET CTR-SINGLE-TXN TO TRUE
PERFORM 2500-BUILD-CTR-RECORD
WRITE CTR-OUTPUT-RECORD FROM WS-CTR-RECORD
ADD 1 TO WS-SINGLE-CTR-COUNT
ADD TXN-AMOUNT TO WS-TOTAL-CTR-AMOUNT
.
3000-CHECK-STRUCTURING.
* After all transactions processed, check
* for customers whose daily cash total
* exceeds the threshold across multiple
* transactions (no single one over $10K)
PERFORM VARYING WS-CCT-IDX FROM 1 BY 1
UNTIL WS-CCT-IDX > WS-CCT-COUNT
IF WS-CCT-DAILY-CASH(WS-CCT-IDX) >=
WS-STRUCTURING-THRESHOLD
AND WS-CCT-TXN-COUNT(WS-CCT-IDX) > 1
AND NOT CCT-ALREADY-FLAGGED(WS-CCT-IDX)
* Possible structuring - file CTR
SET CTR-STRUCTURING TO TRUE
MOVE WS-CCT-CUST-NUM(WS-CCT-IDX)
TO CTR-CUST-NUMBER
MOVE WS-CCT-DAILY-CASH(WS-CCT-IDX)
TO CTR-TOTAL-CASH-AMT
MOVE WS-CCT-TXN-COUNT(WS-CCT-IDX)
TO CTR-TXN-COUNT
PERFORM 2600-WRITE-STRUCTURING-CTR
ADD 1 TO WS-STRUCT-CTR-COUNT
END-IF
END-PERFORM
.
Tier 4: Analysis and Evaluation (Exercises 25-32)
Exercise 25: Architecture Review
The capstone application stores account data in both VSAM and DB2. Analyze this dual-storage design: - Why would an architect choose to maintain data in both VSAM and DB2 rather than using only one? - What are the consistency risks of this approach? - How would you design a synchronization mechanism to detect and correct discrepancies? - Under what conditions might you recommend eliminating one of the two data stores?
Hint: Consider the different access patterns of CICS online programs (which favor VSAM for key-based lookups) versus batch reporting programs (which favor DB2 for SQL-based aggregation). Think about what happens during the window between a VSAM update and a DB2 update.
Exercise 26: Scalability Analysis
The capstone processes transactions sequentially in a single batch job. Analyze what would happen as transaction volume grows from 50,000 per day to 5,000,000 per day: - Where are the performance bottlenecks in the current design? - Which components would need to be redesigned for 100x volume? - How would you partition the processing to run in parallel? - What changes to the JCL job stream would be needed?
Hint: Consider DB2 lock contention when multiple batch jobs update the same tables. Think about how SORT performance changes with volume and how you might use ICETOOL or DFSORT OUTFIL to split the workload.
Exercise 27: Error Recovery Design
The current capstone handles errors by writing to an error file and continuing. Design a more robust error recovery strategy: - What types of errors should stop processing immediately vs. continue? - How would you implement automatic retry for transient DB2 errors (deadlocks, timeouts)? - Design a dead-letter queue for transactions that fail all retry attempts - How would you handle the case where the program ABENDs mid-batch with 25,000 of 50,000 transactions posted?
Hint: Look at the checkpoint/restart pattern from Exercise 21. Consider how DB2 COMMIT frequency affects both recovery time and lock duration.
Exercise 28: Security Audit Assessment
Review the capstone application from a security perspective: - Where is sensitive data (SSN, account numbers) stored and how is it protected? - What access control mechanisms should be in place for CICS transactions? - How would you implement an audit trail for every account balance change? - What RACF (or equivalent) profiles would you define to control access to the batch jobs?
Hint: Consider data-at-rest encryption for VSAM files containing PII, CICS transaction security via the CEDA resource definitions, and the principle of least privilege for batch job IDs.
Exercise 29: Testing Strategy Evaluation
Design a comprehensive testing strategy for the capstone application: - What unit tests are needed for each program? - How would you test the integration between batch and online components? - Design a regression test suite that verifies financial accuracy - How would you test the end-of-day, end-of-month, and end-of-year processing?
Hint: Financial testing requires exact decimal comparisons. Think about how to create predictable test data where you can calculate the expected results by hand. Consider boundary conditions: first day of month, last day of month, leap year, year-end.
Exercise 30: Modernization Assessment
The capstone was designed as a traditional batch/CICS application. Evaluate these modernization options: - Wrapping the CICS transactions as REST APIs -- what changes are needed? - Moving from VSAM to DB2-only storage -- what are the migration risks? - Adding a real-time event stream for transactions -- how would the architecture change? - Migrating the batch processing to a cloud-based scheduler -- what JCL elements have no cloud equivalent?
Hint: Consider that REST APIs expect sub-second response times while CICS transactions may make multiple DB2 calls. Think about how VSAM's record-level locking compares to DB2's row-level locking for concurrent access.
Exercise 31: Data Migration Planning
A bank is migrating from a competitor's system to your capstone application. Plan the data migration: - The source system uses a different account number format (12 digits vs. 10) - Customer records are in a flat file with a different layout - Historical transactions go back 7 years (approximately 500 million records) - The migration must be completed over a single weekend
Outline the migration steps, estimate processing times, and identify the risks.
Hint: 500 million records at 300 bytes each is approximately 150 GB. Consider how long a sequential read of 150 GB takes on a mainframe. Think about the account number crosswalk table you would need.
Exercise 32: Disaster Recovery Procedure
Design the disaster recovery procedure for the capstone application. Address: - What is the Recovery Point Objective (how much data can be lost)? - What is the Recovery Time Objective (how long to restore service)? - How would you recover from a corrupted VSAM file? - How would you recover from a failed batch run that partially updated DB2? - What backups need to be taken and how frequently?
Hint: The RPO for a banking system is typically zero (no transaction can be lost). Consider how DB2 logging and VSAM journaling work together to achieve this. Think about the difference between recovering a single file and recovering the entire system to a consistent state.
Tier 5: Create and Design (Exercises 33-38)
Exercise 33: Design a Loan Origination Module
Design and implement a new loan origination module for the capstone. The module should include: - A CICS transaction for loan applications with customer and collateral screens - A batch credit scoring program that evaluates applications based on customer history - An amortization schedule generator for approved loans - Integration with the existing general ledger for loan disbursement
Produce the complete data architecture (copybooks, DB2 tables), the program specifications, and at least one working program.
Hint: Start with the DB2 table design for loan applications, then work outward to the copybooks and programs. Consider the status flow: Application -> Under Review -> Approved/Denied -> Funded -> Active.
Exercise 34: Build a Real-Time Dashboard Data Feed
Design a system that provides real-time operational metrics to a dashboard. The feed should include: - Current total deposits and loans across the bank - Transaction volume by type for the current day - Accounts opened and closed today - Alert counts (overdrafts, large transactions, dormant accounts)
Write a CICS program that collects these metrics from DB2 and publishes them as a JSON document to a CICS web service endpoint.
Hint: The JSON document should be structured for easy consumption by a JavaScript dashboard. Consider how to minimize DB2 overhead when the dashboard refreshes every 30 seconds -- caching and incremental updates rather than full table scans.
Exercise 35: Design a Multi-Currency Extension
Extend the capstone to support accounts denominated in multiple currencies. Your design should address: - How to modify the account record to store the currency code and base currency equivalent - Exchange rate table design and maintenance - How the interest calculation changes for non-USD accounts - How transfers between accounts in different currencies work - How the general ledger handles multi-currency entries
Produce the modified copybooks, the exchange rate table definition, and the currency conversion subprogram.
Hint: Use ISO 4217 currency codes. The exchange rate table needs both bid and ask rates, plus a timestamp for when the rate was captured. General ledger entries should record both the local currency amount and the USD equivalent.
Exercise 36: Implement a Notification System
Design and build a notification system that generates customer communications based on account events. The system should: - Detect trigger events: low balance, large transaction, statement ready, CD maturity approaching - Generate notification records with event type, customer contact information, and message content - Support multiple channels: email (extract file), SMS (short message format), and paper letter (print format) - Allow customers to set preferences for which notifications they receive and by which channel
Write the event detection batch program, the notification record layout, and the channel formatting subprograms.
Hint: The notification preference table maps customer numbers to event types and channels. The batch program runs after the daily posting cycle and scans for trigger conditions. Use a master notification queue that channel-specific programs read to generate the actual messages.
Exercise 37: Build a Complete Test Data Generator
Write a COBOL program that generates realistic test data for the entire capstone application. The generator should: - Create a configurable number of customers (1,000 to 100,000) with realistic names, addresses, and demographics - Generate accounts with appropriate type distributions (60% checking, 25% savings, 10% money market, 5% CD) - Produce a month's worth of transactions with realistic patterns (deposits on paydays, regular bill payments, random ATM withdrawals) - Ensure all data is internally consistent (account balances match transaction history, general ledger balances)
Hint: Use a seeded random number approach so the same test data can be regenerated. Consider using FUNCTION RANDOM with an initial seed value. Realistic names can come from hardcoded tables of common first and last names.
Exercise 38: Design a Complete DevOps Pipeline
Design a CI/CD pipeline for the capstone application that includes: - Source control strategy (how to organize the 15-20 programs, copybooks, and JCL in a repository) - Automated compilation and link-editing - Unit test execution with assertions on return codes and output files - Integration test execution with DB2 test tables and VSAM test files - Automated deployment to a test LPAR - Promotion process from test to production
Produce a pipeline definition document, the automated test scripts, and the deployment JCL.
Hint: Consider tools like IBM Dependency Based Build (DBB), Zowe CLI for z/OS interaction from a CI server, and SCLM or Endevor for source management on the mainframe side. The pipeline must handle copybook changes that trigger recompilation of all dependent programs.