Extract only "DIGITS" from a string?

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
rockr
Participant
Posts: 17
Joined: Thu Feb 01, 2007 3:56 pm

Extract only "DIGITS" from a string?

Post by rockr »

Hi ,

Is there a function in parallel similar to DIGITS() in server. I have a string like

Ex: bnfcv56567uyuh

In a server job DIGITS(bnfcv56567uyuh) gives "56567" , I need the same functionality in a parallel job. How can I acheive it ?

The number in the string can be of any length, so I cannot extract the number by the position.

Please Help
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not a place where I can check the functions, but I think this particular one and it's functionality is missing in PX. If you just have lowercase characters to worry about, you can use

Code: Select all

CONVERT('abcdefghijklmnopqrstuvwyz,'',In.Column)
Add uppercase and punctuation to that list if necessary. Basically the approach is to convert anything that is not a digit to empty in the string.
divine
Premium Member
Premium Member
Posts: 149
Joined: Fri Oct 15, 2004 12:13 am
Location: Toronto,divine_auro@yahoo.co.in
Contact:

Re: Extract only "DIGITS" from a string?

Post by divine »

http://dsxchange.com/viewtopic.php?p=26 ... 65a#269928

treat every character as special character except digits

:?

or you can use CONVERT()
Last edited by divine on Thu Feb 14, 2008 8:42 am, edited 1 time in total.
With Regards
Biswajit
rockr
Participant
Posts: 17
Joined: Thu Feb 01, 2007 3:56 pm

Post by rockr »

Thanks ArndW !

Works just great !
Post Reply