datastage function
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
datastage function
Hi All,
I have a column that contains data such as
notes=dsadssa, sdsaddsa, dsaddfdfd, fdfdfdsfdsfds
whereever there is comma(followed by single space) I have to write a semi colon.
expected output:
notes=dsadssa;sdsaddsa;dsaddfdfd;fdfdfdsfdsfds
can someone please let me know how can I do this datastage
Thanks
pavan
I have a column that contains data such as
notes=dsadssa, sdsaddsa, dsaddfdfd, fdfdfdsfdsfds
whereever there is comma(followed by single space) I have to write a semi colon.
expected output:
notes=dsadssa;sdsaddsa;dsaddfdfd;fdfdfdsfdsfds
can someone please let me know how can I do this datastage
Thanks
pavan
Re: datastage function
If always you will get the single space after comma?
Trim (col,' ',':')
Or
You can use convert function too.
DS User
Trim (col,' ',':')
Or
You can use convert function too.
DS User
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Search DSXchange for the pxEreplace function, which will handle your requirement even if there are spaces and commas in your data.
Otherwise do what SURA was attempting to suggest - Trim() to get rid of the spaces and Convert() to change the commas to semi-colons.
Otherwise do what SURA was attempting to suggest - Trim() to get rid of the spaces and Convert() to change the commas to semi-colons.
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: 263
- Joined: Fri Sep 23, 2005 6:49 am
datastage function
I Apologize, actualy it is other way around..
where ever there are semi-colons, I have to replace them with , (followed by single space)
notes=dsadssa;sdsaddsa;dsaddfdfd;fdfdfdsfdsfds
desired output:
notes=dsadssa, sdsaddsa, dsaddfdfd, fdfdfdsfdsfds
how can I do it using convert function
Thanks
where ever there are semi-colons, I have to replace them with , (followed by single space)
notes=dsadssa;sdsaddsa;dsaddfdfd;fdfdfdsfdsfds
desired output:
notes=dsadssa, sdsaddsa, dsaddfdfd, fdfdfdsfdsfds
how can I do it using convert function
Thanks
Code: Select all
Convert(";",", ",input_column)
Try this and let us know!
pandeeswaran
-
- Premium Member
- Posts: 87
- Joined: Mon Feb 18, 2008 3:58 pm
- Location: Sacramento, CA
I have seen this posted on DSXChange before, but I have not found it to be true. I ran a quick test, using the "Convert" solution and found it worked per the o/p's requirement. Is it possible this is how Convert worked in earlier versions? I am using 8.1.Convert() replaces single character by another single charcter.
Code: Select all
Convert(';',', ',DSLink2.RawData)
Convert() will not work here. As Pandeesh mentioned, it replaces single characters with other single characters--";" with ",". It will not replace a single character with a string of characters--";" with ", ".
As mentioned already, pxEreplace() for parallel is available for installation and will serve the purpose...also you can write your own parallel routine if you wish, use a Basic Transformer instead or even an external filter (awk or sed for example).
Regards,
As mentioned already, pxEreplace() for parallel is available for installation and will serve the purpose...also you can write your own parallel routine if you wish, use a Basic Transformer instead or even an external filter (awk or sed for example).
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: