Decimal Conversion & formatting

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
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Decimal Conversion & formatting

Post by wjfitzgerald »

Hi,

I am sure this question will have been answered before, but i have spent an age doing searches on the topis and cannot find what i need.

This should be relatively simply, so hopefully some one can give me a quick guide please.

I have a decimal field (9999.99) which i need to write to a file. i am using the decimal to string conversion routine to convert to varchar to include in file data. the value in the field is 100.00. when i use the suppress zero option it is written to the file as 100, without this option it is written as 0100.00.

So here's the question, is it possible to suppress the leading zeros but keep the trailing ones, ie write 100.00 to the file?

Thanks as always

John Fitz
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

I had a similar issue and I think I did a TRIM after doing the decimal to String conversion. The other solution was to use the stage variables.
Use the decimal to String function. Use Field function to get the precision part and decimal part. Do a Trim on both the stage variables. Concat the stage variables in the derivation.

Do a search with Search for Author as richdhan. This was discussed before.


HTH
--Rich
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

thanks rich, i'll try and find you previous post.
John Fitz
Post Reply