Trim with DecimalToString

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

A Decimal column cannot/does not have leading zeroes. Could it be that your input is coming from a text file and is a string? In that case just one StringToDecimal() call is necessary.
sumesh.abraham
Participant
Posts: 153
Joined: Thu May 11, 2006 1:52 am
Location: Bangalore

Post by sumesh.abraham »

Thanks for the reply. You are right;the input comes from a file and in the sequential file's column definition I've mentioned it as Varchar 20, 4 and in the immediate transformer I'm mapping it where the column is Decimal 20,4 which is the expected format for the target Oracle table.
The data is 89 in the sequential file and since the column definition in the transformer is Decimal 20,4;the output link from the transformer will have will be having zeros preceding it. How can I solve this.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Take things step by step. If you do your StringToDecimal conversion and write the resultant decimal column to a PEEK stage, are your leading zeroes gone?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Decimal numbers are always displayed by the data browser and by Peek with leading and trailing zeroes. This mechanism allows you to verify that precision and scale are being accurately handled. Internally, of course, decimal numbers are represented as binary - just a pattern of bits.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply