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

Question on: Partition level lock with commit


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

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Mon Feb 28, 2011 1:52 pm
Reply with quote

Hi,

I have locked the partition in exclusive mode with the partition number passed as a PARM from the job. The program will perform a commit for every 1000.
Now my question is "Will the LOCK be release if a commit is issued before processing all the records?"

Ex:- Input file has 1500 record belongs to 7th partition in a DB2 table. 7th partition will be locked in Exclusive mode (below is the SQL code) and commit is issued after processing 1000 records.

Will the lock be released after commit is issued or lock still exist until the job ends?
Code:
EXEC SQL                                     
    LOCK TABLE TABLENAME [color=blue]PART 7[/color] IN EXCLUSIVE MODE
END-EXEC                                     

Could some one clarify me ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Feb 28, 2011 2:50 pm
Reply with quote

I did not know the answer until i looked at the SQL Reference manual
and found the answer in the NOTES: section of the LOCK TABLE description.
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Mon Feb 28, 2011 3:10 pm
Reply with quote

Hi Dick,

"Thanks a lot" for looking into the manuals for me...

I found the answer in the same mannual as you suggested.

My bind CARD is coded as "RELEASE(DEALLOCATE)".
Hence the lock will be released only at the end of the job.

Thanks again for your help!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Feb 28, 2011 4:11 pm
Reply with quote

task not job,
I realize that you may be executing in a batch environment,
but even then, it would be end of step, not end of job.
online evironment, would be end of task.

I know that the manual said, end of application,
but application means end-of-step if it is batch or end-of-task if it is online.

but, then again, if you have explicitly attachted to db2 (e.g. RRSAF), your 'application' could detach from db2, and continue running, be the detach would be the point of lock release.


but otherwise, excellent, and apologize for my abruptness.
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Mon Feb 28, 2011 4:19 pm
Reply with quote

Dick,

This is a batch environment, Locking in the exclusive mode and updating the table is the last step in my job. So, I have mentioned as end of job.

I am sorry for the confusions.

Thanks for correcting me..!!
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Question regarding ISPF tables with T... TSO/ISPF 11
No new posts OPC scheduling question IBM Tools 0
No new posts How to load to DB2 with column level ... DB2 6
No new posts Lock Escalation DB2 3
No new posts DROP & ALTER PARTITION-PBR DB2 0
Search our Forums:


Back to Top