Standard approach: Insert If condition before doing calculation that defaults Column A = 0 (or any other branch action you wish) if Column D = 0. This will prevent divide by zero.tanaya.deshpande@tieto.co wrote:I am calculating a column like this
Column A = (Column B+Column C)/Column D
Now if suppose a zero value comes at Column D then the Datastage will through an exception ..or an error so how can I handle this..
????
What is divide by zero rule.
Moderators: chulett, rschirm, roy
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
After further thought, it occured to me that this issue should start in the requirements. Any amount that is intended to be used as a denominator should have error handling for zero before it gets to the calculation. In COBOL, this is a standard item for an entire paragraph that does nothing but validate fields. Dates are also handled there, along with any more specific constraints on the data (not more than x days old, etc.)
In DS, I'd probably look first at either a filter stage or have constraint/branches on the transformer. I usually see a requirement for a reject report that needs to display the entire rejected record.
Do you trust your data source? Sometimes it's not (just) paranoia to answer "no".![Wink :wink:](./images/smilies/icon_wink.gif)
In DS, I'd probably look first at either a filter stage or have constraint/branches on the transformer. I usually see a requirement for a reject report that needs to display the entire rejected record.
Do you trust your data source? Sometimes it's not (just) paranoia to answer "no".
![Wink :wink:](./images/smilies/icon_wink.gif)
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
-
- Participant
- Posts: 94
- Joined: Sun Jul 18, 2010 11:35 pm