Page 1 of 1

reset the jobs

Posted: Sat Oct 28, 2006 4:30 am
by Edwink
sirs,
i m running a job through batch i want to rest the aborted job before runing how can i do in batch?
please advice ,
thanks in advance

Posted: Sat Oct 28, 2006 6:11 am
by ray.wurlod
Create your batch as a job sequence and use "Reset if required, then run" as the run method in each Job activity.

That will do it for you.

Optionally inspect the generated job control code, look for calls to DSPrepareJob() - this is how you would do it if you cut your own code.

From the traditional batch, created in Director and having a name beginning with "Batch::", it is not possible to do what you seek without editing the generated code.

Posted: Sun Oct 29, 2006 5:02 am
by kumar_s
Or if you are using BASIC code to call the job, you can check the status and based ont hat you can reset by DSJ.RUNRESET in DsRunJob().

Posted: Sun Oct 29, 2006 8:56 am
by ray.wurlod
Not unconditionally. You really should check whether the job actually needs resetting before doing it.

reset the jobs

Posted: Fri Nov 03, 2006 11:29 pm
by Edwink
sirs,
thanks for ur response
i m using the below code
* Check job JOBSTATUS. If the status is abort then reset the job before running
handle1 = DSAttachJob("job", DSJ.ERRFATAL)
Status = DSGetJobInfo(handle1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
ErrCode = DSRunJob(handle1, DSJ.RUNRESET)
End
handle2 = DSAttachJob("job", DSJ.ERRFATAL)
ErrCode = DSRunJob(handle1, DSJ.RUNNORMAL)
when the job is in aborted mode the job gets reseted and sequences fails issuing the below error
job is in already locked state invalid job handle(-2)
Thanks in advance

Posted: Sat Nov 04, 2006 6:28 am
by ray.wurlod
That's for non-obvious reasons. You need a fresh attachment.

Code: Select all

handle1 = DSAttachJob("job", DSJ.ERRFATAL) 
Status = DSGetJobInfo(handle1, DSJ.JOBSTATUS) 
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then 
   ErrCode = DSRunJob(handle1, DSJ.RUNRESET) 
   ErrCode = DSDetachJob(handle1)   ; *  <--- 
End 
handle2 = DSAttachJob("job", DSJ.ERRFATAL) 
ErrCode = DSRunJob(handle2, DSJ.RUNNORMAL)   ; * <---

use the DSPrepareJob function

Posted: Sun Nov 05, 2006 1:23 am
by dannyna
Used to ensure that a compiled job is in the correct state to be run or validated.

Syntax
JobHandle = DSPrepareJob(JobHandle)

JobHandle is the handle, as returned from DSAttachJob(), of the job to be prepared.

JobHandle is either the original handle or a new one. If returned as 0, an error occurred and a message is logged.

Example
h$ = DSPrepareJob(h$)


Danny