Page 1 of 1

How to remove comma from numeric field

Posted: Fri Apr 10, 2009 3:17 pm
by csc.datastage
Hi ,

My input data is as follows:

Col A ( Number)
1,002.03
123,002.34
1,234,002.96

How do I remove comma (,) from numbers in datastage.
I know I can remove it using Unix but can it be done using Datastage?
My desired output is:


1002.03
123002.34
1234002.96

Thanks for all your help!

Posted: Fri Apr 10, 2009 8:44 pm
by DSguru2B
Use the CONVERT() function.

Code: Select all

CONVERT(",","",in.numericfield)

Posted: Sat Apr 11, 2009 4:04 pm
by ray.wurlod

Code: Select all

Iconv(InLink.TheNumber, "MD2")
is an alternative; it has the advantage that it will remove currency symbols as well.

Posted: Sat Apr 11, 2009 4:45 pm
by chulett
I'm curious as to the 'why' of this... is the target of your 'desired output' a database table for instance? Flat file? Something else entirely?

Posted: Mon Apr 13, 2009 2:52 pm
by csc.datastage
chulett wrote:I'm curious as to the 'why' of this... is the target of your 'desired output' a database table for instance? Flat file? Something else entirely?
Target is a flat file with which We need to perform mathematical calculations using datastage.

Thanks for all your help!

Re: How to remove comma from numeric field

Posted: Wed Apr 15, 2009 5:52 am
by sharantheboss
Hi,

Use the function Ereplace (string, substring, replacement )
In your case it would be Ereplace(Col A,',','')

Regards
Boss :D



csc.datastage wrote:Hi ,

My input data is as follows:

Col A ( Number)
1,002.03
123,002.34
1,234,002.96

How do I remove comma (,) from numbers in datastage.
I know I can remove it using Unix but can it be done using Datastage?
My desired output is:


1002.03
123002.34
1234002.96

Thanks for all your help!

Posted: Wed Apr 15, 2009 1:27 pm
by ray.wurlod
Ereplace() is the least efficient of the three suggestions offered.