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 

DB2 table update

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


Joined: 02 Aug 2005
Posts: 75
Topics: 27

PostPosted: Mon Feb 11, 2008 3:32 pm    Post subject: DB2 table update Reply with quote

Hi,
I have DB2 table having 2 cols, in One column the values are like this
Code:

col1                      col2
--------               -----------
xxxxxx               abc**hy
yyyyyy               hyted#&by


My requirment is to find all the records having junk value in col2 and replace those by spaces.

Output of the query will be
Code:

col1                      col2
--------               -----------
xxxxxx               abc  hy
yyyyyy               hyted  by


( please note *, # is not the junk value. some hex value other than zero is junk value)
_________________
Regards,
batu
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 11, 2008 3:48 pm    Post subject: Reply with quote

batu544,

Define Junk values. Show the actual junk value in hex. How many of them do you have?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
batu544
Beginner


Joined: 02 Aug 2005
Posts: 75
Topics: 27

PostPosted: Mon Feb 11, 2008 4:22 pm    Post subject: Reply with quote

Kolusu,
Other than a-z, A-Z, 0-9, '-', all are junk values .
_________________
Regards,
batu
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Feb 12, 2008 9:28 am    Post subject: Reply with quote

Set up a TRANSLATE function with the hex values you want to replace. Using the characters in your example, &, *, and #, the TRANSLATE would look like this:

Code:
translate(COL2,'   ',x'505C7B')


Just expand the list to include all the values that you want to replace.

Take a look at this post too.
http://www.mvsforums.com/helpboards/viewtopic.php?t=9081&start=0&postdays=0&postorder=asc&highlight=translate
Back to top
View user's profile Send private message
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