Importing Decimal field with commas

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
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Importing Decimal field with commas

Post by a2love »

Hi,

I'm attempting to import a field containing commas as well as decimals within the number set .

i.e.
123,020.13
987,876.00

The field is defined as decimal, however it appears it does not like the commas. I recieve the following error:

Warning:
Sequential_File_0,0: Field "huon_prem" has import error and no default value; data: {8 , 8 1 6 . 0 0}, at offset: 43 [impexp\group_comp.C:5913]

Should I define different field types? search and remove comma's with transformer?

What do you think is my best approach?

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

Post by ray.wurlod »

Welcome aboard. :D

Read them as VarChar (or Char, if fixed width) and use a Convert() function in a Transformer stage to remove the commas. You can effect the data type conversion in the same expression.

Code: Select all

StringToDecimal(Convert(",", "", InLink.TheNumber))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Post by michaeld »

...you can see if you can change the default decimal format

if you're going to run a function like convert then make sure you do it in a MODIFY stage. A transformer stage is a waste of resources for something like this.
Mike
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Mike, can you be a bit more specific about where one can change the default decimal format in a parallel job? Are you perhaps referring to the NUMERIC category in an NLS locale?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Post by a2love »

Thanks! Convert worked perfectly.

And Roy thanks for the welcome :)

Cheers,
Adam
Adam Love
Post Reply