View previous topic :: View next topic |
Author |
Message |
nitink.c Beginner
Joined: 18 Feb 2010 Posts: 2 Topics: 1
|
Posted: Wed Feb 24, 2010 5:31 pm Post subject: Replace Duplicate rows using DB2 Load utility |
|
|
Hello,
Greetings to everyone!
I have a requirement where I need to load the data from flat file to DB2. I know I can use the DB2 utility DSNUTILB to do that. This utility give us three options to load data in DB2 table:
Option 1
LOAD REPLACE: This options deletes all the records from tablespace before performing bulk load on the target DB2 table.
Option 2
RESUME YES: This option expects the target table to be empty to perform the bulk load
Option 3:
RESUME NO: This is like appending data to target table. But this option will reject any records with duplicate keys.
My requirement is that I want to replace the record having duplicate keys. In case of duplicate keys, the file record should overwrite the record in target table.
Does anyone have any idea how to achieve this using DSNUTILB.
Thanks! |
|
Back to top |
|
 |
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Wed Feb 24, 2010 5:47 pm Post subject: |
|
|
Unload the table, match the unloaded data with the new data discarding duplicates, and then load the combined old/new data that has no duplicates. _________________ All the best,
di |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Feb 24, 2010 5:47 pm Post subject: |
|
|
nitink.c,
It depends on the volume of the records to be updated/replaced. If you have at least 50% updated records then you might want to consider LOAD REPLACE.
If you have only few hundreds of records to be updated, Use a program to Update the rows.
Kolusu |
|
Back to top |
|
 |
nitink.c Beginner
Joined: 18 Feb 2010 Posts: 2 Topics: 1
|
Posted: Wed Feb 24, 2010 7:07 pm Post subject: Thanks for Reply |
|
|
Kolusu/Papadi, Thanks for the reply!
I have thought of both the options and the reason I am looking for Bulk load solution rather than program or 'unload-merge-load' is:
1. I have tables that contain tens of millions of rows
2. The number of records coming in flat file will be in thousands
3. I want to perfom the load on 40 tables
So, if I should write a program, there will be 40 programs required (or less depending on design but not less than 15).
Using unload-merge-load mechanism will be too costly on tables having rows > 20 millions.
If these is no bulk load solution at all, I know I will have to use one of the option that you have mentioned.
Has anyone here used DB2 Import utility on Z/OS installation? How it works? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Feb 24, 2010 7:15 pm Post subject: |
|
|
nitink.c,
If you have only few thousands of records to be updated you probably can generate UPDATE statements and run them via DSNUTILB
Kolusu |
|
Back to top |
|
 |
|
|