Case Study 9.1: GlobalBank's Copybook Migration
Background
In 2015, GlobalBank's core banking system contained 347 programs that processed account records. The ACCT-MASTER record layout was defined inline in every program — 347 copies of the same 01-level definition, each potentially different due to years of independent maintenance.
Maria Chen, newly promoted to senior developer, discovered the scope of the problem during a routine audit. She found 12 distinct versions of the account record definition across the 347 programs. Seven programs defined ACCT-CURR-BALANCE as PIC S9(9)V99 instead of PIC S9(11)V99. Three programs were missing the ACCT-LAST-TXN-DATE field entirely. One program had a misspelled field name (ACCT-BALENCE) that had survived for eight years because it happened to work — the program only used MOVE to copy the entire record and never referenced individual fields.
The Problem
A regulatory change required adding a new field: ACCT-COUNTRY-CODE (PIC X(2)). Under the current approach, this meant:
- Modifying 347 programs
- Testing each program individually
- Coordinating deployment across all 347 programs in a single release window
Estimated effort: 3 developers, 6 weeks. Estimated risk: High (past experience showed that manual record layout changes produced a 2-3% error rate per program).
Maria's Solution
Maria proposed a three-phase migration to centralized copybooks:
Phase 1: Create the Canonical Copybook (1 week)
Maria created ACCT-REC in GLOBALBANK.PROD.COPYLIB, defining the single authoritative version of the account record layout. She included:
- A comprehensive header comment with version number and modification history
- 88-level condition names for every coded field
- 30 bytes of FILLER for future expansion
- The new ACCT-COUNTRY-CODE field (carved from what would have been FILLER)
Phase 2: Incremental Migration (8 weeks)
Rather than converting all 347 programs at once, Maria prioritized:
- Tier 1 (Week 1-2): The 5 most critical programs (ACCT-MAINT, TXN-PROC, BAL-CALC, RPT-DAILY, ACCT-CLOSE) — replaced inline definitions with COPY ACCT-REC
- Tier 2 (Week 3-4): The 20 programs that had known discrepancies from the canonical layout
- Tier 3 (Week 5-8): Remaining 322 programs, converted 40-50 per week by junior developers following Maria's written procedure
Phase 3: Prevention (Ongoing)
Maria established a coding standard: no new program could be approved in code review if it defined the account record inline. All programs must use COPY ACCT-REC.
Results
| Metric | Before | After |
|---|---|---|
| Time to add a field | 6 weeks | 0.5 days |
| Record layout discrepancies | 12 versions | 1 version |
| Programs requiring individual change | 347 | 1 (the copybook) |
| Annual record-layout-related defects | 8-12 | 0-1 |
Lessons Learned
-
Incremental migration works. Converting 347 programs all at once would have been too risky. Tiered migration allowed the team to build confidence and catch issues early.
-
Standards require enforcement. Without the code review gate, developers would have slowly drifted back to inline definitions under deadline pressure.
-
The FILLER strategy paid off immediately. The ACCT-COUNTRY-CODE field was the first of five fields added over the next three years, all carved from FILLER without changing the record length.
-
Compiler listings are essential. During migration, the expanded source listing was the primary tool for verifying that the copybook insertion produced the expected result.
Discussion Questions
-
What risks did Maria accept by migrating Tier 1 programs first? What risks would she have faced by starting with Tier 3?
-
How would you handle a program that references a field name from the old inline definition that does not exist in the new copybook?
-
If GlobalBank used source control (e.g., Git or Endevor) during this migration, how would you structure the branches or packages to manage the transition?
-
Estimate the total cost savings over five years, assuming the "before" approach required 6 weeks of effort per field addition and the "after" approach requires 0.5 days. Assume 2 field additions per year and an average developer cost of $80/hour.