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

How DB2 Committed my transaction even my job abends?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Mon Jan 10, 2011 3:43 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 10, 2011 8:25 am
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Jan 10, 2011 8:30 pm
Reply with quote

If you issue COMMIT explicitly, you will bypass all syncpoint integrity in your runtime environment.
Back to top
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Wed Jan 12, 2011 5:11 am
Reply with quote

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
View user's profile Send private message
AneeshMani

New User


Joined: 25 Jan 2008
Posts: 24
Location: india

PostPosted: Wed Jan 12, 2011 6:27 am
Reply with quote

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
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Wed Jan 12, 2011 7:58 am
Reply with quote

Hi AneeshMani,

You are wrong.
Read - Update - Write into output file - If EOF of Read - Commit.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jan 12, 2011 8:34 am
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Jan 13, 2011 6:52 pm
Reply with quote

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
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Fri Jan 14, 2011 4:25 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 14, 2011 9:51 am
Reply with quote

Hello,

Suggest you work with your dba(s) to identify what is committing the updates. . .
Back to top
View user's profile Send private message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Sun Jan 16, 2011 11:51 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jan 16, 2011 12:51 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Jan 17, 2011 8:40 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to identify the transaction categ... IMS DB/DC 3
No new posts Batch call online program, EXCI task ... CICS 3
No new posts Start CICS transaction every day at 2AM CICS 4
No new posts TWA size of the CPLT transaction CICS 0
No new posts Invoke IMS transaction from .NET IMS DB/DC 1
Search our Forums:

Back to Top