Skip to content

COBOL: quoted copybook literals with an extension (COPY "x.cpy".) record no COPY statements, free and fixed format #5618

Closed

Description

@squid-protocol

Problem

COBOL sources that name copybooks with a quoted file literal that includes an extension record zero COPY statements, in both free and fixed format:

      * our own minimal example (fixed format, area B)
           COPY "ws-state.cpy".
      * free format (>>SOURCE FORMAT FREE), column 1
COPY "ws-state.cpy".

Evidence: acherm/agentic-cobol-doom-cc (MIT, 117db757; a COBOL program built by a coding agent for a published study) has 7 such COPY statements in walker.cob and copy_statement_data = 0. A larger internal sample of GnuCOBOL free-format code shows the same (dozens of statements, 0 recorded). Everything else in those scans is healthy (rc=0, paragraphs, call sites, data moves and record fields all extracted), so this is isolated to COPY recognition. Copybook edges drive the dependency graph, blast radius and the copybook layouts.

Likely causes (to confirm)

  • The member name is a quoted literal with a dot and extension ("mapstate.cpy"); patterns that take ({_WORD}+) inside optional quotes (e.g. gitgalaxy/tools/cobol_to_java/det/source.py:652 _COPY) stop at the ..
  • Free format (>>SOURCE FORMAT FREE): COPY in column 1, no sequence/indicator area. Check the section_copies path that feeds copy_statement_data (gitgalaxy/galaxyscope.py:1270) and gitgalaxy/core/mainframe_boundary.py (_COPY_IN_ENTRY, _COPY_LIBRARY).

Class (fix all members, test each)

  • COPY "name.cpy". / COPY 'name.cpy'. (quoted file literal with extension), free and fixed format
  • COPY name. and COPY "name". without extension (regression guard)
  • COPY x OF lib / IN lib, REPLACING ==a== BY ==b== with a quoted member
  • the member resolves to the copybook file in the scanned tree (sprstate.cpy → the .cpy file), so the copybook edge exists
  • indented COPY inside a group item

Acceptance

  • Rescan of acherm/agentic-cobol-doom-cc at 117db757 (clone outside the repo, never commit it): 7 COPY statements recorded, each resolving to its .cpy file.
  • Fixtures (our own code) per shape above, free and fixed format; COBOL goldens and the estate/CICS crucibles show no unintended drift (any drift explained).

Found while extending the DOOM corpus to non-C languages (#5457).

🤖 Generated with Claude Code

Activity

  1. added
    bug
    core-engine
    priority: high
    scope:core
    needs:doom-corpus
    on Oct 19, 2026
  2. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-10-19T14:48Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  3. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Second, independent case: acherm/agentic-cobol-doom-cc (MIT, 117db757; built by a coding agent for a published study) is fixed-format COBOL with COPY "ws-levels.cpy". in area B (column 12): 7 COPY statements in walker.cob, 0 recorded. So the trigger is the quoted name with an extension, in both free and fixed format, not only free format. The acceptance rescan should include this repo too.

    🤖 Generated with Claude Code

  4. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Sibling gaps from PR #5626: (1) a plain COPY of a copybook with its own 01 records before a section's first entry gets a row, but galaxy_ir does not add its records to the layout; (2) plain COPYs attached to an entry stay in record_data.copy_members, so the count matches only for both tables together. Acceptance (cobol_doom rescan at ae3b0e1) still open.

  5. changed the title [-]COBOL: free-format quoted copybook literals (COPY "x.cpy".) record no COPY statements (cobol_doom: ~40 missed)[/-] [+]COBOL: quoted copybook literals with an extension (COPY "x.cpy".) record no COPY statements, free and fixed format[/+] on Oct 19, 2026
  6. added a commit that references this issue on Oct 22, 2026
    d8e642a
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

    bugclaim:nyxcore-engineneeds:doom-corpuspriority: highscope:core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions