Error while calling a job from Job Control Code
Moderators: chulett, rschirm, roy
Error while calling a job from Job Control Code
Hi all,
I am trying to run a job from Job Control in Job Parameters.
Basically i get a file and i need to read the file to get the values as a parameters and call another job. But while i am running the main Job i am getting following error.
"Job_Parms..JobControl (fatal error from DSSetParam): Job control fatal error (-1)
(DSSetParam) Invalid job handle <Missing or NULL>"
Any thoughts!!!
Thanks in advance
I am trying to run a job from Job Control in Job Parameters.
Basically i get a file and i need to read the file to get the values as a parameters and call another job. But while i am running the main Job i am getting following error.
"Job_Parms..JobControl (fatal error from DSSetParam): Job control fatal error (-1)
(DSSetParam) Invalid job handle <Missing or NULL>"
Any thoughts!!!
Thanks in advance
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi Titto,
Make sure you have attached to your job using DSAttachJob function shown below. Alternatively if you are referring to the current job, you can use the job handle as DSJ.ME
Then you need to use this job handle in the DSSetParam function to set the parameters
It seems like your jobhandle is not getting set properly.
Thanks,
Naveen
Make sure you have attached to your job using DSAttachJob function shown below. Alternatively if you are referring to the current job, you can use the job handle as DSJ.ME
Code: Select all
JobHandle = DSAttachJob (JobName, ErrorMode)
Code: Select all
ErrCode = DSSetParam (JobHandle, ParamName, ParamValue)
Thanks,
Naveen
Here is my Code
Where A -to- K are values from ParameterFile and I am trying to call another job by passing A -to- K values as paramter.
Where A -to- K are values from ParameterFile and I am trying to call another job by passing A -to- K values as paramter.
Code: Select all
*----------------------------------------------------------------------------
* Get Parameters
*----------------------------------------------------------------------------
ParameterFile = DSGetParamInfo(DSJ.ME, "parmParameterFile", DSJ.PARAMVALUE)
TempJobName = DSGetParamInfo(DSJ.ME, "parmJobName", DSJ.PARAMVALUE)
*----------------------------------------------------------------------------
* Open the file...
*----------------------------------------------------------------------------
OpenSeq ParameterFile To ParameterFileVar
On Error
Msg = 'Error opening parameters file, ' : SQuote(ParameterFile): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
Else
Msg = 'Cannot open parameters file, ' : SQuote(ParameterFile): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
*----------------------------------------------------------------------------
* File Opened
* Read the parameter list from the file.
*----------------------------------------------------------------------------
If FileInfo(ParameterFileVar, 0)
Then
ReadSeq Line From ParameterFileVar
Else
Msg = 'Cannot read parameters file, ' : SQuote(ParameterFile): ', status = ' : Status()
Call DSLogFatal(Msg, TransformName )
Abort
End
*----------------------------------------------------------------------------
*All the parameters from the Parameter file
*----------------------------------------------------------------------------
A= IsNull(Field(Line,',',1,1))
B= IsNull(Trim(Field(Line,',',2,1)))
C= IsNull(Left(Trim(Field(Line,',',3,1)),2))
D= IsNull(Right(Trim(Field(Line,','3,1)),6))
E= IsNull(Field(Line,',',4,1))
F= IsNull(Field(Line,',',5,1))
G= IsNull(Field(Line,',',6,1))
H= IsNull(Field(Line,',',7,1))
I= IsNull(Field(Line,',',8,1))
J= IsNull(Field(Line,',',9,1))
K= IsNull(Field(Line,',',10,1))
CloseSeq ParameterFileVar
End
JobHandle = DSAttachJob(TempJobName, DSJ.ERRFATAL)
Status = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
*----------------------------------------------------------------------------
*To check is the job is in runnable state.
*If not its reset
*----------------------------------------------------------------------------
If Status = DSJS.RUNFAILED or Status = DSJS.STOPPED Then
Call DSLogInfo("Job is to be reset: " : TempJobName, RoutineName)
ErrCode = DSRunJob(JobHandle, DSJ.RUNRESET)
ErrCode = DSWaitForJob(JobHandle)
Status = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)
If Status <> DSJS.RESET Then
Call DSLogFatal("Job Failed TO RESET: " : TempJobName, RoutineName)
End
ErrCode = DSDetachJob(JobHandle)
JobHandle = DSAttachJob(TempJobName, DSJ.ERRFATAL)
If NOT(JobHandle) Then
Call DSLogFatal("Job Attach Failed: " : TempJobName, RoutineName)
Abort
End
End
*----------------------------------------------------------------------------
*The parameters are set for the job
*----------------------------------------------------------------------------
ErrCode = DSSetParam(JobHandle, "A", A)
ErrCode = DSSetParam(JobHandle, "B", B)
ErrCode = DSSetParam(JobHandle, "C", C)
ErrCode = DSSetParam(JobHandle, "D", D)
ErrCode = DSSetParam(JonHandle, "E" ,E)
ErrCode = DSSetParam(JonHandle, "F" ,F)
ErrCode = DSSetParam(JonHandle, "G" ,G)
ErrCode = DSSetParam(JonHandle, "H" ,H)
ErrCode = DSSetParam(JonHandle, "I" ,I)
ErrCode = DSSetParam(JonHandle, "J" ,J)
ErrCode = DSSetParam(JobHandle, "K", K)
ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(JobHandle)
Status = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
ErrMsg = "PollingJob Job failed to run!"
Call DSLogFatal("Job Failed: PollingJob", "JobControl")
End
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Pass Parameter JOB Seq to another JOB Seq
Thanks Ray!!!
I changed it - it is passing the parameters to next job and next job working fine but the main job aborted with following error
"Job_Parms..JobControl (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle <Missing or NULL>"
-----
I have a question - Is it possible to pass parameter from JOB Sequencer to another JOB Sequencer.
Thanks
I changed it - it is passing the parameters to next job and next job working fine but the main job aborted with following error
"Job_Parms..JobControl (fatal error from DSGetJobInfo): Job control fatal error (-1)
(DSGetJobInfo) Invalid job handle <Missing or NULL>"
-----
I have a question - Is it possible to pass parameter from JOB Sequencer to another JOB Sequencer.
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,
May be my question was wrong.
my requrement is - I will get a fine with values, i need to read those values and pass as parameters to next job and from that job to next job.
I am trying to use JOB control to write a small code to read the seq file and Attach a Job with DSSetparam and call next JOB1 and after successful of JOB1 same parameters needs to pass to JOB2 then JOB3 and then to JOB4.
For the above process, I used a Dummy job to read the Seq file(JOB1) and JOB2. For JOB1 and JOB2 i used a JOB Sequencer (Job2 will get called inturn from job1). so for now JOB3 and JOB4 do i need to use the same job sequencer or different one? If i correct we can't use same parameter which got populated in same job.
[img]JOB1%20----->%20JOB2------>%20JOB3%20----->%20JOB4[/img]
Please direct me!
Thanks in Advance!
May be my question was wrong.
my requrement is - I will get a fine with values, i need to read those values and pass as parameters to next job and from that job to next job.
I am trying to use JOB control to write a small code to read the seq file and Attach a Job with DSSetparam and call next JOB1 and after successful of JOB1 same parameters needs to pass to JOB2 then JOB3 and then to JOB4.
For the above process, I used a Dummy job to read the Seq file(JOB1) and JOB2. For JOB1 and JOB2 i used a JOB Sequencer (Job2 will get called inturn from job1). so for now JOB3 and JOB4 do i need to use the same job sequencer or different one? If i correct we can't use same parameter which got populated in same job.
[img]JOB1%20----->%20JOB2------>%20JOB3%20----->%20JOB4[/img]
Please direct me!
Thanks in Advance!
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You appear to have a one-line parameter file containing ten comma-delimited values with which you want to replace eleven job parameters.
The IsNull functions in your original code thwart this intent.
Assuming you're using version 7.5, you can create a job sequence that begins with an Execute Command activity to cat the file. The output from this is available when setting parameter values for downstream jobs.
For example, parameter B would be set asNote there is no IsNull() function involved. I've assumed ExecCmd to be the name of the Execute Command activity; you would choose this from the displayed list of job parameters when editing a downstream Job Activity.
The IsNull functions in your original code thwart this intent.
Assuming you're using version 7.5, you can create a job sequence that begins with an Execute Command activity to cat the file. The output from this is available when setting parameter values for downstream jobs.
For example, parameter B would be set as
Code: Select all
Field(ExecCmd.$CommandOutput, ",", 2, 1)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom