Replace command

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
edison
Participant
Posts: 19
Joined: Mon Sep 17, 2007 4:28 pm

Replace command

Post by edison »

remove unnecessary character from First Names(Cominf from source). Valid characters are 0-9, A-Z, ^-_^.,!& ''
All other characters are considered invalid and should be replaced with ' '"

need replace command to use in tranformation logic
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no replace command. There is, however, a Convert() function. Convert all non-required characters to "".

Tip: initialize a stage variable to contain a full list of non-required characters.
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 »

... or store the valid characters (if smaller) and do the "double convert" that's been posted here before.
-craig

"You can never have too many knives" -- Logan Nine Fingers
edison
Participant
Posts: 19
Joined: Mon Sep 17, 2007 4:28 pm

convert()

Post by edison »

I tried to do this stage variables,the field populating empty

Convert('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!&^-_\,','',upcase(LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)) - StageVar1

Convert(StageVar1,str(' ',len(StageVar1)),LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Remove the str function in second convert.
edison
Participant
Posts: 19
Joined: Mon Sep 17, 2007 4:28 pm

convert()

Post by edison »

I tried to do this stage variables,the field populating empty

Convert('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!&^-_\,','',upcase(LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)) - StageVar1

Convert(StageVar1,LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Convert requires three arguments.
-craig

"You can never have too many knives" -- Logan Nine Fingers
edison
Participant
Posts: 19
Joined: Mon Sep 17, 2007 4:28 pm

Convert()

Post by edison »

I tried to do this stage variables,the field populating empty

Convert('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!&^-_\,','',upcase(LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)) - StageVar1

Convert(StageVar1,(' ',len(StageVar1)),LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Bejeebus, kind of like a broken record. If it didn't work before, why would it suddenly start working now? :?

What happens if you use this as your derivation:

Convert(StageVar1,"",LNK_ARNGM_CLASS.ACCOUNT_FIRST_NAME)
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

By asking you to remove the str function, I meant to change it with the character which must replace your "special characters".

If you want them to be replaced by blank space, use ' '.
Post Reply