How to prevent rounding off in ds

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
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

How to prevent rounding off in ds

Post 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?
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post by yimwai »

In the administration environment properties, I set "APT_DECIMAL_INTERM_ROUND_MOD" as discard and unpresentable fractional digits.
but seems nothing changed
prakashdasika
Premium Member
Premium Member
Posts: 72
Joined: Mon Jul 06, 2009 9:34 pm
Location: Sydney

Post 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.
Prakash Dasika
ETL Consultant
Sydney
Australia
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post by yimwai »

but no matter set the property , it also does round off
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yimwai
Participant
Posts: 46
Joined: Thu Jul 01, 2010 9:34 pm

Post 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"
Post Reply