Result after the DSGetJobInfo() not interpretable

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Result after the DSGetJobInfo() not interpretable

Post by Ragunathan Gunasekaran »

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
Regards
Ragu
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It means your call to DSGetJobInfo failed. Check $DSHOME/include/dsapi.h to check what the -1 means.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post by Ragunathan Gunasekaran »

It says that #define DSJE_BADHANDLE -1 /* Invalid JobHandle. */. How shall i then use the DSGetJobInfo() API from the expression editior of the transformer :?: Am i using the correct syntax for the command discussed above?
Regards
Ragu
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post by Ragunathan Gunasekaran »

It says that #define DSJE_BADHANDLE -1 /* Invalid JobHandle. */. How shall i then use the DSGetJobInfo() API from the expression editior of the transformer :?: Am i using the correct syntax for the command discussed above?
Regards
Ragu
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post by Ragunathan Gunasekaran »

Hi
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
I am getting the result. Thanks for the valuable suggestions
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
Post Reply