Skip to content

det dfsort: a CH key or condition is lowered under the EBCDIC collating sequence (Part of #4268) - #7247

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
churn/4268-20261031T0330Z
Oct 31, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
churn/4268-20261031T0330Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #4268

What

A DFSORT step that compares a CH field (a SORT/MERGE key, or an INCLUDE/OMIT operand) was lowered to COBOL that ran in the oracle's native ASCII order, while DFSORT compares CH by EBCDIC bytes (SC23-6878, #4035). Every proven card (CardDemo TRANREPT, SORTTEST, COMBTRAN) is digit-only or ISO-date, where the two orders agree, so a letter-versus-digit key was unsound and unguarded.

det/dfsort.py now emits PROGRAM COLLATING SEQUENCE IS EB with ALPHABET EB IS EBCDIC for a step that compares CH. The port's Sort.Collating then stops by name where IBM's cp037 and GnuCOBOL's table disagree (register D1). BI is a byte compare the alphabet would reorder, so a step comparing both CH and BI is refused by name.

Evidence (levels, not "proven")

  • Translated: whole, for CH SORT ascending and descending, MERGE, INCLUDE/OMIT against a constant and field against field. Refused: CH+BI in one step (4 shapes).
  • Executed-equivalent: 6 cases (letters, digits, space; 40 records) GnuCOBOL vs the det port byte for byte, 0 diffs, and the oracle output equals an independent Python cp037 model of IBM's order.
  • Stops by name: '-' vs '^' in a key and in an INCLUDE condition.
  • Existing 37 dfsort tests unchanged and green; 433 cobol_mainframe sort/batch/forge tests pass.
  • Assumption: the oracle is GnuCOBOL plus our stub, not z/OS. Residual risk: characters the two EBCDIC tables place differently are refused, not ordered.
  • Gates: pr_gates --fast 9/9, --ratchets 9/9, audit_check clear, pinned ruff format clean.

Class / Sibling gaps

Class: a DFSORT CH comparison lowered without an EBCDIC alphabet (CH key, MERGE CH key, CH vs constant, CH field vs field, OMIT). All covered here; IEBGENER/COPY without a condition compares nothing, so is unaffected.
Sibling gaps: no burned program uses the SORT verbs, so a tests/equivalence/<case> case.json needs a lowered-step case kind in equivalence.py; the CH+BI mix is refused rather than lowered with two collations; VB/U record formats stay refused.

Remaining slices

Checklist: partial [c:2148d504] -- no burned program uses the SORT verbs, so the equivalence case.json form needs a lowered-step case kind in equivalence.py; this slice proves the CH collation of the lowered step against the oracle.

Cross-repo: none.

🤖 Generated with Claude Code

…ng sequence; CH+BI in one step is refused (Part of #4268)

DFSORT compares CH fields by EBCDIC bytes (SC23-6878); the lowered COBOL ran in the oracle's ASCII order, so a
letter-versus-digit key was unsound and unguarded (#4035). The step now carries PROGRAM COLLATING SEQUENCE IS EB, the
port stops by name where the two EBCDIC tables disagree (D1), and a step comparing CH and BI is refused.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 31, 2026 03:56
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 31, 2026 03:57
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit bdf0a2d into main Oct 31, 2026
94 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/4268-20261031T0330Z branch October 31, 2026 04:38
squid-protocol added a commit that referenced this pull request Oct 31, 2026
…ollating sequence, test_det_layout reads a case-local program (Part of #4268)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Oct 31, 2026
…n against the oracle (Part of #4268) (#7251)

* equivalence: a SORT case, CardDemo TRANREPT STEP05R lowered and proven against the oracle (Part of #4268)

program_source may be @case/<file>: a program the case itself carries, as a JCL SORT step lowered to COBOL
(det/dfsort.py) is, since no corpus holds it. One helper, equivalence_common.program_file, adopted by equivalence.py
and det_port.py. The case carddemo-sort-tranrept is GnuCOBOL against the det port over 50 unsorted records (distinct
keys, the INCLUDE keeping and dropping); evidence recorded, mutation pending.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* sort case: merge main, regenerate the lowered program under #7247's collating sequence, test_det_layout reads a case-local program (Part of #4268)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* sort case: commit the port translated from the regenerated program (Part of #4268)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant