Removing (,/ -) from the phone column
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
OK, here's the final version.
I also moved the numbers to the front of the ValidChars string because they should occur more frequently in the data than alpha or other chars.
Tony
Code: Select all
FUNCTION StripChars(Arg1)
Equate ValidChars to "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%"
RetValue = ""
For i = 1 to Len(Arg1)
TestChar = Arg1[i,1]
If Index(ValidChars, TestChar, 1) > 0 Then
RetValue := TestChar
End
Next i
Ans = RetValue
RETURN(Ans)
Tony
Removing (,/ -) from the phone column
Thank you all very much on providing the information. I really appreciate the help and advice and taking out time to help me resolving this issue. Thanks for the routine, it realy made my life little easy.
Thanks
Raj
Thanks
Raj
Removing ,/-)
Hi
I hope this very simpale. in the datastage Trim function is there.
Trim(ur string,",", A) that means remove ", " from ur string or ur fields..
please check it will work now..
rds
mandyli
I hope this very simpale. in the datastage Trim function is there.
Trim(ur string,",", A) that means remove ", " from ur string or ur fields..
please check it will work now..
rds
mandyli
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Not unless you provide an expression or a quoted string as the third argument, for example Trim(string, ",", "A").
However, the Trim function can only remove occurrences of one character, to remove six would require six applications of the Trim function. It is not possible to provide a general solution using the Trim function.
Do become familiar with the other functions. Open up the on-line help from Designer, go to the topic "BASIC Tasks" and from there examine the data conversion and formatting topics, which will introduce you to the most commonly used functions in these categories.
It's always best to choose the right tool for any job; for this job Trim simply isn't the right tool.
(DataStage training can be had in Singapore - find out where by visiting the Ascential web site.)
However, the Trim function can only remove occurrences of one character, to remove six would require six applications of the Trim function. It is not possible to provide a general solution using the Trim function.
Do become familiar with the other functions. Open up the on-line help from Designer, go to the topic "BASIC Tasks" and from there examine the data conversion and formatting topics, which will introduce you to the most commonly used functions in these categories.
It's always best to choose the right tool for any job; for this job Trim simply isn't the right tool.
(DataStage training can be had in Singapore - find out where by visiting the Ascential web site.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I did have a requirement for returning alphanumeric before and the method I used was
Convert(Oconv(Oconv(FieldIn,"MC/A"),"MC/N"),"",FieldIn)
If you did need to keep some non alphanumeric characters you could use
Convert(Convert("#$%","",Oconv(Oconv(FieldIn,"MC/A"),"MC/N")),"",FieldIn)
not sure how this compares with the datastage routine speedwise though.
Regards
Nick
Convert(Oconv(Oconv(FieldIn,"MC/A"),"MC/N"),"",FieldIn)
If you did need to keep some non alphanumeric characters you could use
Convert(Convert("#$%","",Oconv(Oconv(FieldIn,"MC/A"),"MC/N")),"",FieldIn)
not sure how this compares with the datastage routine speedwise though.
Regards
Nick
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Oconv (and Iconv) can handle a multi-valued list of conversion specifications, which are applied one after another.
So, even more brief:
This is a good way to generate an SDK timestamp (one with no delimiters).
So, even more brief:
Code: Select all
Convert(Convert("#$%","",Oconv(FieldIn,"MC/A":@VM:"MC/N"),"",FieldIn)
Code: Select all
Oconv(TheDate, "DYMD[4,2,2]":@VM:"MCN") : " 00:00:00"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA