string 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
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

string function

Post by suresh_dsx »

hey guys

i have job seqfile-> tranformer stage ->target

source data

"----John---"
"----paul----"


output is

John
paul

i created a routine for that and i used in tranformer stage.i am getting the result.
but i want a single function to get the output in transformer stage.(i dont want to use routine )
thank you
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Trim() function is the one you want. Specify the "-" character as the second argument of Trim(), and the third argument is a single character code specifying from where you want them removed. You can learn all the options by reviewing on-line help or from the DataStage BASIC manual.

A second possibility, if you want to discard all "-" characters, is to use the Convert() function to convert them all to "".

Others are likely to suggest the Ereplace() function, but this is not as efficient as Convert() when performing individual character conversion.
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 »

Those cwazy Others, whadda they know? :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 »

Code: Select all

Convert("s","z",Ereplace(Ereplace(Ereplace("Those cwazy Others, whadda they know?","Th","D",-1,0),"th","dd",1,1),"th","d",1,1))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Both of you guys are funny. Actually, hilarious :lol:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply