How to update DB2 table using Utility



IBM's flagship relational database management system

How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 7:00 pm

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.
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to update DB2 table using Utility

 

Re: How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 7:14 pm

Its "DSNUTILB"
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to update DB2 table using Utility

Postby GuyC » Thu Apr 14, 2011 7:59 pm

"replacing full table(REPLACE) or the the rows get rejected with error duplicate key."
That's what a load does. What did you expect ?
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 8:14 pm

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.
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to update DB2 table using Utility

Postby GuyC » Thu Apr 14, 2011 8:25 pm

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.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 8:33 pm

You mean to say that no load utility does not update any row ??
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to update DB2 table using Utility

Postby Akatsukami » Thu Apr 14, 2011 8:44 pm

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?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 8:49 pm

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
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to update DB2 table using Utility

Postby GuyC » Thu Apr 14, 2011 8:54 pm

Probably unload/sort merge/load is a possibility, but I'm no sort expert.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: How to update DB2 table using Utility

Postby ritikasingh » Thu Apr 14, 2011 9:09 pm

Ya, but again volume of data is a challengeas i need to update tables everyday..
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post