View previous topic :: View next topic
|
Author |
Message |
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi ,
I have a db2 sub program which is having update query and commit and roll back in it...
From my main program passing command to subprogram (via linkage)to update and finally commit, if anything wrong , it will pass command to roll back.
But my job failed due to Space Abend. So as per my understanding the DB2 automatically roll back all the transaction which is happened during that transaction.
But it was not, the update query was committed. This is not happened due to main program command, automatically the programs commit the transactions. Why? Usually if we face any abend in job the db2 should roll back automatically right?
Please explain.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Your understanding is a MISunderstanding. . .
Once committed, the work is "there" and cannot be rolled back. . .
If you want all of the the work rolled back in case of an abend, do not issue a commit. Not one. Until the end of all of the "work". |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
If you issue COMMIT explicitly, you will bypass all syncpoint integrity in your runtime environment. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi dick,
I have an idea about Commit & Roll back. But here My Main program didn;t instruct my sub program to commit the work. While processing (Middle of updates) abended due to space issue, So My doubt, is how come it committed after the abend.
Hi Kjeld,
I cant understand your point. Could you please explain little bit. You mean to say, if we issue the commit in our program, that wont roll back for abends? |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi,
Good Morning....
Quote: |
But it was not, the update query was committed. This is not happened due to main program command, automatically the programs commit the transactions. Why? Usually if we face any abend in job the db2 should roll back automatically right? |
This is my understanding of your modules...
I believe that your sub-prog will commit whether or not you issue a COMMIT cmd from your main-prog via linkage.
Could you please check your sub-prog to see if the COMMIT will happen right after the update.
This is your order of execution i guess..
UPDATE -> COMMIT > ABEND
without waiting for the main module to issue the command....
I guess it should not be.
Quote: |
if we issue the commit in our program, that wont roll back for abends?
|
A:
Quote: |
Once committed, the work is "there" and cannot be rolled back. . . |
Thanks,
A |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi AneeshMani,
You are wrong.
Read - Update - Write into output file - If EOF of Read - Commit. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Aneesh might be incorrect on some specific, but generally the problem is most probably because something caused the work to be committed.
If there was no commit and all of the processing was a single unit-of-work, the transactions would be backed out. As they "survived" they had already been committed - whether this was intentional or not. . . |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Pons wrote: |
Hi Kjeld,
I cant understand your point. Could you please explain little bit. You mean to say, if we issue the commit in our program, that wont roll back for abends? |
If you use a transactional DB monitor system like IMS, you must no issue explicit commits to any database interface that IMS syncronises with. Instead you establish syncpoints through IMS checkpoints that issues commits to all database systems involved with your application.
Other runtime environments like TSO interface commits when the DB2 thread are terminated on end of program if return code is 0 and rolls the work unit back otherwise.
If you commit explicitly updates done prior to the commit will be commited and can't be rolled back even if your program abends afterwards. |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Thanks.
My Program will fit in to this category
Other runtime environments like TSO interface commits when the DB2 thread are terminated on end of program if return code is 0 and rolls the work unit back otherwise.
But, Even I got an space abend, My db2 didn;t rolls the work unit back...
Let me try to find more about my program and let you guys know. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you work with your dba(s) to identify what is committing the updates. . . |
|
Back to top |
|
|
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi Thanks for your help.
I found the reason for the commit. The commit is issued by the system.
In my program, if any issues in the files; forcing the return code and end the program smoothly using file status. So, It is not abnormal termination, even RC shows 12 due to that return code (This is what confused me).
So DB2 treat this is an normal completion and commits the records..
I will modify this existing logic. Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Many times a return code is confused with an abend code. They are not the same even though many jobs are "unsuccessfully terminated" due to a problem return code (often anything other than zero).
Good to hear it is resolved - thank you for letting us know |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
To emphasize Dick's comment re "abend" -
I quote "abend" here specifically because even experienced people sloppily misuse this term.
IBM and only IBM defines abend (look the definition up), so no one else can. A program (system or user; e.g., compiler or report program) may abnormally terminate, and issue various return codes, but only an IBM defined abend (again - the only kind, matters when documentation uses the word "abend" (e.g., COND=EVEN or ONLY).
[/b] |
|
Back to top |
|
|
|