IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAVEPOINT ON ROLLBACK RETAIN CURSORS issue


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cgilker

New User


Joined: 02 Mar 2022
Posts: 6
Location: USA

PostPosted: Fri Apr 11, 2025 1:50 am
Reply with quote

I have a batch program, running in JCL under IKJEFT1A.

I am issuing a SAVEPOINT <name> ON ROLLBACK RETAIN CURSORS before I open my cursor.

Then I open, fetch, and do some processing. After each fetched row, I either issue a COMMIT or a ROLLBACK.

If I issue a ROLLBACK, I then issue another SAVEPOINT <name> ON ROLLBACK RETAIN CURSORS.

Otherwise, I just COMMIT.

Then I fetch the next row.

In the ROLLBACK / SAVEPOINT scenario, the next fetch is returning SQLCODE = -501 (i.e. the cursor is not open)

I am confused. I expected the cursor to remain open. Am I missing something obvious here?
Back to top
View user's profile Send private message
cgilker

New User


Joined: 02 Mar 2022
Posts: 6
Location: USA

PostPosted: Fri Apr 11, 2025 2:03 am
Reply with quote

I may have answered my own question, so apologies in advance if so.

Apparently, my ROLLBACK should be qualified as TO SAVEPOINT <name>.

Since I am not qualifying it that way, I am guessing that DB2 is doing a rollback to the last commit point, which is closing my cursor.

I will test the code again with ROLLBACK TO SAVEPOINT <name> as soon as I can get the necessary test conditions established.

But, in the meantime, does this explain my issue?
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts CICS-Db2 connection issue CICS 1
No new posts purge jobs with return code 0 and ret... JCL & VSAM 6
No new posts XML Generate issue COBOL Programming 0
No new posts How to Login in to cics region and is... CICS 9
No new posts Synchpoint Rollback CICS 1
Search our Forums:


Back to Top