Page 1 of 1

How to make a after job routine which resets a server job

Posted: Fri Jun 18, 2004 4:38 am
by mgk
Can anyone show me the code to a after job routine wich resets a server job after its finished, no matter the errorcode?

Regards

Posted: Fri Jun 18, 2004 4:44 am
by ray.wurlod
Welcome aboard! :D

You can't reset the job itself from within an after-job subroutine because, while the after-job subroutine is executing, the status of the job is still "running". The job does not stop running until after the after-job subroutine returns. You can not reset a job if its status is "running".

Is that what you had in mind to do?

You can certainly reset an attached job from job control code, using DSRunJob() with a run-type argument of DSJ.RUNRESET. But not if the job is currently running.

What are you hoping to achieve here? Would it be as acceptable to reset the job if required just before running it the next time? From a job sequence this is one of the options in a Job Activity; how to do it in job control code has been discussed on this Forum. Search, perhaps, for DSJ.RUNRESET.

Posted: Tue Jun 22, 2004 5:33 am
by mgk
Hallo :lol:

Thanks for your answer, I think that I'm going to use the job sequence and then make it a "reset if required, then run" job.

Regards