Repository navigation
Fix #4264: fixed / free COBOL reference format, per file and per directive - #4290
Merged
Merged
Conversation
…ctive Columns 73-80 of a fixed-format line are an identification area the compiler ignores, and no COBOL reader knew fixed from free format: NIST CCVS tags (`NC1314.2`) leaked into data moves, CALL USING operands and DD names, while a free-format line past column 72 was cut by the sentence scan. - gitgalaxy/core/cobol_source_format.py: per-file detection (documented vote: `*>` / code in cols 1-6 / a word crossing col 72 vs a numbered sequence area, a col-7 indicator, a lone cols 73-80 tag; fixed by default) and `>>SOURCE [FORMAT] [IS] FREE|FIXED|VARIABLE`, `>>FORMAT`, Micro Focus `$SET SOURCEFORMAT` switching from the line after the directive. - Prism blanks the identification area of fixed lines only (offsets kept), for every COBOL rule and reader; free / variable lines keep their text. - The #3197 sentence scan cuts at column 72 only on fixed lines; _blank_sequence_fields leaves free lines alone. - The SELECT reader (dataset bindings) blanks sequence fields as file_control does: with the tag gone, `ASSIGN TO` / name-on-next-line read `TO`. - cobol.py's cols 73-80 note resolved (comment only; no rule changed). - Golden masters re-blessed (147 files, 140 of them NIST CCVS85; scoped in full); field-testing defect D043 (review). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # docs/language_status/cics_field_testing.md # tests/cobol_mainframe/field_testing.json
Contributor
squid-protocol
marked this pull request as draft
October 4, 2026 12:04
Both sides re-blessed the golden masters (this branch on v1.6.0, main on v1.7.0 via #4259), so the conflicted snapshots were regenerated from the merged code in both CI legs (full-precision, zero-dependency) rather than hand-merged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
field_testing.json merged by entry (main's #4243 defect kept; this branch's defect renumbered where its ID collided), then cics_field_testing.md and fact_channel_confidence.json regenerated with `tests/tools/field_testing.py report --write` rather than hand-merged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Golden masters regenerated in both legs (full-precision, zero-dependency) against language-crucible v1.7.0 on the merged engine; field-testing report and fact_channel_confidence.json regenerated with field_testing.py report --write. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
squid-protocol
marked this pull request as ready for review
October 4, 2026 14:08
This was referenced Oct 4, 2026
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.
Resolves #4264.
What was broken
>>SOURCE FORMAThandling.cobol.py:137said outright that column-73 blanking was "unsafe without fixed/free-format detection".NC1314.2on every line), but every COBOL rule and reader saw it. On the crucible's NIST CCVS85 set:MOVE "." -> NC1314);CONTENT:IC2244operand in CALL USING;DB1044instead of theXXXXX055on the next line).Changes
gitgalaxy/core/cobol_source_format.py(new):line_formatsgives each linefixed/free/variable: the file's detected format, switched from the line after each directive. Directives handled:>>SOURCE [FORMAT] [IS] FREE|FIXED|VARIABLE,>>FORMAT …, and Micro Focus$SET SOURCEFORMAT"FREE"/(FIXED)/'…'.blank_identification_areablanks columns 73+ of fixed lines only, keeping offsets and lengths.*>or program text in cols 1-6, a word crossing col 72/73, text past col 80. Fixed evidence: a six-digit sequence area, a col-7 indicator, a lone token in cols 73-80. Fixed is the default._cobol_sentence_start_offsetscuts at column 72 only on fixed lines.db2_declare_table._blank_sequence_fields(COBOL): leaves free lines alone, with no cols 1-6 or 73+ blanking. It is shared by the data-move, CALL USING, file-control, MQ, SQL and UOW readers.mainframe_boundarySELECT reader (dataset bindings,cobol_select_assigns): blanks sequence fields, asfile_controlalready did. The tag had been hiding a real defect. WithASSIGN TOat a line's end, the next line's003400sequence area made the regex fall back to capturingTO. It now reads the real name.cobol.py: the cols 73-80 note is updated to point at this layer. Comment only; no rule regex changed, so this does not touch Fix #4242: record a quoted PROGRAM-ID (PROGRAM-ID. 'EPSCSMRD'.) #4285'sclass_startedit.What moved, and why
Golden masters: 1,054 differences per mode across 147 files. I scoped all of them from a
golden_store export --rev HEAD+deep_compare, not from the truncatedcrucible_checkview.XXXXXnnnnames (198 changes, none toTOor blank);CALL "IC102A"now resolves to IC1024.2.cbl, adding an import edge;COCRDUPC.cbl: line 1530 holds only340000in cols 73-80. It is no longer a code line (coding LOC −1). Doc LOC +1 is the existing accounting (raw non-blank lines minus code), not new comment text.Verification
tests/core_engine/test_cobol_source_format_4264.py(15 tests): directive forms, including negatives (a literal, a comment); detection of fixed, free and the default; fixed blanking with lengths kept; a free line longer than 72 columns kept, by Prism and by_blank_sequence_fields; mixed-with-directive switching; and a free sentence ending past column 72 still ends, so the paragraph after it is found.tests/cobol_mainframe+tests/cics_crucible+ COBOL extraction (strict included) +tests/core_engine+test_golden_store.py: 3,883 passed, 432 skipped. Run withPYTHONPATHset to the worktree: a shared venv otherwise gives spawned pool workers another checkout's code.crucible_check.py --update --yes: both fixtures re-blessed, scoped as above.found_by: review(like D035), fieldsdata moves,CALL USING,DD names; report regenerated. D041 / D042 are taken by Fix #4242: record a quoted PROGRAM-ID (PROGRAM-ID. 'EPSCSMRD'.) #4285 / Fix #4246: an unnamed data description entry is an implicit FILLER #4284, so whichever merges later rebases that file.Not done
*or/in column 7 is rare, and changing that moves comment metrics; it's a follow-up.argsrule's[ \t]{1,4}cap stays, as a defence for raw-text matching.🤖 Generated with Claude Code