Skip to content

PL/I record layouts: answer key + blind census (#3727) - #3733

Merged
squid-protocol merged 6 commits into
mainfrom
feat/pli-layouts-census-3727
Sep 26, 2026
Merged

squid-protocol merged 6 commits into
mainfrom
feat/pli-layouts-census-3727

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3727 (item 3 of #3720; epic #3625). Stacked on #3729: merge that first. This PR targets its branch and retargets to main once it merges.

Answer key: pli_layouts

There is one unit per named elementary member of every PL/I structure:

  • ROOT/NAME @offset+bytes;
  • ROOT/NAME @byte.bit+Nb for a member off a byte boundary, such as an unaligned bit string.

It is an independent oracle:

  • It reads the source with the key tool's own PL/I reader, not record_data.
  • It states IBM's structure-mapping rule differently from the engine. The engine shifts pairs; the key tries every start residue and keeps the one with least padding, gap by gap.
  • It reproduces the Language Reference's worked example (Figure 12) exactly, and the UNALIGNED variant.

Roots the key cannot lay out are recorded as skipped, with a reason, and the engine comparator leaves out the same roots:

Tooling: cobol_answer_key.py add-pli-layouts drafts the key and keeps signed-off files.

Census: new plilayouts suite

  • Plan: full while a corpus holds ≤600 units, else a seeded sample. Every construct stratum is covered at least once (bit, varying, binary, decimal, picture, pointer, aligned, unaligned, defined, skipped), plus unkeyed recall files.
  • Reviewers: 8 blind reviewers, each given only brief.md. Before launch, every key unit was round-tripped through grade: 336 units, 0 disagreements.
corpus scope agreed key errors tier
zopeneditor-sample full 27 / 27 0 cross_verified
DSF 14-file sample 309 / 309 0 (95% upper bound 0.97%) sample_verified

One DSF reviewer skipped a structure at the end of a 2,139-line file. A fresh reviewer re-ran that batch and agreed 73/73. The miss was not ruled on by hand.

Ledger

There is a new field, "PL/I layouts". The engine matches the key on every unit: DSF 6,694 / 6,694 and zopeneditor 27 / 27. The ledger is clean.

The key's independent statement of the rules also exposed an engine gap: ALIGNED on a structure must align its bit strings. That fix is on #3729. Neither corpus happens to exercise it.

Field testing registers "PL/I layouts" (introduced #3727, 6 development rounds). It stays open until fresh estates arrive.

Verification

  • Full suite: 11,854 passed.
  • Preflight: all gates pass.
  • New tests:
    • key reader: IBM Figure 12, bits / arrays / DEFINED / skips, drafting;
    • suite: blind brief, round trip, a wrong bit, full and sampled signing, a seeded stratified plan.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

squid-protocol and others added 5 commits September 26, 2026 07:46
New gitgalaxy/tools/cobol_to_cobol/pli_mapping.py maps a PL/I structure by
IBM's structure-mapping rules:
- the deepest minor structures first, each a unit paired left to right;
- the second element of a pair at its first aligned position, then the
  first shifted toward it, so padding falls before the unit;
- ALIGNED / UNALIGNED inherited;
- bit strings bit-packed when unaligned;
- array strides rounded to alignment;
- element widths for CHAR / VARYING, BIT, FIXED DEC, FIXED BIN, FLOAT,
  PICTURE, POINTER and ENTRY / LABEL variables (LP(32)).
It reproduces the Language Reference's worked example ("Offsets in final
mapping of structure A") exactly: all 23 offsets, 80 bytes, and the offset
of 4 from a doubleword boundary.

GalaxyIR:
- record_layout, _storage_spans, _elementary_bytes and _item_class use the
  mapping for PL/I. Unaligned bit fields carry bit_offset / bits.
- LIKE borrows the base structure's members, from the program or its
  %INCLUDE members.
- DSF: 1,744 of 1,792 structures laid out.

Entry points: the PL/I boundary records the external procedure and its
parameters (kind PROCEDURE, like COBOL's PROCEDURE DIVISION USING), for 1,471
DSF files.

The PL/I COMMAREA: program_interfaces basis `parameter`. It is the structure
BASED on the main procedure's pointer parameter, or the parameter itself when
that is a structure. It only applies to programs with CICS evidence: a batch
main procedure's parameter is its PARM. A COMMAREA not found is a
commarea_gap that names the %INCLUDE members the scan could not resolve
(file_data.raw_imports, now EngineFile.includes). On DSF, 386 programs get
KOM_OMR from P0019908 or P0019913, which the public repository lacks.

Java: PL/I fields carry `dialect: pli`, and java_type maps PL/I types:
- FIXED DEC(p,q) -> Integer / Long / BigDecimal;
- FIXED BIN -> Integer / Long;
- FLOAT -> Double;
- prefix-repeat pictures -> numeric types;
- BIT(1) -> Boolean;
- locators -> Long.
DTO and entity comments show the PL/I type and bit position. The record doc
says "PL/I structure". An entity column of unknown width takes the JPA default
instead of crashing.

The fix also corrects a pre-existing defect, D026 in field_testing.json: `PIC
'( 4)9'` was sized as 5 bytes, so both of DSF's COBOL CALLs into PL/I routines
mismatched. Both now pair with every length matching.

Follow-ups: #3727 (answer-key census of PL/I layouts, item 3 of #3720) and
#3728 (%INCLUDE inside a DECLARE).

Closes #3720

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

Both golden-master legs are re-blessed (full-precision and zero-dependency,
each run through the worktree engine). The only drift is the new "Entry
Points" block on 11 PL/I files: the external procedure and its parameters,
now recorded for PL/I. Also removes the unused _TYPE regex and _num helper
from pli_mapping, which CodeQL flagged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
The engine used to treat "no attribute" and "an explicit ALIGNED" on a
structure the same way. So a bit string under an ALIGNED structure stayed
bit-packed: in IBM's example, U BIT(3) got 3 bits instead of its byte. The
inherited alignment is now three-valued (ALIGNED / UNALIGNED / neither).
Only when no enclosing structure says do strings and pictures default to
unaligned and arithmetic to aligned. Found by the #3727 answer key, which
states IBM's rule independently. Neither keyed corpus has a bit string under
an ALIGNED structure, so their layouts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
A new answer-key field, `pli_layouts`, covers every PL/I structure, one unit per
named elementary member:
- `ROOT/NAME @offset+bytes`;
- `@byte.bit+Nb` for a member off a byte boundary (an unaligned bit string).
The key uses the key tool's own PL/I reader and its own statement of IBM's
structure mapping. Rather than the engine's pairwise shifting, it takes the
start residue whose padding (gap by gap) is least, which gives an independent
oracle. It reproduces the Language Reference's Figure 12 exactly, and the
UNALIGNED variant.

The key skips, and records why, structures it cannot lay out: LIKE,
UNION/CELL, REFER, AREA, and an %INCLUDE inside the DCL (#3728). The engine
comparator leaves the same roots out.

New `plilayouts` census suite in cross_verify_sections: full while a corpus
holds 600 units or fewer, else a seeded sample covering every construct
stratum (bit, varying, binary, decimal, picture, pointer, aligned, unaligned,
defined, skipped), with recall files.

Census, by 8 blind brief-only reviewers:
- zopeneditor: 27/27 in full, cross_verified.
- DSF: a 14-file sample, 309/309 units, 0 key errors, 95% upper bound
  0.97%, sample_verified. One reviewer missed a structure at the end of a
  2,139-line file. A fresh reviewer re-ran that batch and agreed 73/73.
- Round-tripped through grade before launch: 336 units, 0 disagreements.

Ledger: new field "PL/I layouts". The engine agrees with the key on every
unit: DSF 6,694/6,694, zopeneditor 27/27. The key's independent statement of
the rules also found an engine gap, fixed on #3729: ALIGNED on a structure
must align its bit strings.

Field testing registers "PL/I layouts" (introduced #3727, 6 development
rounds), so it is open until fresh estates arrive.

Closes #3727

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

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Base automatically changed from feat/pli-layouts-3720 to main September 26, 2026 12:18
…us-3727

# Conflicts:
#	docs/language_status/cics_field_testing.md
@squid-protocol
squid-protocol merged commit 807f7ce into main Sep 26, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the feat/pli-layouts-census-3727 branch September 26, 2026 12:29
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.

PL/I record layouts: answer-key field + census (#3720 part 3)

1 participant