Repository navigation
COBOL translator: rowset FETCH with host-variable arrays, proven on Db2 (Part of #4269) - #7093
Merged
Merged
Conversation
…#4269) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
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.
Part of #4269
What
Multi-row (ROWSET) FETCH with host-variable arrays in the det port, proven on the Db2 oracle:
FETCH [NEXT] ROWSET FROM c FOR n ROWS INTO :A1 [:I1], :A2against a cursor declaredWITH ROWSET POSITIONING. One OCCURS table per column, optional indicator tables.det/sql.py: parses the form, emitsDetSql.fetchRowset+DetSql.intoRows; a cursor not declared WITH ROWSET POSITIONING, SENSITIVE/DYNAMIC, a count above the smallest table or below 1 are refused by name. OCCURS host variables outside a rowset FETCH are refused (register Q4).DetSql.java: runtime (RT-SQL-ROWSET-FETCH). A rowset reaching end of data is +100 with SQLERRD(3) = rows read, a full rowset is 0, zero rows is +100, a closed cursor is -501.ggsql.cloopsSQLFetchn times into strided arrays;equivalence_sql.pyPrecompiler emitsNAME OF QUAL (1)and the rowset token._CURSOR_FORlearnsWITH ROWSET POSITIONING(without it the DECLARE text leaked into the query).test_sql_dynamic.pyincl. an inline ROWDEMO estate proved on Db2 (full, short and empty rowsets, a NULL column, a closed cursor).Evidence
det_port.py check: no translated program changed; the only diff isDetSql.java(additive) in 82 ports. All 82 re-proved: 82 PROVED, 0 not.pr_gates --fast9/9,--ratchetsall pass,audit_check.pyclear,ruff format --checkclean,test_cobolrt_rules+test_sql_dynamic172 passed.Plan changes
The plan said a partial rowset is SQLCODE 0; the oracle returns +100 with SQLERRD(3) = rows read, so the runtime matches that. The estate is built inline, no committed estate dir.
Cap
Six hand-written files (
sql.py,DetSql.java,ggsql.c,equivalence_sql.py, the forge,test_sql_dynamic.py), plus the register and rule catalogue docs.File-cap exception: translator, runtime, oracle shim and precompiler must move together for the rowset form to be provable on Db2; any smaller cut would ship an unproven form.
Remaining slices
INSERT ... FOR n ROWS [ATOMIC|NOT ATOMIC]STARTING AT, PRIOR/FIRST/LAST/ABSOLUTE/RELATIVE ROWSETClass / Sibling gaps
Class: host-variable arrays in embedded SQL. Fixed here: ROWSET FETCH, and OCCURS host variables elsewhere are now refused by name instead of mistranslated. Sibling gaps (multi-row INSERT, STARTING AT/orientations, positioned UPDATE/DELETE on a rowset): none is used by a burned-estate program today (the burned-estate pin
_SCROLL_OR_ROWSET_SQLis unchanged), so none is needed by CardDemo, CBSA, GenApp, zECS, DBB MortgageApplication or cicsdev async.Lessons for agents
_CURSOR_FORregex must learn every new DECLARE CURSOR clause, or the clause leaks into the repository query and every Java FETCH returns -501.find_cursormust prefer the OPEN statement whose handle is set, or a re-OPEN through a second OPEN statement gives -501.NAME OF QUAL (1).Cross-repo: none; no companion PRs.
🤖 Generated with Claude Code