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

DB2 Block insert (-803 Error Handling)


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

New User


Joined: 11 Nov 2019
Posts: 10
Location: USA

PostPosted: Mon Nov 11, 2019 7:54 pm
Reply with quote

Hello All,

I am doing a Block insert after loading a Table, Approximately 2500 occurrences.

I am generating a Duplicate Key, Error -803. I found the duplicate and why it was generating but I would like to add some code to improve the down time in case it happens again.

Is there a way to capture the duplicate row after the error is generated using COBOL.

What I mean by this, after I do the insert and DB2 rejects the block insert and returns the -803. Aside from dumping the entire table and searching through it (occurrence my occurrence) for the Dupe. Can I capture the offending Key (Row) and display the table AND also the row # in error? That way I can go straight to that information and determine why it was duplicated.

Thanks,

-Ron
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Mon Nov 11, 2019 9:12 pm
Reply with quote

How abput sorting the data on the key and either remove duplicates or run through a program before doing the insert and report on duplicates. You may need to do a bit restructuring but it will save time eventually. 4 programs:
create data
sort
check
insert
Back to top
View user's profile Send private message
NJDevils28

New User


Joined: 11 Nov 2019
Posts: 10
Location: USA

PostPosted: Mon Nov 11, 2019 9:29 pm
Reply with quote

Nic Clouston wrote:
How abput sorting the data on the key and either remove duplicates or run through a program before doing the insert and report on duplicates. You may need to do a bit restructuring but it will save time eventually. 4 programs:
create data
sort
check
insert

Hi. Thank you for responding!

I thought of that but it will not work. (May not work)

There is the possibility of there being a pre-existing key during the bulk insert. My system is one of many that hits the database and I am supposed to be the primary but production and test environs rarely match.

Also, (and this is the primary error) I could have the key in the first Block insert and then a duplicate is created when I do my next Block insert.

The I/P data is supposed to be in the correct order but I'm having to code for that discrepancy also.

If there is a pre-existing key (Either another system insert or a previous block insert from me) and it's caught up in my current block insert - I need to ID the key and do a separate update.

That is where I am getting hung up and consuming too much time.

Any advice is most welcome!

-Ron
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Nov 12, 2019 1:09 am
Reply with quote

I guess DB2_ROW_NUMBER should give you that row#, test it.

GET DIAGNOSTICS
Back to top
View user's profile Send private message
NJDevils28

New User


Joined: 11 Nov 2019
Posts: 10
Location: USA

PostPosted: Tue Nov 12, 2019 1:31 am
Reply with quote

Rohit Umarjikar wrote:
I guess DB2_ROW_NUMBER should give you that row#, test it.

GET DIAGNOSTICS

That looks like what I want!

Thank you!

-Ron
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Nov 12, 2019 3:36 am
Reply with quote

Welcome Ron!!
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 IEW2315E 1369 Link error All Other Mainframe Topics 3
No new posts Help on IMS -API URL migrating from P... IMS DB/DC 1
No new posts JES datasets IO Error ABENDS & Debugging 3
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts PKZIP error ZPFM121E and ZPCE009E JCL & VSAM 6
Search our Forums:

Back to Top