Page 1 of 1

Suppressing leading Zero's of Decimal Data type

Posted: Wed Feb 13, 2008 11:34 am
by bensonian
I was wondering if there is a function that could drop all the leading zeros off of a Decimal data type.

Posted: Wed Feb 13, 2008 12:06 pm
by chulett
A decimal data type doesn't have leading zeroes.

Posted: Wed Feb 13, 2008 12:07 pm
by kcbland
When? When writing to a sequential file? When loading into a database? Why do you have a problem with leading zeroes? Is the Peek stage confusing you?[/url]

Posted: Wed Feb 13, 2008 2:14 pm
by bensonian
Actually i was doing a division operator on a varchar data type and even used type conversion function to change it to decimal data type. StringtoDecimal(). Still in the sequential file i could see leading zeroes. My decimal data type is of length 12 scale 8.

Posted: Thu Feb 14, 2008 1:52 am
by priyadarshikunal
bensonian wrote:Actually i was doing a division operator on a varchar data type and even used type conversion function to change it to decimal data type. StringtoDecimal(). Still in the sequential file i could see leading zeroes. My decimal data type is of length 12 scale 8.
yes the decimal data type ammends leading and trailing 0 to fit the exact length as you specify

but while writing it to Database it is removed


but when you write it to sequential file leading and trailing zeros will be there
but that will not make any difference while performing calculations

Since float and double doesn't ammends leading and trailing 0

You may convert the output to float or double from decimal


Just a suggestion, You may find some other way also.

Regards,