Repository navigation
COBOL: a CALL inside EXEC ... END-EXEC is not a COBOL CALL (#4304) - #4374
Merged
Merged
Conversation
`EXEC SQL CALL MYSCHEMA.GETCUST (:WS-A)` is a DB2 stored-procedure call, which sql_statement_data already records. Both COBOL CALL readers scanned EXEC blocks too. mainframe_boundary recorded `CALL / identifier / MYSCHEMA` in call_site_data, and the calls_out rule put MYSCHEMA / UPDPROC in calls_out_to. Both now skip a CALL inside any EXEC ... END-EXEC block (SQL, CICS, DLI, ...). A block never runs across another EXEC, so a lost END-EXEC hides nothing after it. The detector honours a new per-language `_calls_out_masked_blocks` pattern. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
…4304) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
squid-protocol
marked this pull request as ready for review
October 4, 2026 23:43
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4304
What was broken
mainframe_boundary._CALL_LITERAL/_CALL_IDENTIFIERand the cobolcalls_outrule scanned the whole code stream, EXEC blocks included. A DB2 stored-procedure call therefore became a COBOL program call:EXEC SQL CALL MYSCHEMA.GETCUST (:WS-A) END-EXECgave call_site_dataCALL / identifier / MYSCHEMAand calls_out_toMYSCHEMA. The procedure name was lost; only the schema was kept.EXEC SQL CALL UPDPROC END-EXECgaveCALL / identifier / UPDPROC.sql_statement_data already recorded both, correctly, as verb
CALL.The fix
A CALL inside any
EXEC <x> ... END-EXECblock (SQL, CICS, DLI, ...) belongs to that block:mainframe_boundary._cobol_callsskips a CALL match inside an_EXEC_BLOCKspan. EXEC CICS LINK/XCTL are read by their own pass and are unaffected._calls_out_masked_blocks(cobol only), beforefindall. Line breaks are kept.A block never runs across another
EXEC. So an EXEC with no END-EXEC before the next EXEC is not masked (the old reading), and a lost END-EXEC never hides the CALLs after it. This case is pinned by a test.The optional acceptance item, carrying the procedure name on sql_statement_data, is not done here.
Evidence
tests/extraction/languages/test_cobol_exec_sql_call_4304.py(both tests fail on main). On the REPRO7 shape plus controls:CALL 'REALSUB',CALL WS-PGMandEXEC CICS LINK PROGRAM('CICSPGM')are kept;EXEC SQL CALL NOENDis left as before;REALSUB,WS-PGM,WORK-PARA.A real scan (
galaxyscope --db-only) of REPRO7 givescall_site_data0 rows,sql_statement_dataCALL ×2, andcalls_out_to[].Estate-crucible v0.3.0 (main → this branch)
Nothing else moves.
Golden masters
crucible_check.py --update --yesagainst the siblinglanguage-cruciblev1.7.0 (merged with main e4ada9d): no drift in either leg. As the issue says, the crucible has noEXEC SQL CALL.Ground-truth ledger
update: no change.check: clean.Local checks
tests/cobol_mainframe,tests/extractionandtests/core_engine(pinned corpora): 13,236 passed.mypy_audit/ruff_audit(0.16.0) /dead_key_audit --cireport nothing new.test_national_namespasses: the EXEC patterns use\wclasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo