Page 1 of 1

How to prevent rounding off in ds

Posted: Tue Sep 28, 2010 8:49 pm
by yimwai
When the type of input column (or the source column )is decimal(13,4) but the output is decimal(13,2) ,the value will be rounded off .
In DB2 enterprse stage,I can use 'cast' function to prevent rounding off,but how can i do in such as aggregate stage.
Is there any setting option to avoid rounding off in datastage?

Posted: Tue Sep 28, 2010 9:08 pm
by yimwai
In the administration environment properties, I set "APT_DECIMAL_INTERM_ROUND_MOD" as discard and unpresentable fractional digits.
but seems nothing changed

Posted: Tue Sep 28, 2010 9:47 pm
by prakashdasika
The datatype of calculated filed in aggregator will always be float. Is is not Decimal but you can do a conversion in transformer stage after the aggregation. Use DfloatToDecimal() function.

Posted: Tue Sep 28, 2010 10:00 pm
by ray.wurlod
The Aggregator stage also has a general and a per-column DecimalOutput property. (It may not be called precisely that - I answered from memory.)

Posted: Tue Sep 28, 2010 10:02 pm
by yimwai
but no matter set the property , it also does round off

Posted: Tue Sep 28, 2010 10:54 pm
by ray.wurlod
If you use conversion functions in a downstream Modify or Transformer stage you can use the "rtype" argument to specify rounding, truncation, etc.

Posted: Wed Sep 29, 2010 9:01 pm
by yimwai
but can anyone explain why the envrionment variable "apt_decimal_interm_round_mode" does't work.
I just select one record 0.7499 (decimal(13,4)) and put it in an decimal(13,2) column,the results are both 0.75 whether set the variable as "to nearest" or "discard rounding"