Page 1 of 2

How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 7:00 pm
by ritikasingh
Hi,

I have to Load 50 + DB2 tables using DB2 utility DSNUTLIB.
In an empty table i am able to successfully load all the new rows.
But when i try to update any row, either i end up replacing full table(REPLACE) or the the rows get rejected with error duplicate key.
Please advice.

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 7:14 pm
by ritikasingh
Its "DSNUTILB"

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 7:59 pm
by GuyC
"replacing full table(REPLACE) or the the rows get rejected with error duplicate key."
That's what a load does. What did you expect ?

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:14 pm
by ritikasingh
No, I want to keep old rows and update rows if required.
For example my table has two columns

Name (Key) Telephone_number
xxxx 111111
yyyyy 222222

Now i want to use the utility such that i update the telephone number for name 'xxxx'
My new input file for update has data

xxxx 444444
i want the final table having data as below:

xxxx 444444(updated)
yyyy 222222

But what i am getting is

xxxx 444444

Please let me kow if you need any other information.

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:25 pm
by GuyC
I knew what you wanted, but it is in conflict with : "I have to Load 50 + DB2 tables using DB2 utility DSNUTILB."
Load doesn't do that.

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:33 pm
by ritikasingh
You mean to say that no load utility does not update any row ??

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:44 pm
by Akatsukami
ritikasingh wrote:You mean to say that no load utility does not update any row ??

That is correct. "Load" means to place bulk data in a table (among many other things, of course). What you want to do is to write a SQL query, encapsulate it in a bit of source language, and run the resulting program. You do know how to do those things, yes?

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:49 pm
by ritikasingh
Yes i am aware about cobol-db2 program that can be used to perfrom the request.
But seeing the bulk of data and number of tables i wanted to do it using utility.

Thanks,
Ritika

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 8:54 pm
by GuyC
Probably unload/sort merge/load is a possibility, but I'm no sort expert.

Re: How to update DB2 table using Utility

PostPosted: Thu Apr 14, 2011 9:09 pm
by ritikasingh
Ya, but again volume of data is a challengeas i need to update tables everyday..