MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DELETE utility

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
paleeshwaran
Beginner


Joined: 13 Feb 2006
Posts: 5
Topics: 1

PostPosted: Tue May 25, 2010 12:47 pm    Post subject: DELETE utility Reply with quote

Hi,

Greetings! I am trying to find if there is any DB2 utility where we can DELETE rows from a table, by reading primary key from a file.

Please advise and Thanks in Advance!

~ Peace
Palee
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Tue May 25, 2010 12:48 pm    Post subject: Reply with quote

paleeshwaran,

It would be easier to just unload the file and remove the duplicates based on the primary key and reload it back again. Alternatively you can generate the Delete SQL commands reading a file and run it thru DSNTIAUL

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
paleeshwaran
Beginner


Joined: 13 Feb 2006
Posts: 5
Topics: 1

PostPosted: Tue May 25, 2010 12:53 pm    Post subject: Reply with quote

Actually i thought about that option. But my DB have too many bad data, So if i remove duplicates the chances of Bad data being picked up for LOAD are high. So, i am thinking of an option where i can DELETE based on primary key extract from a file. Please advice
Back to top
View user's profile Send private message Yahoo Messenger
paleeshwaran
Beginner


Joined: 13 Feb 2006
Posts: 5
Topics: 1

PostPosted: Tue May 25, 2010 12:57 pm    Post subject: Reply with quote

Kolusu,

Apologies! i just noticed your recommendation on DSNTIAUL. Could you please let know delete command that should be given in SYSIN and how the where clause of DELETE can be referrenced to a file value? Thanks
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Tue May 25, 2010 12:59 pm    Post subject: Reply with quote

paleeshwaran wrote:
Actually i thought about that option. But my DB have too many bad data, So if i remove duplicates the chances of Bad data being picked up for LOAD are high. So, i am thinking of an option where i can DELETE based on primary key extract from a file. Please advice


huh? I am confused . your table already has the bad data and all you are doing is removing the duplicates based on the primary key in both files. So I just don't understand what the problem is

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
paleeshwaran
Beginner


Joined: 13 Feb 2006
Posts: 5
Topics: 1

PostPosted: Tue May 25, 2010 1:06 pm    Post subject: Reply with quote

I have a primary key which is timestamp and no duplicates. I have account record which are duplicates some of them are bad data and some of them are good data.

For example below is the data that i have
2009-01-01.00.00.00.000001 ACCOUNT1 XXXXXGOOD
2009-01-01.00.00.00.000002 ACCOUNT1 XXXXXBAD
2009-01-01.00.00.00.000003 ACCOUNT2 XXXXXBAD1
2009-01-01.00.00.00.000004 ACCOUNT2 XXXXXBAD2
2009-01-01.00.00.00.000005 ACCOUNT2 XXXXXGOOD

I just want to delete only record 2, 3 & 4. I already have them in a file. Now i am looking for a utility to delete these records based on primary key(which is the timestamp)
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Tue May 25, 2010 1:07 pm    Post subject: Reply with quote

paleeshwaran wrote:
Kolusu,

Apologies! i just noticed your recommendation on DSNTIAUL. Could you please let know delete command that should be given in SYSIN and how the where clause of DELETE can be referrenced to a file value? Thanks


Show me a sample of your input file mentioning the fields being treated as primary key and DCB properties of it and a sample a Delete statement for the table , I will show you how to generate the sql cards

You also might wanna look into these threads which discuss similar approach

http://www.mvsforums.com/helpboards/viewtopic.php?t=2787&highlight=sqlcards

http://www.mvsforums.com/helpboards/viewtopic.php?t=3369&highlight=sqlcards

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
paleeshwaran
Beginner


Joined: 13 Feb 2006
Posts: 5
Topics: 1

PostPosted: Tue May 25, 2010 2:56 pm    Post subject: Reply with quote

Thanks Kolusu! It worked!
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group