Automatic reset of a abended job

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
harshkohli
Participant
Posts: 31
Joined: Wed Feb 04, 2004 2:04 pm
Location: Canada

Automatic reset of a abended job

Post by harshkohli »

We are running DS XE 5.2 on a Unix Machine and run all DataStage jobs using Unix Scripts and schedule them using CA-Unicentre. Whenever any DataStage job abends, we have to log on to DataStage Director and manually reset the job before restarting the job from Unix (Uni-Centre).

I think we can reset the job within a script using dsjob command but would like DataStage to reset the job automatically after it abends so that it can be restarted. Is there any command/setting in DS Administrator by which all abended jobs will be reset immediately automatically?

Thanks.
Harsh Kohli
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Nice try, but there isn't one. :cry:

What you need to do is any of the following.

1. When the job finishes detect its exit status using dsjob. If the exit status is "aborted", then run dsjob again, with -mode reset.

2. Run each job using a parent controlling job or job sequence. When the job finishes detect its exit status using DSGetJobInfo() or a trigger (if in a job sequence). If the exit status is "aborted", then run the job again, with the mode argument of DSRunJob() set to DSJ.RUNRESET.

3. Run each job using a job sequence, with the run action set to "reset if necessary, then run".

Whichever method you choose, you still have to check that the reset was successful, which it is 99.99% of the time. You do this simply by checking the exit status of the job after the reset run. It should now be "has been reset".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
harshkohli
Participant
Posts: 31
Joined: Wed Feb 04, 2004 2:04 pm
Location: Canada

Post by harshkohli »

Thanks Ray. But this involves changing all our dataStage run scripts and adding the dsjob commands at the end. I was hoping DataStage to reset the jobs automatically, but well.

But I have seen some abended jobs are reset automatically within DataStage Director. I am not sure why some jobs are reset and most jobs are not? Is is to do with the type of abend? Just curious..
Harsh Kohli
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Unless it's a "reset if needed then run" from a job sequence there is no such thing as automatic reset. A job can not reset itself if it has aborted.

Recompiling the job has the same effect as resetting it. Maybe that's what's happened.

Otherwise I suspect that one of your colleagues/operators has triggered the reset run either from Director or from dsjob.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You could write a routine that checks all jobs and resets those that need to be reset. You can call this routine from a sequence job and run it at the start or the end of your processing cycle. This approach creates situations where jobs can abort and no one is aware that the job failed to load the data. You are much better off putting in proper job control where aborts and/or warnings are reported in an email and the job is automatically reset once the report has been made. Resetting an aborted job without letting anyone know it failed is a recipe for disaster.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

CA-Unicentre should know by the return code that a job failed. You can create an event to autmatically reset a job after an abort.

I posted a routine to compile all the jobs. It will reset a job by compiling it. Do a search for it. Some people use that method.

I like the idea of reset and then run option to dsjob. I think that a routine to reset all aborted jobs is a nice tool. It would be easy to write. I posted the routine to get the status. Do another search. There is enough code posted to solve your problem if you put in the effort. Ray showed you how to reset a job in a routine. Write it.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For whatever reason, I prefer the reset-and-run methodology (like how the Sequence jobs can handle things) rather than the abort-and-immediately reset style. [shrug] Different strokes.

On the subject of 'DataStage run scripts', we've got a single Korn shell script that can be called to run any DataStage job. It handles setting up the 'dsjob' call, validates the job to run actually exists and is in a runnable state, resets it if needed and then actually runs it. We use the 'file' option to automate the handling of userids/passwords per server. This is mainly leveraged by Control-M and we've trained it to recognize DataStage return codes. :) It wasn't too hard to code it up...
-craig

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