Exercises: Building a Complete Banking Transaction System

Exercise 43.1: Extend the Data Dictionary

Add the following fields to the Account Master copybook:

  • ACCT-OVERDRAFT-LIMIT: A signed packed-decimal field (S9(7)V99 COMP-3) that sets the maximum overdraft allowed for checking accounts. Savings accounts should have this set to zero.
  • ACCT-LAST-STMT-DATE: A date field (9(08)) recording when the last statement was generated.
  • ACCT-EMAIL-ADDRESS: A 50-byte alphanumeric field for electronic statement delivery.

Update the FILLER to accommodate the new fields without changing the overall record length. If the new fields exceed the available FILLER, recalculate the record size and update the VSAM DEFINE CLUSTER accordingly.

Deliverables: 1. Updated ACCTMSTR copybook 2. Updated IDCAMS DEFINE CLUSTER (if record size changed) 3. A brief explanation of the impact on existing programs

Exercise 43.2: Implement Overdraft Protection

Modify TXN-PROC to support overdraft protection for checking accounts. When a debit transaction would cause an insufficient funds rejection, the program should:

  1. Check whether the account has an overdraft limit (ACCT-OVERDRAFT-LIMIT > 0)
  2. If the debit amount is within the overdraft limit, allow the transaction and set the balance to a negative value
  3. Assess an overdraft fee of $35.00 (create a new FE transaction in the audit trail)
  4. If the debit exceeds even the overdraft limit, reject the transaction as before

Test Cases to Write: - Debit that goes into overdraft but within limit - Debit that exceeds overdraft limit - Debit on savings account (no overdraft allowed) - Multiple debits that progressively consume the overdraft limit

Exercise 43.3: Add Interest Calculation

Create a new program, INT-CALC, that computes and applies monthly interest to all savings accounts. The program should:

  1. Read the account master sequentially
  2. For each active savings account, calculate interest using the formula: Monthly Interest = (Balance * Annual Rate) / 12
  3. Use an annual rate of 2.5% (define this as a working storage constant, not a hardcoded literal in the formula)
  4. Apply the interest as a CR transaction via the existing TXN-PROC interface (write a transaction record to an output file)
  5. Update YTD-INTEREST on the account master
  6. Produce a summary report of interest applied

Hint: Use UTIL-DATE to determine the number of days in the current month for a more accurate daily-rate calculation.

Exercise 43.4: Build a Transaction Reversal Program

Create TXN-REV, a program that reverses a previously applied transaction. Given a transaction reference number (TXN-REF-NUMBER), the program should:

  1. Find the original transaction in the audit trail
  2. Verify the account still exists and is active
  3. Apply the reverse of the original transaction (credit becomes debit, debit becomes credit)
  4. Write a new audit trail record with a "REV" action code
  5. Handle edge cases: what if the reversal would create a negative balance? What if the original transaction was a transfer?

Design Question: Should reversals be immediate (processed individually) or batched (collected and processed in a batch run)? Write a one-paragraph justification for your choice.

Exercise 43.5: Implement the BMS Map for ACCT-INQ

Write the BMS macro source for the ACCT-INQ screen. The map should include:

  1. A title line: "GLOBALBANK ACCOUNT INQUIRY"
  2. An input field for account number (10 characters, with underscore attribute)
  3. Display fields for: customer name, account type, status, current balance, available balance, date opened, last activity date, YTD interest
  4. A message line at the bottom for status messages
  5. PF key labels: PF3=Exit, PF12=Cancel

Use appropriate BMS attributes (PROT/UNPROT, NUM/ALPHA, BRT/NORM) for each field.

Exercise 43.6: Add Logging to UTIL-DATE

Enhance UTIL-DATE to accept an optional logging flag in the LINKAGE SECTION. When logging is enabled, the subprogram should:

  1. Write each function call to a log file (function code, input parameters, result, return code)
  2. Include a timestamp on each log entry
  3. Not open/close the log file on each call — use a static flag to track whether the file is already open

Design Question: How would you handle logging in a CICS environment where traditional file I/O is not available? Describe an alternative approach using CICS facilities.

Exercise 43.7: System Integration Test

Design and execute a complete integration test for the banking system. Create test data that exercises the following scenario:

  1. Load 10 accounts (5 checking, 5 savings, varying balances)
  2. Process 25 transactions including at least one of each type (CR, DR, XF, FE)
  3. Include at least 3 transactions that should be rejected (NSF, invalid type, account not found)
  4. Generate statements for all active accounts
  5. Verify that the audit trail contains the expected number of records
  6. Verify that the sum of all credits minus all debits equals the net change in total balances

Deliverables: 1. Test input files (account load data, transaction data) 2. Expected output (what should the audit trail contain? What should the summary report show?) 3. A verification checklist that proves the system is working correctly

Exercise 43.8: Performance Analysis

Using the GnuCOBOL compiler or the Student Mainframe Lab, measure the performance of TXN-PROC with varying transaction volumes:

  1. Generate test files with 100, 1,000, 10,000, and 100,000 transactions
  2. Time each run and calculate the throughput (transactions per second)
  3. Identify the bottleneck: is it I/O-bound (reading/writing files) or CPU-bound (validation and business logic)?
  4. Propose two specific optimizations that would improve throughput

Hint: On a mainframe, the BUFND and BUFNI parameters on the DD statement can significantly affect VSAM performance. On GnuCOBOL, the file system cache serves a similar role.