format string

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
sainath
Premium Member
Premium Member
Posts: 138
Joined: Fri Nov 19, 2004 3:57 pm

format string

Post by sainath »

hi
thanks for reply.
But in my input column is like 1234 | 2345| 234 |......
and i want my o/p as (pre 123) (pre 2345) (pre 234) ......

i think first i have to count for delimitors then can you tell me how to use feild function.
thks
have a feild xxxxx!yyyyyy .I want to format this string to
(pre xxxxx) (pre yyyy) as output.where ! is my delimitor.
pl share your thoughts.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

To change a text string to another, use CHANGE or EREPLACE. Example:

Code: Select all

text_string=CHANGE(text_string, "|", ")(")
To add the leading and trailing parenthesis, just append:

Code: Select all

text_string="(":text_string:")"
To add the "pre" text, just replace the "(" with "(pre"

Code: Select all

text_string=CHANGE(text_string,"(", "(pre")
To do it all at once in a single line:

Code: Select all

text_string=CHANGE("(":CHANGE(text_string, "|", ")("):")","(", "(pre")
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
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(@FM, " ", Cats(Cats(Reuse("(pre "), Convert("|", @FM, InLink.TheString)), Reuse(")"))
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

Re: format string

Post by chulett »

sainath wrote:hi
thanks for reply.
But...
:idea: Just a thought, but if you are going to start off a new thread with 'thanks for the reply, but' you really should reply in the original thread - not start a new one. Then people know what started it all, what you are talking about and can bring it to its rightful conclusion.
-craig

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