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 Locking and Lock Size

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

New User


Joined: 27 Mar 2008
Posts: 8
Location: INDIA

PostPosted: Fri Apr 04, 2008 1:47 pm    Post subject: Cursor Locking and Lock Size
Reply with quote

I have coded a simple cursor which can extract millions of rows.
And the isolation was specified as CS.

Query1 : When the locks would be applied ?
a) During Open
b) During Fetch
Query2 : What is the Size of the lock?
a) All quallified millions of rows ( Which can be escalated to Table Space Lock)
b) Only a Page (4K) will be locked.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Apr 04, 2008 2:34 pm    Post subject:
Reply with quote

Please visit this topic.
http://ibmmainframes.com/viewtopic.php?t=29412
Back to top
View user's profile Send private message
deepananda

New User


Joined: 27 Mar 2008
Posts: 8
Location: INDIA

PostPosted: Fri Apr 04, 2008 3:02 pm    Post subject:
Reply with quote

Actually, the topic was started by one of my colleague. Still it wasn't clear on the Lock Size and we have some problem in production regading this.

Your feedback would be appreciated.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Apr 04, 2008 3:18 pm    Post subject:
Reply with quote

If you have seen at manual...

Cursor Stability (CS) locks any row accessed by a transaction of an application while the cursor is positioned on the row. This lock remains in effect until the next row is fetched or the transaction is terminated. However, if any data on a row is changed, the lock must be held until the change is committed to the database.

Recalling the example of scanning 10 000 rows, if you use Cursor Stability, you will only have a lock on the row under your current cursor position. The lock is removed when you move off that row (unless you update that row).

If anything else, please be specific with your question so that someone would reply you clearly...
Back to top
View user's profile Send private message
deepananda

New User


Joined: 27 Mar 2008
Posts: 8
Location: INDIA

PostPosted: Fri Apr 04, 2008 3:26 pm    Post subject:
Reply with quote

Thanks
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Fri Apr 04, 2008 6:01 pm    Post subject:
Reply with quote

Query1 : When the locks would be applied ?

a) During Open -: If your cursor query causes a datasort and fetch reads records from sort out file. It wont cause a row level lock even if you bind with CS, during a fetch

b) During Fetch -: If your SQL is not causing any sorts, then things will be exactly as what Gnanas said, unless and untill you specify the isolation level in your cursor.

This is what my understanding is. Please correct me if I am wrong.

Thanks,
Prajesh
Back to top
View user's profile Send private message
deepananda

New User


Joined: 27 Mar 2008
Posts: 8
Location: INDIA

PostPosted: Tue Apr 08, 2008 3:05 pm    Post subject:
Reply with quote

Thanks a lot
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 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
No new posts Increase the screen size after split mistah kurtz TSO/ISPF 2 Fri Sep 02, 2016 6:39 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


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