Repository navigation
COBOL: blank the numbered sequence area so split operands read the real target (#4300) - #4334
Merged
Merged
Conversation
…al target (#4300) In fixed-format source with a numbered sequence area (cols 1-6), a verb whose operand starts on the next line read that line's sequence number: `PERFORM` / `000900 INIT-PARA` recorded the callee 000900, a split GO TO the transfer 038000, a split COPY the import 000600, and a split CALL left no call_site_data row at all. Prism already blanked cols 73-80 of fixed lines (#4264); it now also blanks a numbered sequence area (six letters/digits with a digit, no spaces) of fixed lines, plus a debug line's col-7 D behind an all-digit area, for every COBOL rule and reader. Free and variable lines, and unnumbered/level-number heads like ` 02 DELTA`, are left alone. A line holding only sequence/identification fields is blank, not documentation. Golden masters regenerated in both legs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
squid-protocol
marked this pull request as ready for review
October 4, 2026 16:14
This was referenced Oct 4, 2026
squid-protocol
added a commit
that referenced
this pull request
Oct 4, 2026
…4341) #4335 (answer-key extents, #4318) and #4334 (#4300, sequence-area blanking) merged three minutes apart. #4335's ledger recorded 200 `engine_unit_end_counts_noncode_lines` entries against the engine before #4334; with #4334 on main, 182 of them no longer reproduce (units no longer end on sequence-number-only lines), so the ledger gate on main failed with "0 new, 182 no longer reproducing". Regenerated with `ground_truth_ledger.py update`: +0 -182, 0 untriaged. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4300
What was broken
In fixed-format COBOL with a numbered sequence area (cols 1-6, e.g. ISPF
NUMBER ON STD), a verb whose operand starts on the next line read that line's sequence number as the operand. The operand separators (\s+,[ \t\n]+) cross the newline, and Prism had blanked cols 73-80 (#4264) but not cols 1-6.PERFORM/000900 INIT-PARA000900INIT-PARACALL/001100 'SUBPGM1'001100, no call_site_data rowSUBPGM1, literal rowCALL/001300 WS-PGM001300, no rowWS-PGM, identifier row (resolves to SUBPGM2)GO TO/001000 END-PARA.001000END-PARACOPY/000600 CPYA.000600CPYAThe fix
I took the first route in the acceptance criteria: the stream is blanked, not the separators.
cobol_source_format.blank_sequence_arearuns in Prism next toblank_identification_area, so every COBOL rule and reader downstream gets it.It blanks the sequence area of fixed lines, offsets kept, only when the area is numbered: six letters/digits, at least one digit, no spaces, followed by a blank /
-indicator. This matches the shape the per-reader_blank_sequence_fieldshelpers already assume. Those helpers are now no-ops on these lines.What is left alone:
02 DELTA(a level number in cols 1-6);-in col 7.A debug line's col-7
Dbehind an all-digit area is blanked too (064000D PASS.→ operandPASS). The engine already treated debug lines as code. Paragraph headers on debug lines (064100DDEBUG-LINE-TEST-03-A.) keep their names, because thecobol_sentence_startfilter keepsPASS.there from becoming a header.One follow-on fix was needed. Once those fields are blanked, a line that holds only sequence / identification fields (
003100, or340000in cols 73-80) leaves the code stream. Prism'sdoc_loc = active_lines - coding_locwould then have counted it as documentation. The active-line count for COBOL now uses the same blanked text, so such a line counts as blank: it is neither code nor doc.Evidence
MAIN-PARA.calls_out_to = [INIT-PARA, SUBPGM1, WS-PGM](was[000900, 001100, 001300]). call_site_data gets the literal SUBPGM1 and identifier WS-PGM rows.transfers_to = [END-PARA]and the COPY capture isCPYA.NC1344.2.cblTEST-2 transfers_to is now[TST-21, TST-22](was038000), and the same holds at all 6 sites.DB1024.2.cblDEBUG-LINE-TEST-03 / -03-A / -04 now callPASS/FAIL/PASS(were064000D/064200/065400D).DB1034.2.cbllikewise.064000D,064200…), replaced by PASS/FAIL.038000,042900…). 11 real ones were added; the extra five come fromGO/TOsplit across lines that now match.tests/core_engine/test_cobol_sequence_area_4300.pyhas 7 tests. They cover the verbatim REPRO4/5 (all 5 shapes plus call_site_data), the DB1024 debug-line operand and paragraph, the blanker's line-by-line rules (numbered / alphanumeric / continuation / debug /02 DELTA/ unnumbered / seq-only), free-format untouched, and the LOC accounting. Four of the five tests that existed before the LOC fix fail on main.Golden-master diff (both legs regenerated: 4,657 diffs each, same shape)
All of it is on mainframe files except the layout/PageRank/Testing-Exposure ripple at the end.
INPUT-PROCESSparagraphs differed only by their sequence numbers. They now have identical bodies and are flagged duplicates (status 2).VALUEliterals continued on the next line used to read as the sequence number ('007400','015400'). They now read the real literal (' COMPUTED=','OFFICIAL COBOL COMPILER VALIDATION SYSTEM'). Continuation joins still carry their\n -remainder, as before, minus the number.SUBTRACTonDdebug lines is now read.GO/TOsplit over two lines now matches.total_locgoes from 926,260 to 925,304. Documentation LOC changes in 1 file: COCRDUPC has a line holding only340000in cols 73-80, which is no longer counted as doc.pytest -m golden_cruciblepasses in both venvs.Ground-truth ledger
ground_truth_ledger.py checkis clean. The keyed corpora do not contain the split-operand shape, so there is no ledger change.Local checks
tests/extraction,tests/core_engine,tests/cobol_mainframe: 13,162 passedmypy_audit --ci,ruff_audit --ci(0.16.0),dead_key_audit --ci: nothing new🤖 Generated with Claude Code