Setting Job Parameter in Before Job Subroutine
Posted: Tue Jan 03, 2006 12:38 am
Hi !
Is it possible to set the parameters of a job from its before routine itself ? Actually, I want to set the starting value for the surrogate key generator for which I have created a job which fetches the maximum value generated from the database and this value has to be set in the job. I am able to set the parameter from a server routine but when the same was tried with a before routine it did not work. The code used is:
Is it possible to set the parameters of a job from its before routine itself ? Actually, I want to set the starting value for the surrogate key generator for which I have created a job which fetches the maximum value generated from the database and this value has to be set in the job. I am able to set the parameter from a server routine but when the same was tried with a before routine it did not work. The code used is:
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
TableName = LEFT(InpParam,INDEX(InpParam,',',1)-1)
ColName = RIGHT(InpParam,LEN(InpParam) - INDEX(InpParam,',',1))
* **********GET MAX******************
JobHandle = DSAttachJob("JOB_GET_MAX_ID", DSJ.ERRNONE)
ErrorCode = DSSetParam(JobHandle,"JOB_TBL_NME",TableName)
ErrorCode = DSSetParam(JobHandle,"JOB_ID_COL",ColName)
ErrorCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
ErrorCode = DSWaitForJob(JobHandle)
If MaxVal <> 1 then MaxVal = MaxVal + 1
MaxVal = DSGetJobInfo (JobHandle,DSJ.USERSTATUS)
* **********GET MAX******************
JobHandle1 = DSAttachJob(DSJ.ME, DSJ.ERRNONE)
ErrorCode = DSSetParam(JobHandle,"JOB_ID_START",MaxVal)