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
 

 

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: 6966
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: 6966
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 how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Doubt in MFS abdulrafi IMS DB/DC 2 Fri Oct 21, 2016 3:09 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


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