MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 is inserting records when the job is abending

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Fri Aug 29, 2003 8:25 am    Post subject: DB2 is inserting records when the job is abending Reply with quote

Hi
I have a cobol-db2 program where iam inserting a row into the table and doing a divide by zero abend. Instead of rolling back, DB2 is inserting that row into the table. I have no commit statements in the program.
Is there any options to be set? Please explain how this is possible.

Regards,
Vani
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Fri Aug 29, 2003 9:30 am    Post subject: Reply with quote

Vani,
Are you checking the return code from the SQL statment after execution ?. DB2 does some Rollback for abends like -911, -913 etc. But for most other situations we need to check and issue a Rollback. Most installations have a common abend routine to be performed, like
EVALUATE SQLCODE
WHEN 0
CONTINUE
WHEN OTHER
DISPLAY 'ABEND CODE '
PERFORM Standard error routine
END-EVALUATE.
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Fri Aug 29, 2003 9:33 am    Post subject: Reply with quote

Vani,
A quick follow-up, if the return code(SQLCODE) is not checked and the job ends the database changes will be commited automattically.
Back to top
View user's profile Send private message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Sun Aug 31, 2003 11:48 pm    Post subject: Reply with quote

Thanx,
Even after checking the return code, the job is abending with a return code of 3000 but Roll back is not performed. The record is getting inserted. The SQL code returned when displayed was 00000080L. The Cobol Error suggests that the thread is getting cut but as per the theory, when the thread gets released, DB2 does a roll back till the last commit point, which is not happening.

Regards,
vani
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Sep 01, 2003 8:36 am    Post subject: Reply with quote

vani,

Quote:

The SQL code returned when displayed was 00000080L


The sql code is -803 which is basically a primary key violation. May be the record you are trying to insert is already present in the table and you are trying to insert it for the second time.

Check this link for a detailed explanation of -803

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNMCH11/2.1.6.376?SHELF=&DT=20010718150520

Hope this helps..

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group