Skip to content

COBOL engine: a cols 1-6 sequence number is read as the operand when PERFORM / GO TO / CALL / COPY continues on the next line #4300

Closed

Description

@squid-protocol

Problem

In fixed-format source with numbered sequence areas (ISPF NUMBER ON STD, the norm for members pulled from a PDS), a verb whose operand starts on the next line records the next line's sequence number as the operand:

statement channel engine records should be
PERFORM / INIT-PARA function_data.calls_out_to 000900 INIT-PARA
GO TO / END-PARA. function_data.transfers_to 001000 END-PARA
CALL / 'SUBPGM1' calls_out_to / call_site_data 001100 / no row at all literal SUBPGM1
CALL / WS-PGM calls_out_to / call_site_data 001300 / no row identifier WS-PGM
COPY / CPYA. file_data.raw_imports / edge_data ["000600"], no import edge CPYA, edge to CPYA.cpy

Cause: the readers run on a stream where cols 73-80 are (after #4290) blanked but cols 1-6 are not, and their operand separators cross \n (cobol.py calls_out \s+, _transfers_out \s+, _dependency_capture [ \t\n]+), so the separator swallows the newline and the next token is the sequence number. mainframe_boundary._CALL_LITERAL / _CALL_IDENTIFIER need a letter or quote, so they match nothing and the CALL site is silently dropped.

Evidence

Impact on a real estate

Split operands are a minority shape, but sequence numbers are on nearly every legacy member. Each hit gives a phantom callee or GO TO target, a lost CALL edge (call graph, unresolved-call report) or a lost COPY edge (copybook dependency, popularity -> possible zero-density relegation of the copybook).

Acceptance criteria

  • Sequence area (cols 1-6) of fixed lines is blank in the stream the calls_out / _transfers_out / _dependency_capture rules and the mainframe_boundary CALL readers see (or the separators skip it)
  • Repro: split PERFORM, GO TO, CALL literal, CALL identifier and COPY each read the real operand; split CALL produces a call_site_data row
  • NIST NC1344.2 / DB1024.2 / DB1034.2 targets become TST-21 / PASS / FAIL

Found during: crucible mainframe count audit (2026-10-04)

Reproducer

REPRO4.cbl

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. REPRO4.
000300 DATA DIVISION.
000400 WORKING-STORAGE SECTION.
000500 01  WS-PGM                 PIC X(8) VALUE 'SUBPGM2'.
000600 PROCEDURE DIVISION.
000700 MAIN-PARA.
000800     PERFORM
000900         INIT-PARA
001000     CALL
001100         'SUBPGM1'
001200     CALL
001300         WS-PGM
001400     STOP RUN.
001500 INIT-PARA.
001600     DISPLAY 'I'.

REPRO5.cbl

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. REPRO5.
000300 DATA DIVISION.
000400 WORKING-STORAGE SECTION.
000500     COPY
000600         CPYA.
000700 PROCEDURE DIVISION.
000800 MAIN-PARA.
000900     IF CPYA-FLAG = 'Y' GO TO
001000         END-PARA.
001100     STOP RUN.
001200 END-PARA.
001300     STOP RUN.

Found by a grep-vs-engine count audit of every mainframe file in language-crucible v1.7.0 (802 of 815 files compared), on main 737cab8 and the #4290 head (now merged as c136f46).

Activity

  1. added
    bug
    core-engine
    legacy-modernization
    priority: high
    on Oct 4, 2026
  2. added a commit that references this issue on Oct 5, 2026
  3. added
    scope:sweep
    era:1
    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-engineera:1legacy-modernizationpriority: highscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions