Truncating the number

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vinodhraj
Participant
Posts: 53
Joined: Mon Sep 12, 2005 6:51 am

Truncating the number

Post by vinodhraj »

Hi,

I want to truncate a number in transformer of datatype
Decimal(18,9) to Decimal(10,6).

Thanks

Vinod
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Truncating the decimal part is easy, either with a formatting option or a simple INT(In.Column*1000000)/1000000. But what is your rule for converting 18 digits to 10?
dprasanth
Charter Member
Charter Member
Posts: 90
Joined: Fri Oct 07, 2005 7:55 am

Re: Truncating the number

Post by dprasanth »

vinodhraj wrote:Hi,

I want to truncate a number in transformer of datatype
Decimal(18,9) to Decimal(10,6).

Thanks

Vinod
Try this conversion
Left((Field(var1,".",1)),10):".":Left((Field(var1,".",2)),6)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To paraphrase Arnd's question: what happens if the number is too large for Decimal(10,6) ?
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