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
 
Doubt on duration of Lock against DB2 table.

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Aug 27, 2012 9:11 am    Post subject: Doubt on duration of Lock against DB2 table.
Reply with quote

from DB2 v10 manual on RELEASE option of BIND, we can see:
Quote:
( COMMIT )
Releases resources at each commit point.
DEALLOCATE
Releases resources only when the program terminates.


for my instance: I have a transaction which links 4 programs sequentially, and I have declared a FOR UPDATE cursor in the 1st program. if a ' OPEN CURSOR' is executed in the 1st program, but no 'CLOSE CURSOR' executes when the 1st program ends, in the 2nd program, does the row locked by the CURSOR still locked ?

in the 4th program, I executes 'EXEC CICS SYNCPOINT ', and nowhere else issue SYNCPOINT command. There is no 'COMMIT' statement in all of these 4 programs.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Aug 27, 2012 9:34 am    Post subject:
Reply with quote

Quote:
which links 4 programs sequentially


explain the scenario a little better.

you have a transaction that invokes pgm-a
pgm-a has a cursor
pgm-a links to pgm-b, pgm-c, pgm-d?

if pgm-a links to b,c,d then when pgm-a terminates
the task terminates.

in cics, a syncpoint is a commit.
in fact, you should always use syncpoint and not use commit in cics.

all this complicated stuff is laid out in the cics and db2 manuals.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Mon Aug 27, 2012 10:16 am    Post subject:
Reply with quote

more specifically speaking, a transaction invokes pgm-m,
and pgm-m links pgm-a, pgm-b, pgm-c sequentially.

pgm-a declared a FOR UPDATE cursor, OPEN it , but no CLOSE
pgm-b wants to update the row which is candidate of the CURSOR declared in pgm-a , but not sure whether the lock on the row has been released by pgm-a or not.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Aug 27, 2012 10:31 am    Post subject:
Reply with quote

ok,
unfortunately a cursor must be open/closed/fetched-updated-inserted-deleted
by the declaring module.
so, pgm-b can not update the cursor declared/opened in pgm-a.

if pgm-b is to update a row within a table, that row possibly being part of the result set of pgm-a's cursor,
do a singleton update on the row in pgm-b.

if we are taking about inserts or deletes keep in mind that you now enter the problems of sensitive cursors.

but presumably you are updating a row that you have fetched,
so unless you fetch the same row again in pgm-a,
you will not see the results of the update by pgm-b.


now, if you would learn your fundamentals:
a lock is used to prevent other TASKS from modifying your data,
and pgm-b is in the same task as pgm-a,
so any locks that pgm-a has caused to be issued,
do not affect pgm-b,
since it is in the same task.....

dejunzhu,
nearly every question you pose in this forum is due
to lack understanding fundamentals.
don't make things so complicated.
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 Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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