filter strings from number

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

filter strings from number

Post by rafidwh »

Hi All,
If I have a colunm where its values is char(number+string) how can i filter only char

suppose my value is "11A234"
"2E4567"

I want to get the output as A and E only

Is there any logic other than the Datastage inbuit functions to handle this

Thanks in advance

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

Post by ArndW »

Since DataStage BASIC is a programming language the answer to your question is "yes, there are ways of doing this via programming other than using one of the inbuilt functions such as ICONV(string,'MCA').". I don't know why you would wish to write your own program code to do this, though.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

This can be easily acheived by CONVERT() function in datastage. But not sure what are you trying to do with "other than the Datastage inbuit functions "
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can write your own, but it will never be as fast as the inbuilt functions.

Code: Select all

FUNCTION StripNonAlphas(TheString)
Ans = ""
CharCount = Len(TheString)
For ch = 1 To CharCount
   Character = TheString[ch,1]
   If Alpha(Character) Then Ans := Character
Next ch
RETURN(Ans)

Are you perhaps planning to come back and bill for tuning the system after an inefficient initial design? :lol:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or, you can also use the builtin transform funtion LETTERS(). That will return you all the alphabets from a mixed character string. That is offcourse, if you want to utilize the built-in functions of datastage.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply