how to get the result in Transformer particular letters

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
deesh
Participant
Posts: 193
Joined: Mon Oct 08, 2007 2:57 am

how to get the result in Transformer particular letters

Post by deesh »

Hi,

My file input is like

INPUT OUTPUT
1A3D5G ADG
A2DG57 ADG
&$A#DG ADG
(*AD&G ADG

hot to get the output like that.
Last edited by deesh on Sat Dec 01, 2012 4:27 am, edited 1 time in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The transformation

Code: Select all

Convert('0123456789','',In.INPUT)
should do the trick of removing all numeric characters from the string, if that was your intent.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use the "double convert" trick to remove all non-alphabetic characters from the string. This has been discussed many times on DSXchange. In your particular case (keep only alphabetic characters) the expression is:

Code: Select all

Convert(Convert("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", InLink.TheString), "", 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Thanks Ray, I only looked at the first line and thought that the OP wanted only to remove numbers from a string; upon re-reading I saw that what I posted was incomplete. I like your solution, I don't recall having seen that before - it is elegant and simple and quick.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It popped up here a number of years ago, don't recall who first posted it but some searching might turn it up. And I remember thinking that as a technique it was quite... cool. 8)
-craig

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