Decimal variable scale issue

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
banactp
Participant
Posts: 52
Joined: Tue Feb 22, 2005 2:55 pm

Decimal variable scale issue

Post by banactp »

I have a decimal[24,6] value 'D1' and a decimal[20,2] value 'D2' going into a parallel transformer. Within that transformer I have a stage variable 'SV' declared as decimal[20,2].

In the transformer, I set SV = D1 * D2. I then convert SV to a string using DecimalToString( SV, "fix_zero,suppress_zero" ) and print the result to a file.

The problem is that I am seeing more than 2 decimal places in the output. For example,

Code: Select all

D1 = 0.71449
D2 = 258307.5

0.71449 * 258307.5 = 184558.125675
which is the correct numerical value, except I want the result (and expected it to be) rounded to 184558.13.

Does this occur because DecimalToString() is displaying an underlying value which is actually stored with more than two decimal places? Or am I confused about the meaning of "precision" and "scale" in DataStage decimal variable declarations?

TIA
Post Reply