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
 

 

How DB2 Committed my transaction even my job abends?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How DB2 Committed my transaction even my job abends?
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

Site Director


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

PostPosted: Mon Jan 10, 2011 8:25 am    Post subject:
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    Post subject:
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    Post subject: Reply to: How DB2 Committed my transaction even my job abend
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    Post subject: Reply to: How DB2 Committed my transaction even my job abend
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    Post subject: Reply to: How DB2 Committed my transaction even my job abend
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

Site Director


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

PostPosted: Wed Jan 12, 2011 8:34 am    Post subject:
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    Post subject: Re: Reply to: How DB2 Committed my transaction even my job a
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    Post subject: Reply to: How DB2 Committed my transaction even my job abend
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

Site Director


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

PostPosted: Fri Jan 14, 2011 9:51 am    Post subject:
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    Post subject: Reply to: How DB2 Committed my transaction even my job abend
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

Site Director


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

PostPosted: Sun Jan 16, 2011 12:51 pm    Post subject:
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

Active Member


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

PostPosted: Mon Jan 17, 2011 8:40 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Detailed Transaction History report f... Kyle Carroll CICS 5 Tue Oct 18, 2016 12:42 am
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Start a CDBM transaction whit appropr... lind sh CICS 2 Sun Apr 10, 2016 1:46 pm
No new posts Transaction Profile amitc23 CICS 1 Thu Feb 04, 2016 3:10 pm
No new posts IEFZB476 getting various 0C4 abends Grant Goodale PL/I & Assembler 18 Sat Sep 12, 2015 9:27 pm


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