what function to use for replacing string?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

what function to use for replacing string?

Post by vinsashi »

Hi,
my source is like
field001,field002
101,reddy ysr reddy
102,raja reddy is reddy


here i want to replace reddy with "abc" i used convert function but not getting desired output
i want output like this
field001,field002
101,abc ysr abc
102,raja abc is abc
if i use convert function it taking as characters. so getting wrong output..

thanks in adavance
v....
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Post the syntax you used for the function, Also post the output you are getting!
RAJ
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Post by vinsashi »

i used this function
convert("reddy","abc",field002) i got this output like
output
field001,field002
101,abcc sa abcc
102,aaj abcc is abcc

i am getting this output

Thanks
v..
ETLJOB
Participant
Posts: 87
Joined: Thu May 01, 2008 1:15 pm
Location: INDIA

Post by ETLJOB »

The convert function will not replace the entire string as you mentioned. It works in the following way. It replaces

"r" with "a"
"e" with "b"
"d" with "c" in your case.

To replace the entire string you can leverage the ereplace() or change() functions. Search it!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: topic relocated as requested

The answer for a server job is to use the Ereplace() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

use pxEreplace for parallel jobs posted a while ago by DSGuru2B!
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply