How to remove comma from numeric field

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
csc.datastage
Premium Member
Premium Member
Posts: 23
Joined: Wed Sep 10, 2008 4:46 pm
Location: USA

How to remove comma from numeric field

Post 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!
Focus on ABC: Audit , Balance and Control..
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Use the CONVERT() function.

Code: Select all

CONVERT(",","",in.numericfield)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
csc.datastage
Premium Member
Premium Member
Posts: 23
Joined: Wed Sep 10, 2008 4:46 pm
Location: USA

Post 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!
Focus on ABC: Audit , Balance and Control..
sharantheboss
Participant
Posts: 14
Joined: Mon Mar 23, 2009 12:57 am
Location: INDIA

Re: How to remove comma from numeric field

Post 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!
DS Info
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Ereplace() is the least efficient of the three suggestions offered.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply