Skip to content

det: a wide character in a PROCEDURE DIVISION literal is a statement hole, not a refused program (#4272, #4462) - #4588

Merged
squid-protocol merged 1 commit into
mainfrom
fix/4272-det-national-source
Oct 6, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/4272-det-national-source

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Part of #4272 and #4462 (the #4587 blocker ranking's #1 gap: refused: LayoutError: national / DBCS text (…) is not modelled, 6 non-burned CICS programs, all in one census estate).

What

A UTF-8 em dash (U+2014) inside an alphanumeric literal of the PROCEDURE DIVISION (MOVE '... — ...' TO WS-MSG) refused the whole program before the parser. Now only the statement holding it is a hole, by name; the rest of the program translates.

  • source.unmodelled no longer refuses a character beyond Latin-1 inside a PROCEDURE DIVISION alphanumeric literal (no N / G / NX / U / X prefix), nor in a *> comment (and a *> comment is no longer read as a name by the national-letter check).
  • source.narrowed (called by layout.parse and stmt.parse after unmodelled): such a character becomes the stand-in U+001D, column for column; in a comment, a space. U+001D in the source itself is refused by name, like QQ / HX.
  • gen._statement: a statement whose own text / parts hold the stand-in (a MOVE, an IF's or a WHEN's condition, an EXEC block; not its nested statements) is throw new Hole(...) with WIDE_WHY. The literal never reaches Java.

Why a hole, not a translation (oracle_assumptions D4, new)

Enterprise COBOL reads source in a single-byte EBCDIC page and an alphanumeric literal's length is its bytes in that page. No SBCS EBCDIC page and not Latin-1 (the det runtime's record charset) holds U+2014. So the transfer of the source to the compiler decides the literal, not COBOL: one substitute byte (X'3F'), three bytes (X'E28094', binary transfer / GnuCOBOL on UTF-8), or a failed transfer. The bytes and the length (padding / truncation in the receiver) differ, and even column 72 moves (characters vs bytes). The narrower case is refused by name rather than guessed.

Stays refused whole: the character in a VALUE (lays storage out), in a national / DBCS literal (N'…', G'…', NX'…', U'…': national data, #4272), or in a name.

Evidence

Survey of the affected census corpus (det_survey translation only), before (origin/main) vs after; cics_census.py blockers with the rest of the census / burned surveys unchanged:

before after
translated whole (CICS programs) 69 / 125 (non-burned 13 / 31) 69 / 125 (non-burned 13 / 31)
refused whole (no statement translated) 19 17
*refused: national / DBCS text (only gap, NB) 6 gone
*refused: ExprError: the PROCEDURE DIVISION does not parse (only gap, NB) 5 9
MOVE / STRING wide-literal hole (programs touched) — 2 / 1

No program became whole: of the 7 programs the refusal named, 2 now translate with holes (166 statements / 118 translated; 41 / 38) and 5 now meet their next gap, the PROCEDURE DIVISION does not parse: their source runs past column 72 (a literal cut at column 72 is left unterminated; confirmed independent of the stand-in by parsing with the wide characters replaced by ASCII). The one-away program's other gap is DFHCOMMAREA: no such item. Follow-ups: code past column 72 (a separate refusal by name, or a stated column limit), then those programs' remaining CICS / Db2 holes.

No file of the local mainframe corpora is changed by narrowed (259 files), so no det-sweep case should move.

Checks

  • New tests in tests/cobol_mainframe/test_det_translate.py (importorskip tree_sitter_language_pack; failing first): the hole by name (MOVE, EVALUATE WHEN), still-refused-whole cases (VALUE, N'', G'', a name), a *> comment, the stand-in refused in source. test_det_source_4462.py: the PROCEDURE literal row is now N'漢字' (still refused).
  • Ratchets: ports, port-surface, estate, fact-crosscheck, completeness, ground-truth: all PASS (ports against a cics-crucible v0.5.0 clone).
  • Full pr_gates.py: 7/7 gates pass (lint, audits, secrets, xray, gauntlet, golden, suite). CI green at first check, det sweep included.

🤖 Generated with Claude Code

https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6

…hole, not a refused program (#4272, #4462)

A UTF-8 em dash (U+2014) in an alphanumeric literal of the PROCEDURE DIVISION refused the
whole program before the parser ("national / DBCS text ... is not modelled"). No single-byte
code page holds it, so the literal's bytes and length are what the source's transfer to the
compiler made of it (a substitute byte, or three UTF-8 bytes), not what COBOL says: the
statement holding it (a MOVE, an IF / WHEN condition, an EXEC block) is now a hole by name
(gen.WIDE_WHY) and the rest of the program translates; the grammar is handed a stand-in
(U+001D, source.narrowed) column for column and the literal never reaches Java. A `*>`
comment's wide characters are read. A VALUE, a national / DBCS literal (N / G / NX / U) and a
name stay refused whole (#4272). Recorded as oracle_assumptions D4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 6, 2026 23:22
@squid-protocol
squid-protocol merged commit 73c841c into main Oct 6, 2026
38 of 40 checks passed
@squid-protocol
squid-protocol deleted the fix/4272-det-national-source branch October 6, 2026 23:22
squid-protocol added a commit that referenced this pull request Oct 6, 2026
…lice4

Conflict: det/stmt.py's import list -- kept both cut_literal (this branch) and narrowed (#4588).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6
squid-protocol added a commit that referenced this pull request Oct 6, 2026
…efused by name (#4462 slice 4) (#4590)

* det: listing control, code pointers, JSON / XML and SET TO ENTRY holes; cut literals and copybooks refused by name (#4462 slice 4)

Ranked by `cics_census.py blockers` (the whole-program refusals "PROCEDURE DIVISION does not parse",
"DATA DIVISION does not parse", "paragraph_header does not parse"):

- EJECT, SKIP1/2/3 and TITLE literal (listing control, the only statement on their line) are dropped with the
  comment lines (an EJECT after a paragraph's EXIT; a TITLE before the IDENTIFICATION DIVISION).
- USAGE PROCEDURE-POINTER / FUNCTION-POINTER are laid out as POINTER (8 bytes; oracle_assumptions C9 notes
  IBM's function pointer is 4).
- JSON PARSE / GENERATE, XML PARSE / GENERATE (with their exception phrases) and SET p TO ENTRY x are holes by
  name, so the statements around them translate.
- Refused by name: a literal left open at column 72 with text in columns 73-80 and no continuation (a source
  defect: fixed-form COBOL does not read columns 73-80), and a source with no PROGRAM-ID (a copybook saved as a
  program).

Part of #4462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6

* det: name the cut-literal refusal "source text past column 72" (#4462 slice 4)

The text past column 72 can run beyond column 80 (NexusBank NSTMT-GEN), so the refusal quotes it as text past
column 72, not columns 73-80. It also covers NACC, NDEP, NEXS, NMOD-CUST and NSTMT-GEN once their national-text
refusal (#4588) is lifted.

Part of #4462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant