Repository navigation
det: EXEC SQL WHENEVER SQLERROR / NOT FOUND / SQLWARNING (Part of #4269) - #5338
Conversation
…d GO TO (Part of #4269) WHENEVER is lexically scoped in source order; after each executable EXEC SQL statement the SQLCA is tested in IBM's order (SQLERROR, NOT FOUND, SQLWARNING) and the GO TO taken. A program with WHENEVER ... GO TO is dispatch-style. The SQLCA reads are inline in the generated code, so DetSql.java and all 120 ports are unchanged. The oracle precompiler mirrors the semantics. Proved on Db2 by a synthetic estate (WHENDEMO): no burned estate uses WHENEVER. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No description provided. |
1 similar comment
|
No description provided. |
|
PR #5338 @ b81bb63: 2 failed check(s) == ground-truth (failure) -- real == ground-truth part 1/2 (failure) -- real |
…HENEVER SQLERROR STOP (Part of #4269) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
CI shepherd: the head of this PR (3c851d8) is not the one a maintainer labelled |
|
No description provided. |
|
No description provided. |
Part of #4269 (next unchecked item: WHENEVER).
What changed
det/sql.py:EXEC SQL WHENEVER {SQLERROR|NOT FOUND|SQLWARNING} {CONTINUE|GO TO label}. Scoped in source order; after each executable EXEC SQL statement the SQLCA is tested in IBM's order (SQLERROR<0, NOT FOUND+100, SQLWARNING SQLWARN0=Wor another positive SQLCODE). Unknown label, a shared source line under another WHENEVER, and any other action (PERFORM, STOP, ...) are refused by name.det/program.py: a WHENEVER ... GO TO forces dispatch style (like HANDLE).DetSql.javais untouched,det_port.py checkreports 120/120 ports unchanged.tests/tools/equivalence_sql.py: the oracle precompiler mirrors the semantics (fixed-format, one clause per line).Proof (evidence level)
Translated whole, no holes. No burned estate uses WHENEVER (grep of the burned corpora), so the proof is a synthetic Db2 estate
tests/equivalence/db2/whenever(WHENDEMO): NOT FOUND and SQLERROR branches taken, CONTINUE cancelling them, SQLWARNING on a truncated CHAR. Executed-equivalent on Db2 withEQUIVALENCE_E2E=1, trace pinned (IBM SQLCODEs 100, -803, SQLWARN0). Oracle is GnuCOBOL plus our stub, not z/OS.Gates
pr_gates --fast6/6,--ratchets8/8,test_sql_whenever.py12 + e2e passed. Golden not run: no scanned-engine parsing change.Sibling gaps (still refused; no burned estate needs them)
PREPARE / EXECUTE / EXECUTE IMMEDIATE / DESCRIBE; EXEC SQL CALL; CONNECT; scroll FETCH PRIOR/ABSOLUTE/RELATIVE; multi-row FETCH/INSERT arrays; DSNTIAR/DSNTIAC (Q5). ROLLBACK already landed (#4729).
Lessons for agents
:WS-IDbecame:WS-I, a "no parameter" hole). Wrap generated or hand-written COBOL.det_port check; emit small SQLCA reads inline in generated code instead.🤖 Generated with Claude Code