Multiplying Decimal fields

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Multiplying Decimal fields

Post by snt_ds »

Hi,

I have two fields col1 , col2; which are defined as Decimal(26,8) and Decimal(20,2).
I am just multiplying these two fields in the transformer stage and passing this value to the target, which is defined as Decimal(25,7). I had a strange truncation in one field of my output.

Eg:
Col1 = -248733599.300000
Col2 = 0.94077800

Target Column = Col1 * Col2

Output should be = -234003098.0822554

But, in datastage target i am getting = -234003098.082255
It is truncatiing the last '4' from the output, even the scale length is of value 7.
Can anyone suggest me on my issue?


Thanks and Regards,
snt_ds
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Since you've lost the '16th digit' from the computation, I'm assuming you are a victim of the EXACT_NUMERIC setting in the uvconfig file - which defaults to 15. Search the forums for a number of discussions on that setting.

You may end up needing to bump it or switch to 'string math', which the posts you find should address as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Hi Craig-

Thanks for your reply!
As you said, I have checked our uvconfig file settings. The EXACT_NUMERIC variable is '15' by default; which is pretty much higher than my target record's precision which is just '7'. (-234003098.0822554).

I have another target records which are outputting fine.
Eg:
Col1 = -270815.2500000
Col2 = 0.12793780

Output = -34647.5072915
In the above case i could get the 7th place value.


Thanks and Regards,
snt_ds
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

EXACTNUMERIC is total significant digits, not just the ones to the right of the decimal place. That's why Craig originally reacted to "the 16th position". In your second, successful, example, the total significant digits is less than or equal to 15, the value of EXACTNUMERIC.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Ray,

I got it what you and Craig explained.

But just wanted to confirm with you if, this EXACTNUMERIC parameter in uvconfig file doesn't count signs ('-') or decimal points (.) from the values.
Please let me know.

It means in my first post, i had value (-234003098.0822554) of only digits count 16.
So, EXACTNUMERIC parameter overrides with default count 15 which lead to the truncation of last digit.

Thanks and Regards,
sny_ds
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Hi Again,

now i have found onemore record which contains 16 digits value in output(78944153.69966222).

Col1:=-84083416.1800000
Col2:=0.93887900

Output:=-78944153.6996622.

Thanks and Regards
sny_ds.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Switch to using the string math functions and see how it handles all of your examples. Check the BASIC pdf manual for SMUL which is String MULtiplication, all of the others are there as well.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

EXACTNUMERIC counts digits. It does not count decimal placeholder or sign designator.
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