replace multiple positions values in a string--Server job

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
srinivenigalla
Participant
Posts: 35
Joined: Thu Aug 11, 2005 5:21 pm

replace multiple positions values in a string--Server job

Post by srinivenigalla »

Suppose Value is "0 0 0 0 0 0 0 0 0 0 0 0
position 1 2 3 4 5 6 7 8 9 10 11 12

A. first position to be checked for '0' AND IF IT IS '0' (replace FIRST position with 'k'
B. and (then 2nd 3rd 4th positins ar replaced with a value of a column which is a 3 character value).

I want to understand what is the best way of doing this. Can i use stage variables for deriving the conditions seperatel and use those stage variables in columns or is their any other better way to do it.

2. what is the function or method to be used to replace all the 3 characters with a field value as you see question B is to replace.

Please suggest.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

WorkString = "Hello World"
WorkString[3,3] = "123"

Now WorkString is "He123 World"
Post Reply