Capturing Server JobStatus Variable

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
dtatem
Participant
Posts: 54
Joined: Wed Jun 09, 2004 7:50 am

Capturing Server JobStatus Variable

Post by dtatem »

Hello To All:

I have an After job server routine that captures jobs statistics, row counts etc. In this routine I have the following code

JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

The content of JobStatus is 0[zero] when we insert it into an ODS logging table when the job completes OK. Instead of JobStatus =0 or 1, I want to place some meaningful status ie "Complete"or "Failed" instead of 0 or 1. Therefore I have coded the following:

if JobStatus = 0 then
TheJobStatus ="Complete"
end
else
TheJobStatus ="Failed"
end

When I pass the variable "TheJobStatus" into my calling function which inserts the job status into the ODS table, nothing gets passed. Can you tell me what I am doing wrong and/or is there a better way of doing this?
Also is there a way to display the content of variable "TheJobStatus" or "JobStatus" for debugging purpose while testing?

Thanks In Advance for your help and ideas

--dtatem
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Quick note - 'after job' the job is still running, so that's the only status you'll get. Check for the INTERIM status instead.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dtatem
Participant
Posts: 54
Joined: Wed Jun 09, 2004 7:50 am

Re: Capturing Server JobStatus Variable

Post by dtatem »

Can you tell me what is the variable for "INTERIM" status

dtatem wrote:Hello To All:

I have an After job server routine that captures jobs statistics, row counts etc. In this routine I have the following code

JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

The content of JobStatus is 0[zero] when we insert it into an ODS logging table when the job completes OK. Instead of JobStatus =0 or 1, I want to place some meaningful status ie "Complete"or "Failed" instead of 0 or 1. Therefore I have coded the following:

if JobStatus = 0 then
TheJobStatus ="Complete"
end
else
TheJobStatus ="Failed"
end

When I pass the variable "TheJobStatus" into my calling function which inserts the job status into the ODS table, nothing gets passed. Can you tell me what I am doing wrong and/or is there a better way of doing this?
Also is there a way to display the content of variable "TheJobStatus" or "JobStatus" for debugging purpose while testing?

Thanks In Advance for your help and ideas

--dtatem
dtatem
Participant
Posts: 54
Joined: Wed Jun 09, 2004 7:50 am

Re: Capturing Server JobStatus Variable

Post by dtatem »

I was a bit quick on the submit button..but I found the variable..
thanks


dtatem wrote:Can you tell me what is the variable for "INTERIM" status

dtatem wrote:Hello To All:

I have an After job server routine that captures jobs statistics, row counts etc. In this routine I have the following code

JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

The content of JobStatus is 0[zero] when we insert it into an ODS logging table when the job completes OK. Instead of JobStatus =0 or 1, I want to place some meaningful status ie "Complete"or "Failed" instead of 0 or 1. Therefore I have coded the following:

if JobStatus = 0 then
TheJobStatus ="Complete"
end
else
TheJobStatus ="Failed"
end

When I pass the variable "TheJobStatus" into my calling function which inserts the job status into the ODS table, nothing gets passed. Can you tell me what I am doing wrong and/or is there a better way of doing this?
Also is there a way to display the content of variable "TheJobStatus" or "JobStatus" for debugging purpose while testing?

Thanks In Advance for your help and ideas

--dtatem
dtatem
Participant
Posts: 54
Joined: Wed Jun 09, 2004 7:50 am

Re: Capturing Server JobStatus Variable

Post by dtatem »

The JOBINTERIMSTATUS states the following:

DSJ.JOBINTERIMSTATUS. Returns the status of a job after it has run all stages and controlled jobs, but before it has attempted to run an after-job subroutine. (Designed to be used by an after-job subroutine to get the status of the current job)

My question is does it return 1 or 0 or someother value? if it returns "someothervalue" what is that value?

How do I display its content while debugging.

regards

-dtatem





dtatem wrote:Can you tell me what is the variable for "INTERIM" status

dtatem wrote:Hello To All:

I have an After job server routine that captures jobs statistics, row counts etc. In this routine I have the following code

JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

The content of JobStatus is 0[zero] when we insert it into an ODS logging table when the job completes OK. Instead of JobStatus =0 or 1, I want to place some meaningful status ie "Complete"or "Failed" instead of 0 or 1. Therefore I have coded the following:

if JobStatus = 0 then
TheJobStatus ="Complete"
end
else
TheJobStatus ="Failed"
end

When I pass the variable "TheJobStatus" into my calling function which inserts the job status into the ODS table, nothing gets passed. Can you tell me what I am doing wrong and/or is there a better way of doing this?
Also is there a way to display the content of variable "TheJobStatus" or "JobStatus" for debugging purpose while testing?

Thanks In Advance for your help and ideas

--dtatem
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It returns the 'standard' status values as documented in the $DSHOME/include/dsapi.h file and elsewhere:

Code: Select all

/* 'jobStatus' values... */

#define DSJS_RUNNING            0       /* Job running */
#define DSJS_RUNOK              1       /* Job finished a normal run with no warnings */
#define DSJS_RUNWARN            2       /* Job finished a normal run with warnings */
#define DSJS_RUNFAILED          3       /* Job finished a normal run with a fatal error */
#define DSJS_VALOK              11      /* Job finished a validation run with no warnings */
#define DSJS_VALWARN            12      /* Job finished a validation run with warnings */
#define DSJS_VALFAILED          13      /* Job failed a validation run  */
#define DSJS_RESET              21      /* Job finished a reset run */
#define DSJS_CRASHED            96      /* Job was stopped by some indeterminate action */
#define DSJS_STOPPED            97      /* Job was stopped by operator intervention (can't tell run type) */
#define DSJS_NOTRUNNABLE        98      /* Job has not been compiled */
#define DSJS_NOTRUNNING         99      /* Any other status */
-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 »

Interim status is the job status assuming that the after-job subroutine that calls it returns properly - without generating warnings or errors and with ErrorCode argument set to 0 - that is, the job status that would obtain if there were no after-job subroutine.
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