Skip to content

Fix #4246: an unnamed data description entry is an implicit FILLER - #4284

Merged
squid-protocol merged 1 commit into
mainfrom
fix/4246-implicit-filler
Oct 3, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/4246-implicit-filler

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Resolves #4246.

What was broken

2 PIC X(40) USAGE DISPLAY VALUE '...' (IBM DBB MortgageApplication EPSCSMRD, lines 24 / 27 / 30) has no name, and COBOL makes such an entry an implicit FILLER. Both readers took the clause keyword sitting where the name goes for the name, then read the entry's clauses starting after it:

  • Engine (record_data): item_name='PIC', no PIC.
  • Answer key (_data_items): name='PIC', pic=None. The key's layout arithmetic sizes an item from its PIC, so the item took no storage and every field after it moved up.

Changes

  • mainframe_boundary._cobol_records: when the first word after the level number is a clause keyword, the entry is named FILLER and its clauses are read starting at that word. The keywords are PIC / PICTURE / USAGE / VALUE(S) / OCCURS / SIGN / LEADING / TRAILING / JUST(IFIED) / BLANK / SYNC(HRONIZED) / EXTERNAL / GLOBAL and the usages (COMP…, BINARY, PACKED-DECIMAL, DISPLAY(-1), NATIONAL, INDEX, the POINTERs). These are reserved words, so none of them can be a data name.
  • _cobol_value_map: such an entry's VALUE is assigned to no name, so PIC can never resolve as a CALL target.
  • cobol_answer_key._data_items: the same rule, implemented separately (_DD_UNNAMED).
  • The refraction forge (cobol_schema_forge.data_entries) already handled this through its _CLAUSE_WORDS, so it is not touched.
  • field_testing.json: defect D042 (record fields, DBB round 7); report regenerated. The COBOL engine: no PROGRAM-ID recorded for PROGRAM-ID. 'EPSCSMRD'. (quoted name, column 9) #4242 PR uses D041, so whichever PR merges second rebases that file and re-runs field_testing.py report --write.

Golden masters (why the output changed)

Re-blessed with crucible_check.py --update --yes. Only 10_mainframe_system_facts/record_layout.json moved, and the full-precision and zero-dependency fixtures are byte-identical. I diffed every entry against HEAD: 41 entries in 3 crucible files, and all of them are this fix.

  • che-che4z_lsp_project_fixtures/special_schema.cbl, gnucobol/CBL_OC_DUMP.cob and gnucobol/xfhfcd3.cpy.
  • 40 entries go from a PIC-named, PIC-less item to FILLER with its PIC (xx, x, …).
  • 1 unnamed OCCURS 16 group becomes FILLER and gains its count.
  • No other key, file or section moved.

Not done

Verification

  • New tests: test_data_division.py adds three (named vs unnamed entries in the EPSCSMRD shape, value map, and names that only start with a clause word such as PIC-CODE, VALUE-DATE, COMP-RATE, INDEX-NO). The key test checks the items and that copybook_record_units lays out after the FILLERs. The three tests that exercise the bug fail on origin/main.
  • Real file: epscsmrd.cbl @ ce2c1be5 now reads lines 24 / 27 / 30 as FILLER X(40) / X(35) / X(31) USAGE DISPLAY in both the engine and the key. No item named PIC is left.
  • tests/cobol_mainframe, tests/core_engine, tests/extraction: 13001 passed, 452 skipped, 9 xfailed, 3 xpassed.
  • Ground-truth ledger (mainframe_corpus.py fetch, then ground_truth_ledger.py check): clean, with 0 of 10 mismatches open (all the deliberate orphaned_logic reports 100% dead code for five languages whose invocation model never names the callee — the family #2727 closed without covering #2806 cause).
  • ruff / mypy / dead-key audits report nothing new; ruff format is clean.

🤖 Generated with Claude Code

`2 PIC X(40) USAGE DISPLAY VALUE '...'` (IBM DBB EPSCSMRD L24/27/30) has no
name: COBOL makes it an implicit FILLER. Both the engine and the answer key
took the clause keyword in the name's place for the name and read the entry's
clauses from after it, so the item was named PIC and lost its PICTURE (and,
in the key's layouts, its storage -- every field after it moved up).

- mainframe_boundary._cobol_records: a first word that is a clause keyword
  (PIC / PICTURE / USAGE / VALUE(S) / OCCURS / SIGN / JUSTIFIED / BLANK /
  SYNC / EXTERNAL / GLOBAL / a usage) names the entry FILLER, and its clauses
  are read from that word. _cobol_value_map gives such an entry's VALUE to no
  name.
- cobol_answer_key._data_items: the same rule, implemented on its own.
- Golden masters re-blessed: 41 record-layout entries in 3 crucible files
  (special_schema.cbl, CBL_OC_DUMP.cob, xfhfcd3.cpy) move from a PIC-named,
  PIC-less item to FILLER with its PIC (one unnamed OCCURS 16 group gains its
  count). Nothing else moves.
- field_testing.json: defect D042 (record fields, DBB round 7).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit d66f737 into main Oct 3, 2026
40 checks passed
@squid-protocol
squid-protocol deleted the fix/4246-implicit-filler branch October 3, 2026 21:49
squid-protocol added a commit that referenced this pull request Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COBOL: unnamed elementary item (2 PIC X(31) ..., implicit FILLER) is read as a field named PIC

1 participant