Skip to content

Forge copybook fallback: follow EXEC SQL INCLUDE and COPY … IN <library> #3414

Closed

Description

@squid-protocol

Found by the mainframe ground-truth ledger (tests/tools/ground_truth_ledger.py, cause forge_copybook_resolution).

Problem

The forge's own copybook resolver (cobol_answer_key.old_copybooks → the forge path) misses 17 of 128 hand-verified copybook edges. The engine resolves all 128. Two shapes account for all 17:

shape misses example
EXEC SQL INCLUDE <member> END-EXEC is not treated as a copy 15 (CBSA) BANKDATA.cbl → src/base/cobol_copy/ACCDB2.cpy, CONTDB2.cpy; PROCDB2.cpy from 7 programs
COPY <member> IN <library> is not resolved through the zapp.yaml library 2 (zopeneditor) SAM1LIB.cbl COPY DATETIME IN MYFILE → COPYLIB/DATETIME.cpy, COPY REPTTOTL IN MYLIB → COPYLIB-MVS/REPTTOTL.cpy

Why it matters

When an engine DB is present, the refractor already takes copy_deps from EngineFile, so this only affects the no-DB fallback. That path should still be right: it is what runs on a program scanned without the engine.

Acceptance

  • The 17 forge | copybook paths | … | fn entries in tests/cobol_mainframe/ground_truth_ledger.json stop reproducing. ground_truth_ledger.py check then fails with "no longer reproduces", and update ratchets them out.
  • Fixture tests: one for an EXEC SQL INCLUDE, one for a COPY … IN lib resolved through zapp.yaml.

🤖 Generated with Claude Code

Activity

  1. squid-protocol commented on Sep 23, 2026

    @squid-protocol
    OwnerAuthor

    More evidence from CardDemo (answer key added alongside #3415). The forge's fallback resolver misses 17 more hand-verified copybook edges there. Three more shapes join the two already in this issue:

    shape CardDemo misses
    EXEC SQL INCLUDE of a DCLGEN member (.dcl) AUTHFRDS.dcl (COPAUS2C), DCLTRTYP.dcl ×3, DCLTRCAT.dcl
    EXEC SQL INCLUDE (as in the original report) CSDB2RPY, CSDB2RWY (COTRTLIC)
    quoted member COPY 'CSSTRPFY'. CSSTRPFY in COACTUPC, COACTVWC, COCRDLIC, COCRDSLC, COCRDUPC, COTRTLIC, COTRTUPC
    COPY CSSETATY REPLACING … / a COPY whose period is on a later line CSSETATY (COACTUPC, COTRTUPC), CSUTLDPY (COACTUPC)

    The engine resolves the quoted and REPLACING forms. It misses the one-line EXEC SQL INCLUDE (#3416) and one excluded data-only copybook (#3417).

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

    enhancementNew feature, sensor, or structural signature

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions