Replace a string with another string
Moderators: chulett, rschirm, roy
Replace a string with another string
Hi All,
I have a requirement to replace a string with another string or just removing that string in datastage 8.5. And that string may appear more than once. Is there any function in DS 8.5 which does this? Please let me know. From this forum I got to know that we can write a routine to do this. But I was just wondering if there are any built in functionality to do this.
I have a requirement to replace a string with another string or just removing that string in datastage 8.5. And that string may appear more than once. Is there any function in DS 8.5 which does this? Please let me know. From this forum I got to know that we can write a routine to do this. But I was just wondering if there are any built in functionality to do this.
Split off from this conversation on the same topic. And the answer is still no until you get up into the 9.x release, from what I recall.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes, Use of basic transformer in parallel job have some drawbacks but It DEPENDS.. About your questions - No, It is running Parallel ( by default ) as well as Sequencial. The Only drawback is It will invoke the SERVER ENGINE for executing the BASICs function used in BASIC transformer.
px version of Ereplace()
viewtopic.php?t=106358
px version of Ereplace()
viewtopic.php?t=106358
~Atul Singh
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
String INPUT.COL : This is a String.This should be used.This is good.
stage variable :
cnt : count(INPUT.COL,'This')
Loop Variable :
cnt1 Initial Value 0 : if cnt1 = 0 then cnt else cnt1-1
lfind1 :
if cnt1 = cnt then field(INPUT.COL,'This',1):'That':INPUT.COL[Index(INPUT.COL,'This',1)+len('This'),len(INPUT.COL)]else field(lfind1,'This',1):'That':lfind1[Index(lfind1,'This',1)+len('This'),len(lfind1)]
Loop While : cnt1 <> 1
Constraint : cnt1 = 1
OUTPUT : That is a String.That should be used.That is good.
The "This" recurring string is replaced with "That". You can use the same logic to remove the string. Instead of 'That' put ''.
stage variable :
cnt : count(INPUT.COL,'This')
Loop Variable :
cnt1 Initial Value 0 : if cnt1 = 0 then cnt else cnt1-1
lfind1 :
if cnt1 = cnt then field(INPUT.COL,'This',1):'That':INPUT.COL[Index(INPUT.COL,'This',1)+len('This'),len(INPUT.COL)]else field(lfind1,'This',1):'That':lfind1[Index(lfind1,'This',1)+len('This'),len(lfind1)]
Loop While : cnt1 <> 1
Constraint : cnt1 = 1
OUTPUT : That is a String.That should be used.That is good.
The "This" recurring string is replaced with "That". You can use the same logic to remove the string. Instead of 'That' put ''.