View previous topic :: View next topic
|
Author |
Message |
NJDevils28
New User
Joined: 11 Nov 2019 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
NJDevils28
New User
Joined: 11 Nov 2019 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
Back to top |
|
|
NJDevils28
New User
Joined: 11 Nov 2019 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Welcome Ron!! |
|
Back to top |
|
|
|