Skip to content

COBOL engine: a sequence-numbered blank line extends the previous unit's extent (cols 1-6 not blanked for slicing, same root as #4300) #4332

Closed

Description

@squid-protocol

Problem

In a fixed-format member with sequence numbers, a line that is empty except for its cols 1-6 sequence number (ISPF keeps the number on a blank line) is not blank in the stream Mode A slices. _slice_by_labels ends a unit at block.strip(), so a trailing "blank" numbered line counts as content. The unit's extent (start_line + loc - 1) then runs over it, up to the line before the next header. A truly blank line or a comment line is trimmed.

Same root as #4300: cols 1-6 are not blanked in the stream the slicer sees.

Evidence

  • Minimal reproducer, main 25f9233. MAIN-PARA is recorded as lines 4-7 and SUB-PARA as lines 8-10. Expected 4-6 and 8-9 (the last code line before the next header):
    000100 IDENTIFICATION DIVISION.
    000200 PROGRAM-ID. SEQBLNK.
    000300 PROCEDURE DIVISION.
    000400 MAIN-PARA.
    000500     PERFORM SUB-PARA
    000600     GOBACK.
    000700
    000800 SUB-PARA.
    000900     DISPLAY 'S'.
    001000
  • The same member with 000700 and 001000 replaced by blank or * comment lines gives 4-6 and 8-9.
  • estate-crucible plants this shape from v0.2.0 (H-0012, Epic: estate-crucible -- a synthetic mainframe estate whose answer key is generated with it #4317). v0.1.0 avoided numbered blank lines.

Impact

Unit LOC and extents are inflated on nearly every numbered legacy member: blank separator lines between paragraphs are the norm. That inflates LOC-based metrics and density, and breaks extent-based joins (an owning_unit(line) lookup on a blank line assigns it to the paragraph above, which is harmless, but span checks against an answer key fail everywhere).

Acceptance criteria

  • A fixed-format line whose cols 7-72 are blank is blank in the slicing stream, whatever cols 1-6 and 73-80 hold.
  • Reproducer: MAIN-PARA 4-6, SUB-PARA 8-9.
  • estate-crucible H-0012 passes.

Related: #4300 (sequence area read as an operand, same root), #4301 / #4315 (unit extents), #4317.

Found by: estate-crucible probe (#4324).

Activity

  1. added
    bug
    core-engine
    legacy-modernization
    on Oct 4, 2026
  2. squid-protocol commented on Oct 4, 2026

    @squid-protocol
    OwnerAuthor

    Fixed on main as a side effect of #4334 (#4300): blanking a numbered sequence area means a line that holds only a sequence number is no longer code, so it can't extend the previous unit. Verified by estate-crucible v0.2.0 horror H-0012, which passes on main 6738204c (scorecard in #4337). Closing as completed by #4334.

  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-enginelegacy-modernizationpriority: mediumscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions