reset the jobs

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
Edwink
Participant
Posts: 47
Joined: Sat Aug 19, 2006 4:57 am
Location: Chennai

reset the jobs

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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().
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not unconditionally. You really should check whether the job actually needs resetting before doing it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Edwink
Participant
Posts: 47
Joined: Sat Aug 19, 2006 4:57 am
Location: Chennai

reset the jobs

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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)   ; * <---
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dannyna
Participant
Posts: 7
Joined: Fri Jun 10, 2005 12:15 am

use the DSPrepareJob function

Post 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
Post Reply