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

Declare of cursor statement using WITH HOLD OPTION


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

New User


Joined: 27 Apr 2005
Posts: 12
Location: chennai

PostPosted: Thu Apr 28, 2005 2:43 pm
Reply with quote

hai friends,

What is the use of WITH HOLD OPTION, while declaring a cursor statement. can any one help me to know that.

regards

elango.
Back to top
View user's profile Send private message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Thu Apr 28, 2005 3:21 pm
Reply with quote

Hi,

if you dont want to close the cursor till end of the transaction then you have to use this option.

Cheers........

pavankumar
Back to top
View user's profile Send private message
elango

New User


Joined: 27 Apr 2005
Posts: 12
Location: chennai

PostPosted: Thu Apr 28, 2005 3:57 pm
Reply with quote

hai


thanks for ur reply



regards

elango
Back to top
View user's profile Send private message
vaduri

New User


Joined: 19 Apr 2005
Posts: 2
Location: Hyderabad

PostPosted: Thu Apr 28, 2005 6:14 pm
Reply with quote

Whenever the Commit statement executes in your COBOL-DB2 program, all the cursors which were opened will be closed. You need to explicitly open the cursor again. (other wise -501 SQL error)..

Inorder to keep the cursor open while execution of commit, we need to declare the cursor with "WITH HOLD FOR" option.

But, the cursor declared with "WITH HOLD FOR" option will be closed upon execution of "ROLL BACK" statement but normal cursors will not be closed while "ROLL BACK" statemet execution.
Back to top
View user's profile Send private message
shymalasridevi

New User


Joined: 03 May 2005
Posts: 16

PostPosted: Tue May 03, 2005 3:06 pm
Reply with quote

hai,

in the real environment multiple users will use the same table that u r using
in that situation if they will do commit transaction then ur cursor will be automatically closed if u don't use the cursor WITH HOLD option
if u use WITH HOLD option ur cursor will remains unchanged sothat u can retreive the data .
i think it is sufficient for u
if u have any doubts plz let me know
bye
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts CICS vs LE: STORAGE option CICS 0
No new posts INSYNC option with same function as I... JCL & VSAM 0
No new posts Option DYNALLOC second parameter. DFSORT/ICETOOL 11
Search our Forums:

Back to Top