Page 1 of 1

Remove leading zeros from decimal datatype

Posted: Mon Dec 27, 2004 3:43 pm
by bsreenu
Hi,

I have PX job that reads the DECIMAL(9,2) type data from a UDB table and write into a sequential file. Since the data type is DECIMAL(9,2) for one the column, the leading zeros were also written into sequential file.

Example: Output data in Seq file:
Column A
0000002.50
0000001.00

Expected output
Column A
2.50
1.00

Can someone please let me know how to remove leading zeros.
Is there any function in UDB which does this. So that i can modify the SQL and I don't have to do any transformations in datastage.

Posted: Mon Dec 27, 2004 8:05 pm
by T42
Within a transformer, convert the decimal to varchar, and trim the leading zeros. Be careful, sometimes the values have negative signs. You will need to work your logic around that.

This is not the problem of the database. It is how DataStage internally hold values in decimal.

Posted: Tue Jan 18, 2005 6:04 am
by l_homme_de_rio
Hi
Use as an Out_format
something like %G

All the best