String Replace with Mixed Case

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

String Replace with Mixed Case

Post by Sreedhar »

Hi,

I have a special case where I have to replace a word from a string with a mixed case string in a field, I know before hand what are the words that needs to be replaced with some special words.

I get a list of words from a Reference file as

OCONNELL=OConnell
LADISA=LaDisa
LADOUCEUR=LaDouceur
LADUCA=LaDuca
LADUCER=LaDucer
MCDONALD=McDonald
MCMILLER=McMiller
Etc...


When I get an input from the field as

123 Quality Drive MCDONALD Road CA USA

I should get the out put as

123 Quality Drive McDonald Road CA USA.



Any thoughts ?

Regards,
Shree
Regards,
Shree
785-816-0728
robjones
Participant
Posts: 24
Joined: Tue Nov 18, 2008 3:12 pm
Location: London

Re: String Replace with Mixed Case

Post by robjones »

Can there only be one single occurence of a word to be replaced, or could you have for example:

123 OCONNELL Drive MCDONALD Road CA USA
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

There could me more then one occerence. Your example senario may also occer.
Regards,
Shree
785-816-0728
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You have quite a few options

1.) Split each row into multiple lines with 2 extra columns - line number, column number. Then use individual search and join them back into one line.
2..) Formatting commands outside datastage with your parameter values (a=b) as referenced file
3.) Load your reference file in any dbms like Oracle and use regular expression string


Or use QualityStage
Post Reply