Quiz — Chapter 41: Legacy Code Archaeology
Multiple Choice
1. What should be the FIRST step when approaching an undocumented COBOL program?
a) Read the program from line 1 to the end b) Examine external evidence — JCL, file names, job schedule c) Find and read all the comments d) Run the program and look at the output
2. A call graph shows:
a) The communication between different mainframe systems b) Which paragraphs PERFORM which other paragraphs c) The telephone directory of the development team d) The sequence of JCL steps
3. What is "tribal knowledge"?
a) Documentation stored in a tribal database b) Knowledge that exists only in people's memories, not written down c) Programming techniques from the COBOL tribe d) A type of COBOL code comment
4. In data flow analysis, "backward tracing" means:
a) Reading the program in reverse order b) Starting with an output field and finding its data sources c) Undoing recent code changes d) Reading from the bottom of the DATA DIVISION upward
5. What is the primary risk of PERFORM THRU?
a) It is slower than regular PERFORM b) Any paragraph in the range is executed, including ones added later c) It does not work with COBOL-85 d) It prevents the use of IF statements
6. When extracting business rules from EVALUATE statements, what should you create?
a) A new EVALUATE statement b) A business rule catalog with rule ID, description, conditions, and actions c) A replacement IF statement d) A test case
7. Impact analysis for a field change should include:
a) Only the paragraph where the field is defined b) Only the programs that compile successfully c) All references, downstream calculations, other programs using the same copybook, and downstream systems d) Only the output file that contains the field
8. Which tool can automatically build call graphs and data flow diagrams for COBOL?
a) Microsoft Word b) IBM Application Discovery and Delivery Intelligence (ADDI) c) GnuCOBOL compiler d) JCL scheduler
9. What does the "Iceberg Principle" refer to in impact analysis?
a) The visible change is small but downstream effects are much larger b) Legacy code is cold and hard c) Most COBOL code is hidden underwater d) Programs should be as large as icebergs
10. Why should a business analyst review business rules extracted from code?
a) To make the documentation look prettier b) To confirm that what the code does matches what the business intends c) Because developers cannot read COBOL d) To sign off on the budget
True or False
11. You should judge original developers harshly for writing undocumented code. ____
12. The DATA DIVISION survey should be done before reading the PROCEDURE DIVISION in detail. ____
13. Fields named WS-WORK-1 are always used for the same purpose throughout a program. ____
14. grep (or ISPF FIND) is a useful tool for tracing data flow in COBOL programs. ____
15. Knowledge transfer from retiring developers should begin the day before their last day. ____
Short Answer
16. Describe the five-step systematic approach to reading undocumented COBOL code.
17. Explain why Maria Chen's phone call to Harold Mercer was more valuable than three days of code reading for understanding paragraph 4700.
18. In the MedClaim case study, 7 of 112 business rules were found to be superseded. Why is this a compliance risk?
19. What is the difference between forward tracing and backward tracing in data flow analysis? When would you use each?
20. Name three common COBOL anti-patterns found in legacy code and explain why each is problematic.
Answer Key
1. b — External evidence provides context that makes code reading much more efficient. 2. b 3. b 4. b 5. b — Paragraphs added within a PERFORM THRU range are automatically included in the execution, which can cause unintended behavior. 6. b 7. c 8. b 9. a 10. b
11. False — They worked under constraints we may not understand. 12. True 13. False — Generic work fields are often reused for different purposes in different paragraphs. 14. True 15. False — Knowledge transfer should begin months before retirement, with structured sessions.
16. (1) Identify purpose from external evidence (JCL, file names, schedule). (2) Survey the DATA DIVISION (files, variables, flags, tables). (3) Trace the main control flow (call graph). (4) Analyze data flow (forward and backward tracing). (5) Extract business rules from EVALUATE and IF statements.
17. The code showed WHAT paragraph 4700 did (apply fixed adjustments to specific accounts) but not WHY. The reason — a 1995 system conversion left rounding differences — was historical context that existed only in Harold's memory. Without this context, Maria might have spent days trying to understand the business logic behind the adjustments, or might have incorrectly removed them.
18. The superseded rules approved claims that should have been denied under current regulations. While this did not cause immediate visible problems, it meant MedClaim was paying claims it should not have been, which represents both a financial loss and a regulatory compliance violation that could result in penalties if discovered during an audit.
19. Forward tracing starts with an input field and follows it through the program to see where it ends up and how it is transformed. Use it when you want to understand what happens to a specific input. Backward tracing starts with an output field and works backward to find its data sources. Use it when you need to understand how a specific output value is calculated.
20. (1) GO TO spaghetti: creates unpredictable control flow that is difficult to trace and maintain. (2) PERFORM THRU: implicitly includes all paragraphs in a range, making it dangerous to add or rearrange paragraphs. (3) Generic work fields (WS-WORK-1): reused for different purposes in different paragraphs, making data flow analysis difficult and introducing risk of value collision.