Job control in a sequencer

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
SonShe
Premium Member
Premium Member
Posts: 65
Joined: Mon Aug 09, 2004 1:48 pm

Job control in a sequencer

Post by SonShe »

I have a sequencer with a few jobs in it. What I want is Job1 should trigger Job2 when Job1 is either successful or has warnings. Job1 should not trigger Job2 only when Job1 fails.

Job1 --------------> Job2 ------------------->
|
triggers Job2 when Job1 is successful or has warnings

I will appreciate any ideas or help to accomplish this.

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to use a Custom trigger to handle this. For Ran Ok and Warnings, use something like this in the trigger to Job2:

Code: Select all

Job1.$JobStatus = 1 Or Job1.$JobStatus = 2
Note that 'Job1' in the above trigger code is actually the Job Activity stage name that runs Job1.

I'd suggest using an 'Otherwise' trigger to handle the 'not ok' part of this sequence, rather than specifically checking for Aborted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Got confused with your requirement and diagram.

If you want to apply a constraint of "do not perform job2 if job1 fails", then all you need to do is to grab a link to a dummy action and insert the condition of fails to it and use 'otherwise' constraint for the job2 link.

If you want to call job2 on success or warn or job1, then you can have 2 links - one for success and one for warn - and both having job2 at its head, which then leads to a sequence stage with 'any' option.

You can carry forward from the sequence step.
SonShe
Premium Member
Premium Member
Posts: 65
Joined: Mon Aug 09, 2004 1:48 pm

Post by SonShe »

chulett wrote:You need to use a Custom trigger to handle this. For Ran Ok and Warnings, use something like this in the trigger to Job2:

Code: Select all

Job1.$JobStatus = 1 Or Job1.$JobStatus = 2
Note that 'Job1' in the above trigger code is actually the Job Activity stage name that runs Job1.

I'd suggest using an 'Otherwise' trigger to handle the 'not ok' part of this sequence, rather than specifically checking for Aborted.
Craig, thank you for the help. I have another question though not directly related to my first posting. In the same sequencer where I have 3 jobs, if the first one or the second one aborts, the sequencer still continues execution of the subsequent jobs. My understanding is that the sequencer should be able to trap this job level error and act accordingly. Can you please educate me what actually happens here.

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What version of DataStage 7.x do you have? The ability of the sequence to trap job level errors (via the Exception stage) was only added in 7.5, from what I recall.

Before that, you need to handle it all yourself via triggers.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In versions earlier than 7.5, your Exception Handler can trigger a Routine Activity that calls UtilityAbortToLog, which will abort the entire job sequence.
It's not a technique that I like (I prefer to create jobs that don't abort), but it works.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But in earlier versions, the Exception Handler will only 'fire' if something is wrong with the Sequence itself... a parameter it is trying to set does not exist, for example. A job failure won't trigger it. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In previous versions of DataStage, the exception handler will be triggered if the Sequencer cannot perform what it has been asked to do. For e.g. if you ask it to run a job that has failed in its last run.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... and you haven't specified 'Reset if required then run'. :wink:

Same thing I was basically trying to say. If the sequencer starts the job and the job fails, the exception handler is not triggered.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply