Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am

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