Repository navigation
Description
Problem
detector._slice_by_labels (Mode A, used for COBOL and PL/I) cuts each unit at the last match of assembly_returns (\b(?:...|RETURN|...|GOBACK|EXIT)\b) that starts a line. That is right for assembler, wrong for COBOL/PL/I, where these words are often conditional or not terminators at all. Everything after the cut is outside every unit: its calls_out_to, transfers_to, LOC and complexity are lost. Three shapes in the crucible:
- Conditional terminator --
IF ... GOBACK END-IFthen more statements; a CICSRETURN TRANSID(...)on its own continuation line inside anIF; PL/IELSE RETURN;. - Paragraph name that starts with the word --
RETURN-TO-PREV-SCREEN.:\bRETURN\bmatches at the header itself (-is a word boundary), so the unit is cut to its header line. EXIT PERFORM/EXIT PARAGRAPH/EXIT SECTIONmid-body.
Evidence (language-crucible v1.7.0, main 737cab8 and #4290 head, identical)
- Shape 1, CBSA (keyed corpus), 12 files, 553 code lines and 39 PERFORM edges outside any unit:
UPDCUST.cblA010 (138) ends at theGOBACKat 194;PERFORM UPDATE-CUSTOMER-VSAM(200) andPERFORM GET-ME-OUT-OF-HERE(205) are lost. This is COBOL engine: UPDCUST records no PERFORM edges #4283. The file has no PERFORM edges at all.CRECUST.cblP010 ends at theGOBACKat 411; 9 PERFORMs (422-476, incl. CREDIT-CHECK and WRITE-CUSTOMER-VSAM) are lost.BANKDATA.cblA010 ends at 406; 165 code lines and 8 PERFORMs are lost.BNK1CAC/CCA/CCS/CRA/DAC/DCS/TFN/UAC.cblandBNKMENU.cbl: A010 ends at theRETURN TRANSID('Oxxx')continuation line;POPULATE-TIME-DATE/ABEND-THIS-TASK/RESTORE-TERM-DEFare lost.- PL/I: DSF
R0010422-R0010425.pliKONTROLL_AV_INPUTends atELSE RETURN;(R0010422:315);CALL SEND_MAPat :322 is lost.
- Shape 2, CardDemo (keyed corpus), 11 files:
RETURN-TO-PREV-SCREEN/RETURN-TO-SIGNON-SCREEN/RETURN-TO-CICS(e.g.COBIL00C.cbl:273,COADM01C.cbl:160) have loc 1. The body (MOVE,EXEC CICS XCTL) is outside the unit. - Shape 3:
gnucobol/CBL_OC_DUMP.cob:239exit performcuts MAIN00. - Minimal repro (
REPRO1.cbl(below)): MAIN-PARA has loc 3 andcalls_out_to = [], against 4 real callees. RETURN-TO-MENU has loc 1. LOOP-PARA is cut atEXIT PERFORM.
Why the answer key did not catch it
The key scores unit names and lines, never spans or edges, so the units are "correct" while their bodies are dropped.
Acceptance criteria
- COBOL and PL/I units run to the next unit header (or END PROGRAM / END proc), not to the last terminator keyword
- Or, if a terminator cut is kept for assembler: COBOL and PL/I opt out through
_NON_TERMINATING_KEYWORDS_BY_LANG, and a match inside a hyphenated name is rejected at line start too - Repro and the CBSA/CardDemo/DSF files above get their edges; COBOL engine: UPDCUST records no PERFORM edges #4283 closes
- A span/edge check in the answer-key score, so this class is visible
Found during: crucible mainframe count audit (2026-10-04)
Reproducer
REPRO1.cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. REPRO1.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-FLAG PIC X VALUE 'N'.
01 WS-I PIC 9(4) COMP VALUE 0.
PROCEDURE DIVISION.
PERFORM ENTRY-TARGET
PERFORM MAIN-PARA
GOBACK.
MAIN-PARA.
IF WS-FLAG = 'Y'
GOBACK
END-IF
PERFORM AFTER-GOBACK-TARGET
CALL 'SUBPGM1'
PERFORM RETURN-TO-MENU
PERFORM LOOP-PARA.
RETURN-TO-MENU.
MOVE 'Y' TO WS-FLAG
PERFORM IN-RETURN-PARA-TARGET.
LOOP-PARA.
PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I > 5
IF WS-I = 3
EXIT PERFORM
END-IF
DISPLAY WS-I
END-PERFORM
PERFORM AFTER-EXIT-PERFORM-TARGET
PERFORM TEST AFTER VARYING WS-I FROM 1 BY 1
UNTIL WS-I > 2
DISPLAY WS-I
END-PERFORM.
ENTRY-TARGET.
DISPLAY 'E'.
AFTER-GOBACK-TARGET.
DISPLAY 'A'.
IN-RETURN-PARA-TARGET.
DISPLAY 'R'.
AFTER-EXIT-PERFORM-TARGET.
DISPLAY 'X'.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
Ledger: BNK* A010 now unreferenced by name once its own tail is insid…
COBOL/PL/I units run to the next header, not the last GOBACK/EXIT/RET…