Hi
I have a job "manishtest". This is a server job which i am running on Windows NT. I have defined the job parameters :
1 FileWatch ( String type )
2 JobToRun (Strin Type )
3 Loop (String Type )
I will be assigning the value through Job Sequence. So want to have these as dynamic.
When i am using this , it is failing saying unable to find the job.
Job_Name1 = DSAttachJob(DSJ.ME,DSJ.ERRFATAL)
Dummy = DSSetParam(Job_Name1, "FileWatch",DSJ.PARAMDEFAULT)
Dummy1 = DSSetParam(Job_Name1, "Loop",DSJ.PARAMDEFAULT)
JobName2 = DSSetParam(Job_Name1, "JobForRun",DSJ.PARAMDEFAULT)
I am using JobName2 as a variable in reset of the code assuming the JobName2 is having the job Name.
Please suggest in this regard
Thanks
Manish
Unable to use Job parameter in JobControl
Moderators: chulett, rschirm, roy
Unable to use Job parameter in JobControl
Thanks
Manish
Manish
-
- Premium Member
- Posts: 224
- Joined: Tue Sep 24, 2002 7:32 am
- Location: Denver, CO USA
If the code you posted is in the JobControl job then DSJ.ME refers to the JobControl job, not the job you want to run "manishtest"
I don't know how you are planning on getting the dynamic values of the job parameters, but you need to set a local variable to the value you want.
(this is pseudo-code)
then use these variables like this:
That should get you started.
John
So it should be more like:Job_Name1 = DSAttachJob(DSJ.ME,DSJ.ERRFATAL)
Dummy = DSSetParam(Job_Name1, "FileWatch",DSJ.PARAMDEFAULT)
Dummy1 = DSSetParam(Job_Name1, "Loop",DSJ.PARAMDEFAULT)
JobName2 = DSSetParam(Job_Name1, "JobForRun",DSJ.PARAMDEFAULT)
Code: Select all
hjob1 = DSAttachJob("manishtest",DSJ.ERRFATAL)
(this is pseudo-code)
Code: Select all
varFileWatch = <something>
varLoop = <something>
varJobForRun = <something>
Code: Select all
Dummy = DSSetParam(hjob1, "FileWatch",varFileWatch)
Dummy1 = DSSetParam(hjob1, "Loop",varLoop)
JobName2 = DSSetParam(hjob1, "JobForRun",varJobForRun)
John
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
HI
Thanks for the input.
My intention for writing JobControl is : Want to run Job every 10 min and evry ten minute it will wait for the file and run the job which depends on the file. To schedule the job to run between 10 am to 5 pm i am using Sequence. The loopin and wait for file, is being handled in the job control.
When i am hard cding the value , this Job control is running fine. The challege is , we have different "JobToRun" values. Due to this reason i made it as a Job Parameter.
So when i trying to use the parameter values , it is not happening.
As you guys i have suggested , i made the changes , but the Job is hangin when i am trying to Attach the job.
The job Name which has JobController is "manishtest" ie "manishtest"contains these code
The starting code as per you input is :
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
**************************CREATE A BLOCK FOR RUNNING JOB**********************
Version_Name = "Current"
JobForRun = "RSE2_SEQ"
Loop = 1
Job_Handle = DSAttachJob("manishtest",DSJ.ERRFATAL)
Loop = DSSetParam(Job_Handle, "Loop",Loop)
JobForRun = DSSetParam(Job_Handle, "JobForRun",JobForRun)
Entity_Name=JobForRun1
Job_Stat=DSGetJobInfo(JobForRun1,DSJ.JOBSTATUS)
Counts=0
*************************************************************************************
L$CREATESTATUS :
Counts=Counts+1
Call DSLogInfo("Iteration ":Counts ,"Run_":Entity_Name )
IF DSWaitForFile("#FileName# timeout:3S") = DSJE.NOERROR (0)
Then
******************************RUN JOB 1**********************************************
*********
L$RUNJOB1:
*********
**************************START OF RUN JOB BLOCK FOR ONE JOB************************
Job_Name=JobForRun1
*Job_Handle = DSAttachJob(Job_Name,DSJ.ERRFATAL)
Call DSLogInfo("JOB ":Job_Name:" Attached Successfully ","Run_":Entity_Name)
Job_Stat=DSGetJobInfo(Job_Handle,DSJ.JOBSTATUS)
*************************************************************************************
IF (Job_Stat=DSJS.RUNOK OR Job_Stat =DSJS.RUNWARN OR Job_Stat =DSJS.VALOK OR Job_Stat =DSJS.RESET OR Job_Stat =99)
THEN
**SEND REQUEST FOR RUNNING JOB
Run_Err = DSRunJob(Job_Handle, DSJ.RUNNORMAL)
IF (Run_Err <> 0)
THEN
Call DSLogFatal("Job Or Sequence is not in a Runnable State : ":Job_Name, "Run_":Entity_Name)
END
END
Thanks for the input.
My intention for writing JobControl is : Want to run Job every 10 min and evry ten minute it will wait for the file and run the job which depends on the file. To schedule the job to run between 10 am to 5 pm i am using Sequence. The loopin and wait for file, is being handled in the job control.
When i am hard cding the value , this Job control is running fine. The challege is , we have different "JobToRun" values. Due to this reason i made it as a Job Parameter.
So when i trying to use the parameter values , it is not happening.
As you guys i have suggested , i made the changes , but the Job is hangin when i am trying to Attach the job.
The job Name which has JobController is "manishtest" ie "manishtest"contains these code
The starting code as per you input is :
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
**************************CREATE A BLOCK FOR RUNNING JOB**********************
Version_Name = "Current"
JobForRun = "RSE2_SEQ"
Loop = 1
Job_Handle = DSAttachJob("manishtest",DSJ.ERRFATAL)
Loop = DSSetParam(Job_Handle, "Loop",Loop)
JobForRun = DSSetParam(Job_Handle, "JobForRun",JobForRun)
Entity_Name=JobForRun1
Job_Stat=DSGetJobInfo(JobForRun1,DSJ.JOBSTATUS)
Counts=0
*************************************************************************************
L$CREATESTATUS :
Counts=Counts+1
Call DSLogInfo("Iteration ":Counts ,"Run_":Entity_Name )
IF DSWaitForFile("#FileName# timeout:3S") = DSJE.NOERROR (0)
Then
******************************RUN JOB 1**********************************************
*********
L$RUNJOB1:
*********
**************************START OF RUN JOB BLOCK FOR ONE JOB************************
Job_Name=JobForRun1
*Job_Handle = DSAttachJob(Job_Name,DSJ.ERRFATAL)
Call DSLogInfo("JOB ":Job_Name:" Attached Successfully ","Run_":Entity_Name)
Job_Stat=DSGetJobInfo(Job_Handle,DSJ.JOBSTATUS)
*************************************************************************************
IF (Job_Stat=DSJS.RUNOK OR Job_Stat =DSJS.RUNWARN OR Job_Stat =DSJS.VALOK OR Job_Stat =DSJS.RESET OR Job_Stat =99)
THEN
**SEND REQUEST FOR RUNNING JOB
Run_Err = DSRunJob(Job_Handle, DSJ.RUNNORMAL)
IF (Run_Err <> 0)
THEN
Call DSLogFatal("Job Or Sequence is not in a Runnable State : ":Job_Name, "Run_":Entity_Name)
END
END
Thanks
Manish
Manish
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: