Branch in a job conditional on parameter

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
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Branch in a job conditional on parameter

Post 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.
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post 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.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
truenorth
Participant
Posts: 139
Joined: Mon Jan 18, 2010 4:59 pm
Location: San Antonio

Post by truenorth »

Thanks, Roland. You reinforced our leaning toward the Transformer approach.
Todd Ramirez
Sr Consultant, Data Quality
San Antonio TX
Post Reply