Issue with Decimal Field conversion during output

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
meemaza
Participant
Posts: 3
Joined: Sat Feb 10, 2007 1:30 am

Issue with Decimal Field conversion during output

Post by meemaza »

Hi everyone,

I have some strange requirements.
I have several amount fields with the data type Decimal(26,3),
While extracting into the file I have to produce data like:
1. empty value if the data value is 0.00
2. non-padded zero data with, currently it produce values padded with zero
e.g. Data is = 1234.560
output- now it is coming like 00000000000000000001234.560
but I dont want the initial zeros while extracting the values.

I wrote a custom c routine for this but it is very slow...
Pleae give me any suggestion now.

Thanks
Arvind
sudhakar_viswa
Participant
Posts: 85
Joined: Fri Nov 18, 2005 5:35 am

Post by sudhakar_viswa »

Hi,

Use numeric function to round the value.
Else convert into char and send it

Regards,
-- sudhakar
i need to know datastage
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The leading zeroes are an artifact of the data viewer. They are not really there when a decimal data type is stored. Ignore them - they are included to prove that the precision and scale are being addressed correctly.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
meemaza
Participant
Posts: 3
Joined: Sat Feb 10, 2007 1:30 am

Post by meemaza »

sudhakar_viswa wrote:Hi,

Use numeric function to round the value.
Else convert into char and send it

Regards,
-- sudhakar
Thanks Sudhakar,
Basically I have another requirement, the decimal places in the amount field has to be dynamically set based on the currancy we are using for that row, so I have written small C program to do that and called it in transformer, it warks great no doubt about that, but it degrades the perfornamce, since it is external routine to be called in the transformer, so wanted to see is there any way I can improve the performance by doing other work around.

Currently we have 31 amount fields of type Decimal(26,3) and have to use that function for all the 31 amounts. our number records are around 100 millian and it takes around 55 to 65 minutes to export data into the file based on the load on the box. We use the file because we have to transfer the data into other system on other box. So can not use dataset.

Any thought would be appreciated.

Thanks
Arvind,
meemaza
Participant
Posts: 3
Joined: Sat Feb 10, 2007 1:30 am

Post by meemaza »

ray.wurlod wrote:The leading zeroes are an artifact of the data viewer. They are not really there when a decimal data type is stored. Ignore them - they are included to prove that the precision and scale are being a ...
Thanks Ray,
I could not able to read your reply since was under "premium contents". however I know that these fields are never stored into a decimal data type, just wanted to work around to get away with that, I have used several funcionality such as DecimalToString and "Fix_Zero" option, but it does not help me lot.

I have to return empty when ever amount is 0.00 so that does not help me.

Even I tried to use basic transformer to use the Oconv function and it gave me what I wanted with the proper format, but it is too slow!

Thanks
Arvind,
Post Reply