Skip to content

COBOL engine: a section-level COPY ... REPLACING is not applied to the copied 01 records (misnamed or missing) #4457

Closed

Description

@squid-protocol

Problem

A section-level COPY member REPLACING ... (one that copies whole 01 records) is not applied to the records GalaxyIR builds for the program. The records either keep the copybook's names, or, for a pseudo-text template copybook (:TAG:), do not exist at all. In-group REPLACING was fixed by #4265; this is the remaining case.

Evidence (engine origin/main e3ace8a, found by the #4273 engine-vs-translator cross-check)

  • CBSA src/base/cobol_src/INQACC.cbl:199 COPY INQACC REPLACING INQACC-COMMAREA BY DFHCOMMAREA. → the engine's record is INQACC-COMMAREA (the program's PROCEDURE DIVISION USING DFHCOMMAREA names a record the engine does not have under that name). The translator, the answer key and the compiler call it DFHCOMMAREA.
  • CBSA GETSCODE.cbl:28 COPY SORTCODE REPLACING ==SORTCODE== BY ==LITERAL-SORTCODE==. → engine record SORTCODE, should be LITERAL-SORTCODE.
  • zopeneditor-sample COBOL/SAM1.cbl:61,67,131 COPY CUSTCOPY REPLACING ==:TAG:== BY ==CUST== (and CSTOUT, WS-CUST): GalaxyIR has no CUST-REC, CUST-CONTACT-REC, CSTOUT-REC, CSTOUT-CONTACT-REC, WS-CUST-REC or WS-CUST-CONTACT-REC at all (ef.records lists none; ef.section_copies holds one CUSTCOPY entry for three COPYs). Same in SAM1LIB.cbl, SAM2.cbl, multiroot/sam/SAM1.cbl, multiroot/sam/SAM2.cbl: 22 records, 275 fields with no engine layout.

Impact on a real estate

Record layouts, COMMAREA contracts and lineage for these programs are missing or misnamed, silently. A consumer of record_layout (the det translator, if it took engine layouts) would build on a record that does not exist.

Acceptance criteria

  • A section-level COPY REPLACING yields the replaced records in EngineFile.records (names, offsets) for both the ==pseudo-text== and the word forms.
  • The fact cross-check ledger (tests/cobol_mainframe/fact_crosscheck_ledger.json, cause engine-section-copy-replacing) loses these entries (fact_crosscheck.py update).

Out of scope

In-group REPLACING (#4265, fixed).

Found during: #4273 engine-vs-translator fact cross-check (PR #4456)

🤖 Generated with Claude Code

Activity

  1. added
    bug
    core-engine
    data-integrity
    legacy-modernization
    on Oct 5, 2026
  2. added 2 commits that reference this issue on Oct 5, 2026
  3. added
    scope:sweep
    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

    bugcore-enginedata-integritylegacy-modernizationpriority: mediumscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions