Search This Blog

22.1.11

DataStage - Triggers and Expressions of a Sequence

Sequence stage has a tab called trigger. This tab gives you a place to specify the expressions on the input links or in other words this tab provides a facility to control the behaviour of job activities inside sequences when executed one after another.





For example we have two job A and Job B. Jobs B should always run once job A finishes successfully. There should not be any warnings in the execution of job A and then only job B's execution should starts. Hence to achieve this we will select appropriate "Expression Type" and "Expression" in trigger tab of the sequence.

In above scenario "Expression Type" would be "OK - (Conditional)" and "Expression" section can be blank. Now what would we write if we have a job which can generate warnings and still we want job B to run. Now in this situation we will be specifying different "Expression Type" and "Expressions". Here we should choose Expression type as Custom - (Conditional) and specify Expression as "DSJS.RUNWARN Or DSJS.RUNOK". This expression will make sure that job B runs even if job A generated warnings or executed cleaned.

"DSJS.RUNWARN and DSJS.RUNOK" are status which can be used in the expression section of sequence. Following is the list of available status which can be used in the expression depending upon the requirement.

DSJS.RUNNING - Job running
DSJS.RUNOK - Job finished a normal run with no warnings
DSJS.RUNWARN - Job finished a normal run with warnings
DSJS.RUNFAILED - Job finished a normal run with a fatal error
DSJS.QUEUED - Job queued waiting for resource allocation
DSJS.VALOK - Job finished a validation run with no warnings
DSJS.VALWARN - Job finished a validation run with warnings
DSJS.VALFAILED - Job failed a validation run
DSJS.RESET - Job finished a reset run
DSJS.CRASHED - Job was stopped by some indeterminate action
DSJS.STOPPED - Job was stopped by operator intervention
DSJS.NOTRUNNABLE - Job has not been compiled
DSJS.NOTRUNNING - Any other status

There are few things we should remember with respect to triggers on sequences and they are as follows:

1 - Job activities in a sequence can have one input trigger and multiple output triggers.
2 - Trigger name must be unique in the activity however you can have multiple same named triggers in a sequence.
3 - Trigger would fire if the source meets the conditions defined in the activity. In our example even if Job A generates warning job B will be executed because trigger expression suffice this condition.
4 - DataStage macros can be used in triggers.

If we use correct and appropriate expressions types and expressions in our sequences then we can control the interconnected activities more efficiently in the sequences for better performance and output.

Happy Working...

No comments:

Post a Comment