Decimal Scale on Calculation

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
hchellham
Participant
Posts: 2
Joined: Wed Nov 11, 2009 5:28 am
Location: Bengaluru

Decimal Scale on Calculation

Post by hchellham »

Hi Members,

The Data Types and the values are:
InCol (Decimal 24,6) = 000000000000100000.000000
OutCol (Decimal 24,16)

The requirement is to perform the following calculation:
OutCol = ( (InCol * 0.05) /12 ) (Also tried by substituting 12.00)

The output of our job is OutCol = 00000416.6666666667000000

The Desired Output is OutCol = 00000416.6666666666666666 (Please note that the last 16th digit is not rounded too).

Could anyone suggest some methods to acheive the desired output? Thanks in advance!
Regards,
Harish.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

There is a setting for the default decimal scale which is set to 10 (by default).

Try increasing the value from Admin.

Also try decimalToDecimal.
SBSA_DW2
Premium Member
Premium Member
Posts: 37
Joined: Fri Jul 25, 2008 1:24 am

Post by SBSA_DW2 »

the setting mentioned is:

APT_DECIMAL_INTERM_SCALE
Specifies the default scale value for any decimal intermediate
variables required in calculations. Default value is 10.
(page 6-14 of the parallel job advanced user guide)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add environment variable APT_DECIMAL_INTERM_SCALE to your job as a parameter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hchellham
Participant
Posts: 2
Joined: Wed Nov 11, 2009 5:28 am
Location: Bengaluru

Post by hchellham »

ray.wurlod wrote:Add environment variable APT_DECIMAL_INTERM_SCALE to your job as a parameter. ...
Hi,

Thanks everyone!

Setting the value of APT_DECIMAL_INTERM_SCALE as 17 had produced the desired result. When using the value as 16, the last digit came with a rounded off value, hence went for value 17 and declared the target column meta data as (24,16).
Regards,
Harish.
Post Reply