Skip to content

carddemo-intcalc-generated: duplicate alternate-key pick differs (ASCII load order vs IBM's EBCDIC prime-key order) #4876

Closed

Description

@squid-protocol

carddemo-intcalc-generated (CBACT04C on generated inputs) is expected-unproven in tests/equivalence/det_sweep_baseline.json with no issue: "generated card numbers mix letters and digits: ASCII vs EBCDIC key order picks different duplicates (oracle_assumptions.md D1)".

Evidence (origin/main 0ad5dba, det_port.py run carddemo-intcalc-generated): RETURN-CODE 0/0, ACCTFILE 30/30, SYSOUT 58/58 equal; TRANSACT 26/37 records equal, the 11 differences all TRAN-CARD-NUM (COBOL 3IFTJYIT2RXYGKVU, Java LH5XTMG5LZYJEFY3; 9ONHYE5S9ZPZBXD4 vs BR6E1DHT7JWVOQOV; ...).

Cause. XREFFILE has an ALTERNATE KEY (XREF-ACCT-ID) WITH DUPLICATES; CBACT04C reads it by account and takes the first record. Several generated cards share an account, and the card number is a PIC X(16) of random letters and digits. The oracle (GnuCOBOL BDB, measured: neither PROGRAM COLLATING SEQUENCE IS EBCDIC nor any cobc 3.1.2 flag changes an indexed file's key order; -fdefault-colseq does not exist) returns duplicates in insertion order, and the harness loads the file sorted in ASCII (equivalence_inputs.generate_dataset), so the first duplicate is the lowest ASCII card number (digits before letters). The det runtime's DetFiles.Indexed orders in cp037 as VSAM does (letters before digits), so its first duplicate is the lowest EBCDIC card number. Not a translator bug: the two sides differ in an order D1 already registers (keys: "Keys mixing letters and digits would not [sort the same]").

IBM reference. z/OS returns the pointers of a non-unique alternate key in prime-key order (KSDS, an index built over the loaded base cluster), and the prime keys sort in EBCDIC. So the proof should compare IBM's pick.

Plan. The oracle cannot sort a BDB key in EBCDIC, but it keeps duplicates in the order they were loaded. So generate the indexed inputs in cp037 order of the primary key (the det side already sorts that way): both sides then give IBM's first duplicate. The oracle's primary-key browse order stays ASCII for such keys (D1 stays registered; this case never browses XREFFILE by primary key, and the TRANSACT output order is the program's). Document in D1; re-prove the five @generate cases.

Acceptance: carddemo-intcalc-generated proves (all records equal), baseline entry removed or re-pointed at the remaining cause (coverage: 49/86 branches, 2 paragraphs, is a separate matter if it blocks).

Activity

  1. added
    bug
    testing
    legacy-modernization
    on Oct 11, 2026
  2. added
    scope:core
    era:2
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugera:2legacy-modernizationpriority: mediumscope:coretesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions