Skip to content

det-port: SORT / MERGE / RELEASE / RETURN and SD files (#4268) - #4286

Merged
squid-protocol merged 5 commits into
mainfrom
feat/4268-sort-merge
Oct 4, 2026
Merged

squid-protocol merged 5 commits into
mainfrom
feat/4268-sort-merge

Conversation

@squid-protocol

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

Copy link
Copy Markdown
Owner

Part of #4268 (the COBOL side; JCL utility steps are not covered here, so the issue stays open).

The det translator had no parser for the sort verbs, so each one became a hole. They now translate onto a new runtime class, cobolrt/Sort (additive):

  • SORT: KEY phrases, WITH DUPLICATES, COLLATING SEQUENCE NATIVE / STANDARD-1, USING / GIVING, INPUT / OUTPUT PROCEDURE
  • MERGE: USING / GIVING / OUTPUT PROCEDURE
  • RELEASE [FROM] and RETURN [INTO] with AT END
  • the SORT-RETURN special register, and SD file descriptions (fd_entries gains an sd flag)

What IBM leaves open is refused by name rather than guessed.

Proof: SORTIP and SORTUG in tests/cobol_mainframe/test_det_programs.py match GnuCOBOL's output byte for byte, in typed and groups modes.

Follow-ups in this PR:

  • mypy: _sort_io_file returns the checked record, so giving_file no longer reads .size off an optional.
  • dead-key audit: SORT-RETURN allowlisted. The literal lookup checks whether a program declares an item that shadows the special register; nothing writes that key by design.
  • test_varrec_cobdatft.py expects the new sd flag.

🤖 Generated with Claude Code

The det translator had no parser for the sort verbs, so each became a hole.
Now SORT (KEY phrases, WITH DUPLICATES, COLLATING SEQUENCE NATIVE /
STANDARD-1, USING / GIVING, INPUT / OUTPUT PROCEDURE), MERGE (USING /
GIVING / OUTPUT PROCEDURE), RELEASE [FROM], RETURN [INTO] with AT END and
the SORT-RETURN register translate onto a new runtime class cobolrt/Sort
(additive). What IBM leaves open is refused by name.

Proof: SORTIP and SORTUG in test_det_programs.py equal GnuCOBOL's output
in the bytes, typed and groups modes.

Part of #4268

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013sNMtAg6s9dyyjNgnjRHi8
@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 and others added 4 commits October 4, 2026 08:04
…TURN dead key

- _sort_io_file now returns (fd, record) with the record already checked
  non-None, so using_file/giving_file use a non-optional L.Item instead of
  fd.record (Item | None) -- fixes gen.py union-attr on `.size`.
- dead_key_audit: allowlist "SORT-RETURN". Gen.items is keyed by the
  program's own parsed COBOL data names; the literal lookup checks whether
  the program declares an item that shadows the SORT-RETURN special
  register. No in-repo writer exists by design (walker false positive).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
fd_entries now records whether a file description is an SD
(sort-merge file). The RECORD VARYING test compared against the old
two-key dict, so full-suite failed on it; add `"sd": False` for both
FDs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol squid-protocol changed the title WIP: det-port SORT / MERGE / RELEASE / RETURN (#4268) det-port: SORT / MERGE / RELEASE / RETURN and SD files (#4268) Oct 4, 2026
@squid-protocol
squid-protocol marked this pull request as ready for review October 4, 2026 12:47
@squid-protocol
squid-protocol merged commit d410952 into main Oct 4, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the feat/4268-sort-merge branch October 4, 2026 12:48
squid-protocol added a commit that referenced this pull request Oct 4, 2026
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]>
squid-protocol added a commit that referenced this pull request Oct 4, 2026
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]>
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.

1 participant