Page 1 of 1

Branch in a job conditional on parameter

Posted: Tue May 07, 2013 8:37 am
by truenorth
How can I use a parameter, say FLAG_X, to branch in two different directions in a parallel job? Eventually the two paths will converge somewhere in the job, perhaps in a Transformer. So in effect, I want to skip a section of a job based on the value of that parameter. The job would look like this:

DB2 --> check FLAG_X value --> if 1 --> go to link1 --> ... TransformerZ
--> otherwise go to link2 --> ... TransformerZ (same Transformer as above)

I've looked at Switch but it looks at a file/table columns, not parameters.

I'm also considering a Transformer to do a constraint on FLAG_X, with Otherwise, and the two paths meet at a Funnel (?) before going into TransformerZ.

Any other suggestions?

Thanks in advance.

Posted: Tue May 07, 2013 9:02 am
by BI-RMA
Another possibility is to use a Filter-Stage instead of a Transformer. However, the filter-command of the filter-stage is applied as an interpreter-command for each row. The RedBook "InfoSphere DataStage Parallel Framework Standard Practises" states:

"The Filter and Switch stages evaluate their expressions at runtime for every input row. Because it is compiled, a parallel Transformer with output link constraints is faster than a Filter or Switch.
Use of Filter and Switch stages must be limited to instances where the entire filter or switch expression must be parameterized at runtime. In a Parallel Transformer, link constraint expressions, but not data, is fixed by the developer." (page 147)

So use a parallel-transformer when only one side of the filter-expression needs to be parameterized. If you need to parameterize both sides - or even more complex conditions - , use a filter- or switch-stage.

Posted: Tue May 07, 2013 9:12 am
by truenorth
Thanks, Roland. You reinforced our leaning toward the Transformer approach.