|
View previous topic :: View next topic
|
| Author |
Message |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
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 |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
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 |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
|
|