Page 1 of 1

Implementing business rules

Posted: Fri Mar 23, 2007 11:58 am
by cmermingas
<p>I'm relatively new to DataStage and I've found that it's very cumbersome to maintain complex business rules the way we do it. I'm wondering if there's a better way.</p><p>Say that we have business rules like these:</p><pre>
column a column b column c action
-------- -------- -------- --------
a1 b1 c1 Action 1
a2 b2 c2 Action 2
a3 b3 c3 Action 3
ELSE Action 4</pre><p>Here, a1, b1, etc. can be either fixed values or patterns (such as "*Inc").</p><p>We implement things like this by using a transformer with several outputs and we define contraints within the transformer to send each record through its corresponding output, depending on which rule (set of patterns) the record matches. The problem with this is that the constraints in the transformer become huge IF-ELSE statements that are very difficult to maintain and are prone to human mistakes.</p><p>Is there any stage (in either server or parallel jobs) that allows to implement business rules like this in a better way (i.e. <b>without</b> the IF-ELSE statements)?</p><p>Thank you!</p><p>Carlos</p>

Posted: Fri Mar 23, 2007 4:14 pm
by us1aslam1us
Welcome Aboard!!!

I guess there is nothing as specific but if you can share your logic someone from here can shred it or show alternative approach like pattern matching.

Posted: Fri Mar 23, 2007 5:25 pm
by ray.wurlod
When they're this complex the usual recommendation is to move the logic into one or more routines that are called from the Transformer stage.

Some years back I implemented such a scheme, using late binding of the business rules routines - the actual routine executed was not determined until the values of the selector column was known, and could be different for different rows and different columns within the same row.

So, yes, it's do-able.

Posted: Fri May 25, 2007 3:56 pm
by Minhajuddin
Hi Carlos!
Welcome to DSXchange! :D

You may try using the Stage variables here.
Stage variables are available in transformers.
It will make your code more manageable.
And moreover it reduces evaluation of the same expression again and again.