Repository navigation
Description
Problem
A COBOL program may start executing statements right after PROCEDURE DIVISION., before any paragraph or section header. Batch programs do this routinely: they open the files, loop, close and GOBACK. Mode A slicing only creates units at func_start matches. Unlike Python's __global_context__, COBOL gets no synthetic top-level slice: synthetic_unit_data has 0 rows across the whole mainframe crucible. The entry code's PERFORM and CALL targets therefore appear in no calls_out_to, and the paragraphs it drives have no caller.
Evidence (language-crucible v1.7.0; main 737cab8 and #4290 head identical)
22 files and 143 PERFORM/CALL sites. 12 of the files are in answer-keyed repos.
aws-mainframe-modernization-carddemo/CBACT01C.cbl:70-91:PERFORM 0000-ACCTFILE-OPEN(72),1000-ACCTFILE-GET-NEXT(76) and9000-ACCTFILE-CLOSE(83) are lost. Same in CBACT02C/03C/04C (18 sites), CBCUS01C, CBTRN02C (16) and CBTRN03C (21).zECS/ZECS000.cbl:238-243,ZECS003.cbl:177-183,ZECSPLT.cbl:66-71,ECS001.cbl:82-89.Z-SMS-Gateway/MESSAGES.cbl(9 sites),BALANCE.cbl,HISTORY.cbl;cash-account-cobol/CASH00.cbl:91-101;cobol-programming-course/EMPPAY.CBL:20-23,DEPTPAY.CBL;cobol-check/TESTPRG.CBL,src_main_cobol_FileCopy.cbl;gnucobol/tutorial.cob(11).- Minimal repro
REPRO1.cbl(below):PERFORM ENTRY-TARGET/PERFORM MAIN-PARAright after PROCEDURE DIVISION produce no row anywhere.
Impact
The top of every such program's call tree is missing. Paragraphs reached only from the main line have fan-in 0 in the function graph. Any reachability, dead-code or translator cross-check (#4273) that uses calls_out_to sees them as unreached.
Acceptance criteria
- Code before the first header becomes a unit, or a synthetic calls-only slice recorded in synthetic_unit_data like Python's module level, per PROCEDURE DIVISION (nested and sibling programs included)
- Its PERFORM / CALL / GO TO targets are recorded
- CBACT01C's three edges, and the repro, appear
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
COBOL: record each PROCEDURE DIVISION's entry code as a calls-only un…
Answer keys: score unit extents and intra-program PERFORM / GO TO edg…
COBOL: the main line is a function_data unit named after its PROGRAM-…