Replace function

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
mtechnocrat
Participant
Posts: 38
Joined: Sat Feb 28, 2004 12:11 pm

Replace function

Post by mtechnocrat »

Hi

From source data one column is coming with carraige returns , in target table i have to replace this carriage return with spaces .is there any function like REPLACE in oracle ? Can guide me in this issue

Thanks
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Search for Convert.
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

U can use the REPLACE function of Datastage to do this.
Prashantoncyber
Participant
Posts: 108
Joined: Wed Jul 28, 2004 7:15 am

Post by Prashantoncyber »

For convert function

Expression should be Convert("\r", " ", MyString)

For replace function

Expression should be Ereplace(MyString, "\r", " ")

thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can also use Char(10) in place of the \r.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

REPLACE is similar to CHANGE or EREPLACE.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Nah! :shock:

REPLACE replaces the value of an element in a dynamic array.

You need to use CONVERT, EREPLACE or CHANGE. CHANGE is a subset of EREPLACE functionality.

For single character replacement, CONVERT is the more efficient. However if you need portability to Windows platforms you will need EREPLACE or CHANGE, since the line terminator is two characters long.

Also, I doubt very much that the "\r" notation will work properly with the CONVERT function in server jobs, since it would replace "\" and "r" separately. Similarly, I believe EREPLACE and CHANGE would seek out explicit instances of "\r". That is, DataStage BASIC does not handle shell escapes. Specify Char(10).

All these functions can be found in the DataStage BASIC manual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Oracle REPLACE is similar to EREPLACE and CHANGE in Universe BASIC.

Yes!
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Sreenivasulu wrote:U can use the REPLACE function of Datastage to do this.
I was really reacting to this post, of course! :P
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Sorry. :oops:
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Don't be sorry, how were you supposed to know? Ray doesn't usually quote because you get less points when you quote. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Fewer.

:twisted:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:Fewer. :twisted:
Yes, yes, I know, not sure what I was thinking... 'fewer' for things that can be counted individually, and 'less' for those things that can't be. Mostly. I'd edit my original post but it would ruin the whole Feng Shui of it. :lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply