Closed
Labels
bugUnintended behavior or logic failure in the enginelegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forging
Description
Found by the #3120 differential. x_ray_dead_code and its resolve_copybooks (gitgalaxy/tools/cobol_to_cobol/cobol_graveyard_finder.py) produce mostly false output on real code.
| zopeneditor-sample | CBSA | |
|---|---|---|
| "dead paragraphs" reported | 17 | 623 |
of which scope terminators (END-IF, END-EXEC, GOBACK, EXIT) |
17 | 119 |
| of which paragraphs of a different program inlined as a copybook | 0 | 118 |
| of which live by SECTION fall-through | 0 | 165 |
Defects
- Scope terminators read as paragraphs. The pattern
^[ \t]{0,11}NAME\.accepts up to 11 leading blanks, which reaches into Area B, soEND-IF.andGOBACK.become paragraphs. Every "dead paragraph" on zopeneditor is one of these. - Programs inlined as copybooks.
resolve_copybookstries.cbl/.cobas copybook extensions in the program's own directory.COPY ACCTCTRL(the copybook lives incobol_copy/) therefore inlines the programcobol_src/ACCTCTRL.cbl, often the program itself, and does it up to three passes deep. This happens in 18 of CBSA's 31 programs. - Same directory only. Real layouts keep copybooks elsewhere (
COPYBOOK/,cobol_copy/), so on both corpora 0 real copybooks are ever resolved. The orphaned-variable result is therefore computed without the copybook data layouts it exists to consider. - Sequence-number fields. The patterns assume blanks in columns 1–6.
R2 COPY SAM2PARM.(zopeneditor multiroot) and any sequence-numbered source are invisible. - No SECTION model.
X SECTION.headers are invisible, and paragraphs reached by fall-through inside a PERFORMed section are reported dead.
Downstream effect
dead_paras feeds extract_lineage masking and the microservice slicer, and orphaned_vars feeds the schema forge's ignore_vars. So these errors reach generated output.
The engine DB cannot replace this pass yet: its usage_status is a by-name test, filed separately. Details: docs/refraction_engine_differential.md D1–D3 (PR for #3120).
Metadata
Metadata
Assignees
Labels
bugUnintended behavior or logic failure in the enginelegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forging
Activity
squid-protocol commentedon Sep 19, 2026
Measured against the new answer key (#3210, PR #3216) there's a worse consequence than the table above shows. On CBSA's
BANKDATA.cbl,x_ray_dead_codemarks the entry paragraphA010dead.COPY ACCTCTRL/COPY CUSTCTRLresolve to the sibling programs (defect 2), and the inlined text changes which paragraph the graveyard takes as "first".extract_lineagethen masksA010, which holds the program's onlyOPEN OUTPUT CUSTOMER-FILE. So BANKDATA's one output disappears even though the OPEN is single-mode (not the #3204 shape):Answer-key scores for this issue's field on CBSA: real dead logic is 10 units, and the forge finds 5 of them among 571 non-trivial claims (P 5/571 · R 5/10). A fix here can be scored directly with
python tests/tools/cobol_answer_key.py score <cbsa clone> --key tests/cobol_mainframe/answer_key/cics-banking-sample-application-cbsa.json.fix(refraction): forge parser fixes -- multi-mode OPEN, per-statement…
fix(refraction): graveyard reachability with a SECTION model (#3203) …