how can we reset a datastage job using datastage coding

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
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

how can we reset a datastage job using datastage coding

Post by singhald »

Hi

I am using datastage job control to call some depandent sub jobs,before run I want to reset these jobs if these jobs having status stopped and abort . can somebody help me to find out code for this .
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
pigpen
Participant
Posts: 38
Joined: Thu Jul 13, 2006 2:51 am

Post by pigpen »

dsjob -run -mode RESET ...
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you are using DsRunJob(), ther is a run mode DSJ.RUNRESET.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

Hi
I am using this code to run a job using job control ,
so i need to put DSJ.RUNRESET instead of DSJ.RUNNORMAL, m i right. but if job is already in a runable state then below code will work or not ?

ErrCode = DSRunJob(hJob17, DSJ.RUNRESET)
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

DSRunJob(hJob17, DSJ.RUNRESET) Will reset the job. You need to use DSJ.RUNNORMAL to run the job again.
Reseting the finished job shouldnt be an issue, unless you expect to get its status. Perhaps you can check for the status and then you can reset.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: how can we reset a datastage job using datastage coding

Post by dsscholar »

I doing something exactly what you need..to check a job's status..if aborted/stopped..then reset..see if the code below helps..

* Check XXX JOBSTATUS. If the status is abort then reset the job before running
haddrr1 = DSAttachJob("XXX", DSJ.ERRFATAL)
Status = DSGetJobInfo(haddrr1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
ErrCode = DSRunJob(haddrr1, DSJ.RUNRESET)
ErrCode = DSWaitForJob(haddrr1)
End
ErrCode = DSDetachJob(haddrr1) :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create a job sequence containing a job activity. Set the run property to "reset if required, then run". On the job properties window examine the code produced by compiling this job sequence. Emulate that 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.
lvidalfl
Participant
Posts: 7
Joined: Fri Jul 21, 2006 4:33 pm
Contact:

Post by lvidalfl »

Hi,

You can use the DSPrepareJob function, if the job is not ready to run, the function reset it before running.

VarX = DSPrepareJob(Job_Handler)

You have to use this function after you attach the job and before you run it.

I hope it helps.
Luis Vidal
Post Reply