Removal of Special Character

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
shobhit_vk_gupta
Participant
Posts: 14
Joined: Wed May 05, 2010 1:24 am

Removal of Special Character

Post by shobhit_vk_gupta »

Can anybody tell how to remove special characters from a string in DataStage?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes but, before we do, first explain why these characters are "special" and whether you have the permission of the owner of the data to make such a change.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shobhit_vk_gupta
Participant
Posts: 14
Joined: Wed May 05, 2010 1:24 am

Removal of Special Character

Post by shobhit_vk_gupta »

Yes I do have permission of the owner. This was the smal requirement to do AphaNumeric comparision on two columns. So thats why I was trying to remove special characters from the column
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No-one can help you unless you can (and do) explain exactly what you mean by "special characters". By itself that statement means nothing, unfortunately.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Except for Special Ed.

He's definitely a special character.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shobhit_vk_gupta
Participant
Posts: 14
Joined: Wed May 05, 2010 1:24 am

Post by shobhit_vk_gupta »

Special characters are like:

!@#$%^&*()_-+={}[]|\:";'?><,./~`

In simple words any non Alphanumeric characters are special characters
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use external filter

Code: Select all

Filter command : sed "s/[^0-9A-Za-z]//"
You are the creator of your destiny - Swami Vivekananda
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Philosophically, they're not special, they're just non alphanumeric.

Code: Select all

Convert("!@#$%^&*()_-+={}[]|\:;'?><,./~`" : '"', "", InLink.TheString)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shobhit_vk_gupta
Participant
Posts: 14
Joined: Wed May 05, 2010 1:24 am

Post by shobhit_vk_gupta »

I am given examples of Non Aplhanumeric Codes. Kindly let me know if their is any general logic.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You mean other than what people have already posted? :?

Think about what it is you need to accomplish, you should be able to solve this. You can either build a list of everything you want to delete and then do so (one of the solutions posted) or build a list of everything you want to keep and then delete everything else (the other solution posted). If you want to do this all "in DataStage" the same function can be used for both - Convert() - with one being a little simpler than the other while the 'better' solution (the latter, IMHO) is a little trickier but will be quite interesting and easy to understand once you see it.

Give this a shot and let us know if you have any specific questions.

ps. Both methodologies and the whole issue of "special" characters have been discussed here ad nauseam. A proper Exact Match search should turn them up.
-craig

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