Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cursor with 'WITH HOLD'

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

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Thu Nov 01, 2007 2:21 pm    Post subject: Cursor with 'WITH HOLD'
Reply with quote

I have seen many posts for this topic and have searched a bit but have one question about the 'lock' ...............

I am using cursor with 'WITH HOLD' option, and depending upon a indicator field,have a logic to either update the fetched row or insert a new row in table, this is performed in loop .........
So there are 3 possibilities,
a. fetch the row and no action is taken ......
b. fetch the row and update the row
c. fetch the row and insert a new row

if the isolation level is => Cursor stability =>
Following should be true ...........

1. The rows for which no action is taken should be available to other transaction (or program ...whatever) as cursor moves to next row
These will be locked only when that particular row is fetched.

2. The rows which are updated or the new rows inserted will NOT be available and will be locked until "COMMIT" or end of the job.

If this is true .............. then if i am using cursor WITH HOLD, and there are total 10,000 rows to be processed .....
I have a logic to perform COMMIT after every 1000 rows.
After the first 1000 rows will the locks on these 1000 rows be released or the "WITH HOLD" option will hold the locks until the end of Job ???
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Nov 01, 2007 3:07 pm    Post subject:
Reply with quote

suggest you read the manual to understand what 'WITH HOLD' means.

stop guessing.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Thu Nov 01, 2007 4:49 pm    Post subject: Re: Cursor with 'WITH HOLD'
Reply with quote

hsk wrote:
if i am using cursor WITH HOLD, and there are total 10,000 rows to be processed .....
I have a logic to perform COMMIT after every 1000 rows.
After the first 1000 rows will the locks on these 1000 rows be released or the "WITH HOLD" option will hold the locks until the end of Job ???


hsk,

According my knowledge, The locks on 1000 rows will be released because the concept behind WITH HOLD is keep open cursor option even though COMMIT or ROLLBACK operation will be imposed
<internally WITHHOLD position will repositioned to previous read records that is the record which comes after COMMIT operation>
---------------------------------------------------------------------
WITH HOLD option is not related to LOCKS

Regards,
Raghavendra
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 Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts How LOAD PROGRAM and LOAD on HOLD is ... pkmurali CICS 4 Tue May 03, 2016 6:26 pm
No new posts How to hold a daily job for a monthly... anandgbe CA Products 8 Mon Mar 07, 2016 12:59 pm
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us