Multiple Instances of a server Job.
Posted: Fri Dec 28, 2007 6:41 am
I have a server job which should execute as multiple instances.So i have enabled the Multiple instances check box from job properties of the same.This mutiple instance job is inturn invoked from some other job using the following routine.
* Reset the Job before Run
hJob1 = DSAttachJob(JobName, DSJ.ERRWARN)
If NOT( hResetJob) Then
-------------------------
-------------------------
End
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler( hJob1, @FALSE)
ErrCode = DSGetJobInfo (hJob1, DSJ.JOBMULTIINVOKABLE)
Result = DSGetJobInfo (hJob1, DSJ.JOBSTATUS)
If (Result = DSJS.RUNFAILED) or (Result = DSJS.STOPPED) or (Result = DSJS.VALFAILED) Then
Result = DSRunJob(hJob1,DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob1)
End
* Release the handle for the Job
ErrCode = DSDetachJob(hJob1)
* Reset the Job before Run
* Attach the Job and Execute
hJob1 = DSAttachJob(hjob1, DSJ.ERRWARN)
If NOT(hJob1) Then
----------
------------
End
ErrCode = DSGetJobInfo (hResetJob, DSJ.JOBMULTIINVOKABLE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Set parameters or return value
RunFlag=1
End
* Release the handle for the job
ErrCode = DSDetachJob(hJob1)
Ans = RunFlag
-----------------
This multiple instance job should run with different instances,when it is invoked multiple times,but when i actually invoke it number of times i am getting error as 'Job is not in runnable state'.So i understand that its not running as multiple instance job.i am not using any invocation ids for this job.how to call this job,so that, when it runs,it will run with different instance name.Is there any DSRUN function is there to trigger this kind of job.
* Reset the Job before Run
hJob1 = DSAttachJob(JobName, DSJ.ERRWARN)
If NOT( hResetJob) Then
-------------------------
-------------------------
End
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler( hJob1, @FALSE)
ErrCode = DSGetJobInfo (hJob1, DSJ.JOBMULTIINVOKABLE)
Result = DSGetJobInfo (hJob1, DSJ.JOBSTATUS)
If (Result = DSJS.RUNFAILED) or (Result = DSJS.STOPPED) or (Result = DSJS.VALFAILED) Then
Result = DSRunJob(hJob1,DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob1)
End
* Release the handle for the Job
ErrCode = DSDetachJob(hJob1)
* Reset the Job before Run
* Attach the Job and Execute
hJob1 = DSAttachJob(hjob1, DSJ.ERRWARN)
If NOT(hJob1) Then
----------
------------
End
ErrCode = DSGetJobInfo (hResetJob, DSJ.JOBMULTIINVOKABLE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Set parameters or return value
RunFlag=1
End
* Release the handle for the job
ErrCode = DSDetachJob(hJob1)
Ans = RunFlag
-----------------
This multiple instance job should run with different instances,when it is invoked multiple times,but when i actually invoke it number of times i am getting error as 'Job is not in runnable state'.So i understand that its not running as multiple instance job.i am not using any invocation ids for this job.how to call this job,so that, when it runs,it will run with different instance name.Is there any DSRUN function is there to trigger this kind of job.