remove the zeros from the left of a decimal field

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
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

remove the zeros from the left of a decimal field

Post by arnie_nits »

Hi,

I have got a decimal field EXT_AMOUNT DECIMAL 11,3. I get the values as 00000000045.22 whereas I need them as 45.22. It is a file load.
Please let me know how to do it.....I have already tried a lot......

Regards
Arnie.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Write the data into the file as Varchar. Convert the data type in a transformer to using DecimalToString() function with suppress_zeros option.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: remove the zeros from the left of a decimal field

Post by SURA »

arnie_nits wrote:Hi,

I have got a decimal field EXT_AMOUNT DECIMAL 11,3. I get the values as 00000000045.22 whereas I need them as 45.22. It is a file load.
Please let me know how to do it.....I have already tried a lot......

Regards
Arnie.
Hi,

You can use Fabs function in Trasnformer.

Regards,
Ram
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Re: remove the zeros from the left of a decimal field

Post by AmeyJoshi14 »

SURA wrote:
arnie_nits wrote:Hi,

I have got a decimal field EXT_AMOUNT DECIMAL 11,3. I get the values as 00000000045.22 whereas I need them as 45.22. It is a file load.
Please let me know how to do it.....I have already tried a lot......

Regards
Arnie.
Hi,

You can use Fabs function in Trasnformer.

Regards,
Ram
Hey !! :o this is new function in transformer for version 8X???? :?:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Fabs() function

Post by ray.wurlod »

No, it's a server job function (DataStage BASIC). It can be used in the BASIC Transformer stage in parallel jobs.

In parallel jobs use the Abs() function, which returns a dfloat result, to remove the sign from a number. To remove leading zeroes the target field must be a string of some kind, and you use DecimalToString() or DfloatToStringNoExp() with appropriate arguments. Once you have a string you can Trim() leading zeroes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hiral.chauhan
Premium Member
Premium Member
Posts: 45
Joined: Fri Nov 07, 2008 12:22 pm

Thanks

Post by hiral.chauhan »

Maveric wrote:Write the data into the file as Varchar. Convert the data type in a transformer to using DecimalToString() function with suppress_zeros option.

Thanks Maveric!

Your tip did the trick for me!!

-Hiral
Thanks,
Hiral Chauhan
Post Reply