Quiz: Building a Complete Banking Transaction System
Multiple Choice
1. Why does the Account Master copybook use COMP-3 (packed decimal) for monetary fields instead of DISPLAY format?
a) COMP-3 is faster for all arithmetic operations on all platforms b) COMP-3 saves storage space and avoids floating-point precision issues c) COMP-3 is required by the COBOL standard for signed fields d) COMP-3 is the only format that supports the SIGN clause
2. What is the purpose of the 20-byte FILLER at the end of the Account Master record?
a) To pad the record to a multiple of 4096 bytes for VSAM alignment b) To provide expansion room for future fields without changing the record length c) To store overflow data from the customer name fields d) To maintain compatibility with EBCDIC character encoding
3. In the VSAM DEFINE CLUSTER, what does FREESPACE(20 10) specify?
a) 20% of the cluster is reserved and 10% is for overflow b) 20% free space per CI and 10% free CAs c) 20 bytes free per record and 10 bytes free per CI d) 20% free space for data and 10% free space for the index
4. Why does the ACCT-INQ CICS program use EXEC CICS READ without the UPDATE option?
a) UPDATE is not supported for VSAM KSDS files in CICS b) To avoid locking the record, which would block other transactions c) Because the program only needs the first 50 bytes of the record d) UPDATE is only needed when using DB2 tables
5. In the Daily Processing JCL, what does COND=(4,LT,STEP010) mean on STEP020?
a) Skip STEP020 if STEP010's return code is less than 4 b) Skip STEP020 if 4 is less than STEP010's return code (i.e., RC > 4) c) Run STEP020 only if STEP010 completed in less than 4 seconds d) Run STEP020 with a condition code of 4 from STEP010
6. Why does UTIL-DATE use GOBACK instead of STOP RUN?
a) GOBACK is more efficient than STOP RUN b) STOP RUN would terminate the entire run unit, including the calling program c) GOBACK is required when using LINKAGE SECTION parameters d) STOP RUN is not valid in Enterprise COBOL
7. What is the primary risk of the transfer operation in TXN-PROC?
a) Transfers between checking and savings accounts use different interest rates b) If the target credit fails after the source debit succeeds, money is lost c) Transfer transactions cannot be reversed d) VSAM does not support updating two records in the same I/O operation
8. Why does TXN-PROC save the balance in WS-SAVE-BALANCE before modifying it?
a) To restore the balance if the REWRITE fails b) To write the before-image to the audit trail for traceability c) To calculate the transaction fee d) To compare with the next transaction's amount
9. What VSAM SHAREOPTIONS would you choose for a file accessed by both batch (I-O) and CICS (INPUT) simultaneously?
a) SHAREOPTIONS(1 1) — exclusive control b) SHAREOPTIONS(2 3) — multiple readers, one writer cross-region c) SHAREOPTIONS(4 4) — unrestricted sharing d) SHAREOPTIONS(3 1) — application-managed cross-region
10. In the ACCT-LOAD program, what is the purpose of reading the first record in 1000-INITIALIZE instead of in 2000-PROCESS-RECORDS?
a) To verify the input file is not empty before entering the processing loop b) To implement the read-ahead pattern that prevents processing after EOF c) To initialize the VSAM file's control blocks d) To set the RETURN-CODE before processing begins
Short Answer
11. Explain why 88-level condition names improve code readability. Give an example showing the same logic with and without 88-levels.
12. Describe three differences between batch COBOL programs and CICS COBOL programs in terms of how they handle file I/O.
13. What is the purpose of an audit trail in a financial system? Name three pieces of information that every audit trail record should contain.
14. Explain the concept of a "batch window" and describe two strategies for ensuring batch processing completes within the window.
15. Why is it important that all programs in the system use the same copybook (ACCTMSTR) for the account master record? What could go wrong if each program defined its own record layout?
Design Questions
16. The current system has no way to handle a partially completed transfer (source debited, target credit failed). Design a recovery procedure that could be run to detect and correct such inconsistencies. Describe the inputs, processing logic, and outputs.
17. If GlobalBank decided to migrate the Account Master from VSAM to DB2, what changes would be needed in each of the five programs? Which program would require the most changes and why?
18. Design a simple checkpoint/restart mechanism for TXN-PROC. Describe what data the checkpoint record would contain, how often checkpoints would be taken, and how the restart logic would work.
Answer Key
1. b) COMP-3 saves storage space and avoids floating-point precision issues. A S9(9)V99 field takes 6 bytes in COMP-3 versus 12 bytes in DISPLAY. More importantly, packed decimal arithmetic preserves exact decimal precision, which is essential for financial calculations.
2. b) To provide expansion room for future fields without changing the record length. Changing a VSAM record length in production requires redefining the cluster and reloading all data — a disruptive operation.
3. b) 20% free space per CI (Control Interval) and 10% free CAs (Control Areas). This reserves space for future insertions, reducing CI and CA splits.
4. b) To avoid locking the record. An inquiry screen may be displayed for minutes while a CSR talks to a customer. A locked record would block batch processing and other online users.
5. b) Skip STEP020 if 4 is less than STEP010's return code. The COND parameter tests whether to BYPASS the step. COND=(4,LT,STEP010) means "bypass if 4 < RC of STEP010" — i.e., bypass if RC > 4.
6. b) STOP RUN would terminate the entire run unit, including the calling program. GOBACK returns control to the caller.
7. b) If the target credit fails after the source debit succeeds, money is lost. This is the classic two-phase commit problem.
8. b) To write the before-image to the audit trail. The audit record shows both before and after balances, allowing auditors to verify transaction accuracy.
9. b) SHAREOPTIONS(2 3). This allows multiple readers with one writer within a region, and application-managed sharing across systems.
10. b) To implement the read-ahead pattern. Reading the first record before the processing loop ensures the EOF condition is detected before the loop body executes, not after.
11. Without 88-levels: IF ACCT-TYPE = 'C' ... IF ACCT-STATUS = 'A'. With 88-levels: IF ACCT-CHECKING ... IF ACCT-ACTIVE. The 88-level version reads like English, is self-documenting, and prevents mistyping literal values.
12. (1) Batch uses native COBOL I/O (READ/WRITE/REWRITE); CICS uses EXEC CICS READ/WRITE/REWRITE. (2) Batch opens files in the PROCEDURE DIVISION; CICS files are managed by the CICS region (FCT entries). (3) Batch uses file status codes (PIC X(02)); CICS uses RESP codes (DFHRESP values).
13. Purpose: traceability, regulatory compliance, fraud detection, debugging. Every record should contain: (1) timestamp, (2) action performed (read/update/insert/delete), (3) who performed the action (operator/user ID). Additional: before/after images, program ID, transaction amount.
14. The batch window is the overnight period when batch processing runs. Strategies: (1) sort input files to match VSAM key sequence for sequential processing, (2) increase buffer allocations (BUFND/BUFNI) to reduce physical I/O, (3) split input files and run parallel instances.
15. Using the same copybook ensures all programs interpret the data identically. If programs defined their own layouts, a field offset mismatch could cause one program to read another program's data incorrectly — e.g., interpreting a packed-decimal balance as character data, causing a SOC7 ABEND or incorrect calculations.
16–18. Open-ended design questions. Evaluate based on completeness, feasibility, and awareness of COBOL/mainframe constraints.