Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Cursor result set being updated???

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 144
Location: United States

PostPosted: Tue May 28, 2019 10:46 pm    Post subject: Cursor result set being updated???
Reply with quote

I have a simple cursor in a COBOL program that I use to select records. As I process the cursor, I may be inserting additional rows into the table (SCISTAT) the cursor is based on. When I insert a row into the SCISTAT table, it is the next record I see in the FETCH. The record count taken in the FETCH routine also reflects these inserted records. We are using DB2 V11.
I have never heard of a cursor dynamically updating the result set, but maybe this is something new?

This is the cursor:

Code:
EXEC SQL                       
    DECLARE FLAGSTAT CURSOR FOR
     SELECT DOC_TYPE,           
            BATCH,             
            DOC_ID,             
            MESSAGE_ID         
      FROM SCISTAT             
     WHERE UPDATE_FLAG = 'C'   
       AND SUSFDATE IS NULL     
END-EXEC.                       
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2242
Location: NY,USA

PostPosted: Wed May 29, 2019 12:52 am    Post subject:
Reply with quote

Preliminary, Either look for SENSITIVE/INSENSITIVE attributes of a CURSOR options or add WITH UR in DECLARE and let us know if that solves the problem.
Back to top
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 144
Location: United States

PostPosted: Wed May 29, 2019 2:35 am    Post subject:
Reply with quote

Thank you for the suggestions. But, first I really wanted to know if it was possible for the result set to dynamically change?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2242
Location: NY,USA

PostPosted: Wed May 29, 2019 4:05 am    Post subject:
Reply with quote

For that please read the link shared above and look for FIRST DEFAULT OPTION provided( ASENSITIVE )which says the results are unpredictable as you experienced in your case. Look at the open statement as to what happens in the subsequent link, it is very clearly mentioned.

So try make a use of WITH UR if you want consistency in the final result.
Back to top
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 144
Location: United States

PostPosted: Thu May 30, 2019 9:58 pm    Post subject:
Reply with quote

Cool. Thanks a lot.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2242
Location: NY,USA

PostPosted: Fri May 31, 2019 12:16 am    Post subject:
Reply with quote

You're Welcome!!.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Send text at cursor position on an IS... Domenic Ailati CLIST & REXX 10 Sun Jun 02, 2019 7:34 am
No new posts Different result between normal rexx ... UmeySan CLIST & REXX 2 Tue May 07, 2019 6:18 pm
No new posts POSITIONING THE CURSOR USING REXX MJ SHARATH CLIST & REXX 6 Tue Apr 09, 2019 10:27 am
No new posts Get line number where cursor is from ... satish.ms10 CLIST & REXX 3 Wed Oct 24, 2018 12:23 am
No new posts Delete Multiple rows in chunks by usi... dharmaraok DB2 5 Tue Sep 11, 2018 8:44 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us