Reset a job automatically

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Reset a job automatically

Post by parag.s.27 »

Hi All,

I am having a requirement where I need to design an After Job Subroutine that will be called in each job via job properties.

As soon as the job has status aprt from Finished OK, the after job subroutine should be called and it should reset the job. I wrote the following code: -

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H   
 
Input=Trim(InputArg)   
JobStatus  = DSGetJobInfo(DSJ.ME,DSJ.JOBINTERIMSTATUS)   
  
If JobStatus ne 1 
Then ErrCode = DSRunJob(DSJ.ME,DSJ.RUNRESET)
Else ErrCode = 0

ErrorCode = ErrCode;
  
Here The InputArg is doing nothing.
The above code is not giving any result. I think DSJ.ME does not run with ErrCode. When I wrote a separate function with following code then it reset the job for which the job name is provided: -

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H   
 
Input=Trim(InputArg) 
handle = DSAttachJob(Input,DSJ.ERRFATAL)  
JobStatus  = DSGetJobInfo(handle,DSJ.JOBSTATUS)   
  
If JobStatus ne 1 
Then ErrCode = DSRunJob(handle,DSJ.RUNRESET)
Else ErrCode = 0
DSDetachJob(handle)
ErrorCode = ErrCode;
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't reset a job 'after job' as it actually hasn't finished yet. Why do you think you need to do this? Your job control should reset before running, not after. IMHO.
-craig

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