Setting Status Codes

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
butlerhd
Participant
Posts: 7
Joined: Wed Feb 19, 2003 11:55 pm
Location: USA

Setting Status Codes

Post by butlerhd »

Can I set a job status for a sequencer job from a server job which the sequencer has called? I want to abort the sequencer job from a condition within the server job. Any ideas?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When the server job finishes, whether successfully or not, its exit status is available through DSGetJobInfo() and this, in turn, can be used to trigger various outputs from the Job Activity.
The status of the sequencer itself can be set in two ways, both of which may require a small amount of tinkering with the code.
(1) You can change the second argument of DSAttachJob() from the sequencer default of DSJ.ERRNONE to one of its other possible values (read the help topic DSAttachJob() for these), but this may affect execution of the remainder of the job scheduler.
(2) If you log a warning message (DSLogWarn() function), then the exit status of the job scheduler will be {finished (see log)), or DSJS.RUNWARN. If you log a fatal message (DSLogFatal() function), then the exit status of the job scheduler will be (aborted), or DSJS.RUNFAILED, and the job scheduler will abort immediately, and will have to be reset before it can be run again.
Please don't introduce either ABORT or STOP statements into DataStage code.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Post by datastagedummy »

We have a sub-routine to do this which checks for the status of that particular job and returns a value and calls corresponding JobActivity based on the return value of the routines Trigger.

So If I have 2 Server Job to run I would have job activity that would call the ServerJob linked to a routine Activity and in the routine activity I would check for my condition and abort or continue from there.

It's working fine for me so far. [^]
Post Reply