Repository navigation
PL/I record layouts: answer key + blind census (#3727) - #3733
Merged
Merged
Conversation
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
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
Contributor
…us-3727 # Conflicts: # docs/language_status/cics_field_testing.md
This was referenced Sep 26, 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.
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_layoutsThere is one unit per named elementary member of every PL/I structure:
ROOT/NAME @offset+bytes;ROOT/NAME @byte.bit+Nbfor a member off a byte boundary, such as an unaligned bit string.It is an independent oracle:
record_data.Roots the key cannot lay out are recorded as
skipped, with a reason, and the engine comparator leaves out the same roots:%INCLUDEinside the DCL (PL/I: %INCLUDE inside a DECLARE is not expanded into the structure #3728).Tooling:
cobol_answer_key.py add-pli-layoutsdrafts the key and keeps signed-off files.Census: new
plilayoutssuitebrief.md. Before launch, every key unit was round-tripped throughgrade: 336 units, 0 disagreements.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
🤖 Generated with Claude Code
https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g