Page 1 of 1
remove the zeros from the left of a decimal field
Posted: Mon Jan 14, 2008 11:47 pm
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.
Posted: Tue Jan 15, 2008 12:25 am
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.
Re: remove the zeros from the left of a decimal field
Posted: Wed Jan 16, 2008 8:29 am
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
Re: remove the zeros from the left of a decimal field
Posted: Wed Jan 16, 2008 9:09 am
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 !!
this is new function in transformer for version 8X????
Fabs() function
Posted: Wed Jan 16, 2008 1:58 pm
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.
Thanks
Posted: Wed Mar 25, 2009 3:17 pm
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