Remove leading zeros from decimal datatype

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
bsreenu
Participant
Posts: 22
Joined: Mon Aug 16, 2004 3:57 pm

Remove leading zeros from decimal datatype

Post 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.
T42
Participant
Posts: 499
Joined: Thu Nov 11, 2004 6:45 pm

Post 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.
l_homme_de_rio
Participant
Posts: 17
Joined: Fri Jul 30, 2004 1:16 am

Post by l_homme_de_rio »

Hi
Use as an Out_format
something like %G

All the best
Post Reply