function to trim commas between 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
phanikumar
Participant
Posts: 60
Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA

function to trim commas between a string

Post by phanikumar »

Hi All,

I have a requirement where in I need to strip the commas between a string.

Example:

Input:
EQ001,,EQ002,EQ003,,EQ020

The output should be like

EQ001,EQ002,EQ003,EQ020

Any suggestions would be greatly helpful.

Regards
Kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use the pxEreplace() function you can find here on DSXchange.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bhasds
Participant
Posts: 79
Joined: Thu May 27, 2010 1:49 am

Post by bhasds »

Hi Phanikumar,

I was able to get the desired output with-

Code: Select all

Convert(" ",",",CompactWhiteSpace(Convert(","," ","colname")))
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

ray.wurlod wrote:Use the pxEreplace() function you can find here on DSXchange.
I would wait until this thread is resolved before using pxEreplace.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply