Exercise 1: Why Fixing CUSTREC Fixes Every Including Program on Recompile — Possible Solution ==================================================================== WHAT COPY GENUINELY DOES, PER THIS CHAPTER'S OWN FINDING-BOX This chapter's own finding-box states the real mechanism directly: COPY works entirely at compile time, logically substituting the copybook's own real text directly into the compiling program's source before that program is ever compiled. A program that used COPY, once compiled, looks exactly as if the copybook's own lines had genuinely been typed there by hand. WHY THAT MEANS EVERY INCLUDING PROGRAM SHARES THE SAME REAL SOURCE TEXT Because COPY performs a genuine textual substitution rather than creating any kind of ongoing reference, every real program that includes CUSTREC via COPY CUSTREC pulls in the exact same current content of that one file at the moment each program is compiled. There's no separate, independently-maintained version of CUST-BALANCE's declaration sitting inside each individual program's own file - the actual PICTURE clause text lives in exactly one real place, the copybook itself. WHY EDITING CUSTREC ALONE IS GENUINELY SUFFICIENT Since every including program's own real source, at compile time, is built by substituting in whatever CUSTREC currently contains, changing CUST-BALANCE's PICTURE clause inside CUSTREC changes what every one of those programs will compile against the very next time each is recompiled - without a single line inside any of those programs' own separate source files needing to be touched directly. WHY RECOMPILING IS THE GENUINE REQUIREMENT, NOT AN OPTIONAL STEP This chapter's own material is explicit that COPY's substitution happens before compilation - it is not something that continues to apply automatically at runtime the way a linked CALL to a subprogram does. A program that was already compiled before CUSTREC was updated is running against whatever the copybook's old content already produced; only recompiling that program causes the compiler to substitute in CUSTREC's real, updated content and produce a new, corrected version of the compiled program. ANSWER: Because COPY performs a genuine compile-time textual substitution rather than creating a live, ongoing link, every real program that includes CUSTREC via COPY CUSTREC pulls in exactly the same current copybook content whenever it's compiled. Editing CUST-BALANCE's PICTURE clause inside CUSTREC changes what every including program will substitute in the next time it's recompiled, with no need to touch any of those programs' own separate source files directly - the actual field declaration exists in exactly one real place. Recompiling each program is still genuinely required, though, since the substitution happens before compilation, not at runtime - a program compiled before the copybook change was made is still running against the old declaration until it's rebuilt. WHY THIS WORKS AS AN ANSWER ------------------------------ This correctly explains the mechanism (a single real source of the declaration substituted into every including program) rather than treating the fix as automatic magic, and honestly notes the real recompile requirement rather than implying the change takes effect without it.