Result after the DSGetJobInfo() not interpretable
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 247
- Joined: Mon Jan 22, 2007 11:33 pm
Result after the DSGetJobInfo() not interpretable
Hi
I am using the following API in the expression editor of a transformer to get the status of a job. I am matching with the DSJS constants such as DSJS.RUNOK ,DSJS.RUNWARN and DSJS.RUNFAILED . The job that i am checking has perfectly went fine without any warnings but the output of the routine
DSGetJobInfo( Link_name.JOB_NAME, DSJ.JOBSTATUS) =-1 is not matching to any of these constants. How shall i resolve this -1 returned as the output of the expression to the job status.
Any clue on this is welcome
I am using the following API in the expression editor of a transformer to get the status of a job. I am matching with the DSJS constants such as DSJS.RUNOK ,DSJS.RUNWARN and DSJS.RUNFAILED . The job that i am checking has perfectly went fine without any warnings but the output of the routine
DSGetJobInfo( Link_name.JOB_NAME, DSJ.JOBSTATUS) =-1 is not matching to any of these constants. How shall i resolve this -1 returned as the output of the expression to the job status.
Any clue on this is welcome
Regards
Ragu
Ragu
-
- Participant
- Posts: 247
- Joined: Mon Jan 22, 2007 11:33 pm
-
- Participant
- Posts: 247
- Joined: Mon Jan 22, 2007 11:33 pm
Which job are you checking? The current job? Then use DSJ.ME for the handle. For another job, you'll need to 'attach' to it first to establish the handle and there is a specific function for that. However, you'll need to write a routine to handle all of this correctly - attach, get job information (etc) and then finally, when you are done, release the handle.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You are wasting your time if you want the status of the job from which the routine is being invoked in a Transformer stage - the status of that you will always be reported as DSJS.RUNNING.
I am guessing, therefore, that you are delivering a stream of job names for which you want to determine the status. If this is true then you will need a routine - there is no way around that - to receive the job name, attach that job to itself, determine the job status (and anything else in which you're interested), detach the job, and return the result.
Don't forget to check that the attach was successful.
Don't forget to detach the job from the routine.
I am guessing, therefore, that you are delivering a stream of job names for which you want to determine the status. If this is true then you will need a routine - there is no way around that - to receive the job name, attach that job to itself, determine the job status (and anything else in which you're interested), detach the job, and return the result.
Don't forget to check that the attach was successful.
Don't forget to detach the job from the routine.
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: 247
- Joined: Mon Jan 22, 2007 11:33 pm
Hi
I got a routine in dsxchange to solve this . Thanks to dsxchange
I am getting the result. Thanks for the valuable suggestions
I got a routine in dsxchange to solve this . Thanks to dsxchange
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = 0
handleJob = DSAttachJob(JobName, DSJ.ERRNONE)
If NOT(handleJob) Then
Ans = -99
End
Else
Ans = DSGetJobInfo(handleJob, InfoID)
End
DetachResult = DSDetachJob(handleJob)
DSJ.JOBSTATUS
Regards
Ragu
Ragu
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your code seems to have become a little scrambled, and is missing the "InfoID = " assigment statement ahead of its use. Further you (as does all the example code) ignore the documented advice not to assume the data type of a job handle. Here is some better code:
Code: Select all
FUNCTION GetJobStatus(JobName)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
hJob = DSAttachJob((JobName), DSJ.ERRNONE)
JobStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If JobStatus = DSJE.BADHANDLE
Then
Ans = -99
End
Else
Ans = JobStatus
IgnoreMe = DSDetachJob(hJob)
End
RETURN(Ans)
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.