Can we get only job status???

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

ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Can we get only job status???

Post by ICE »

Hi,

I like to write a batch job which contains all other jobs from my project directory to get only their job status whether they are successful or not.
I don't want to run those jobs from there.I just want to get their status only.
Can I do that???
Could u pls give me some idea???


Thanks,
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

You would need to use

Code: Select all

Result = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
which will give you the status of the job.
where JobHandle is the Handle for the job returned by

Code: Select all

JobHandle = DSAttachJob (JobName, ErrorMode)
Use erroMode as DSJ.ERRNONE. You can get the name of the jobs from

Code: Select all

Call DSExecute("NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",cmd,output,sysretcode)
Success consists of getting up just one more time than you fall.
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

Ice,

Kim Duke has posted this. You can search the posts of Kim, something it would have

Code: Select all

begin case 
            case JStat = 0 
               JobStatus = 'Running' 
               CanRunFlag = 0 
               CanResetFlag = 0 
               CanStopFlag = 1 
            case JStat = 1 
               JobStatus = 'Finished' 
            case JStat = 2               ; * Finished with warnings 
               JobStatus = 'Finished' 
            case JStat = 3 
               ContinueFlag = @false 
               JobStatus = 'Aborted' 
               CanRunFlag = 0 
            case JStat = 11 
               JobStatus = 'Finished' 
            case JStat = 12              ; * Validated with warnings 
               JobStatus = 'Finished' 
            case JStat = 13 
               * ContinueFlag = @false 
               JobStatus = 'Finished' 
            case JStat = 21 
               JobStatus = 'Finished' 
            case JStat = 96 
               ContinueFlag = @false 
               JobStatus = 'Aborted' 
               CanRunFlag = 0 
            case JStat = 97 
               * ContinueFlag = @false 
               JobStatus = 'Stopped' 
               CanRunFlag = 0 
            case JStat = 98 
               JobStatus = 'Finished' 
            case JStat = 99 
               JobStatus = 'Finished' 
            case @true 
               ContinueFlag = @false 
               JobStatus = 'Not Compiled' 
               CanRunFlag = 0 
               CanResetFlag = 0 
         end case 
    end 
It is part of his ETL_Stats code. Search for it
Rgds
Anand
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Hi loveojha2,

Thanks for your suggestion.But still i need some suggestion.
You give the example to get the jobs name.
So there are more than one jobs I will get if I use this.Right?So do I have to use the loop function to get the job status???


Thank u so much,
ICE



loveojha2 wrote:You would need to use

Code: Select all

Result = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
which will give you the status of the job.
where JobHandle is the Handle for the job returned by

Code: Select all

JobHandle = DSAttachJob (JobName, ErrorMode)
Use erroMode as DSJ.ERRNONE. You can get the name of the jobs from

Code: Select all

Call DSExecute("NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",cmd,output,sysretcode)
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Yes :)
and don't forget to detach the job, once you have read the status with

Code: Select all

ErrCode = DSDetachJob(JobHandle)
ICE wrote:Hi loveojha2,

Thanks for your suggestion.But still i need some suggestion.
You give the example to get the jobs name.
So there are more than one jobs I will get if I use this.Right?So do I have to use the loop function to get the job status???


Thank u so much,
ICE



loveojha2 wrote:You would need to use

Code: Select all

Result = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
which will give you the status of the job.
where JobHandle is the Handle for the job returned by

Code: Select all

JobHandle = DSAttachJob (JobName, ErrorMode)
Use erroMode as DSJ.ERRNONE. You can get the name of the jobs from

Code: Select all

Call DSExecute("NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",cmd,output,sysretcode)
Success consists of getting up just one more time than you fall.
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Dear loveojha2,

May I know how to get the job name one by one???
Now your exp will give the series of jobs name.Right?So how to get one by one.I mean how to assign to a variable???I cannot assign to one variable when I run this DSExecute.
Or can I use the jobname as the alias of NAME from that query statement.I think it's a query statement.Right?
Sorry for my inconvinience.
I am very poor knowledge in this.


Thank u so much 4 ur help.


loveojha2 wrote:Yes :)
and don't forget to detach the job, once you have read the status with

Code: Select all

ErrCode = DSDetachJob(JobHandle)
ICE wrote:Hi loveojha2,

Thanks for your suggestion.But still i need some suggestion.
You give the example to get the jobs name.
So there are more than one jobs I will get if I use this.Right?So do I have to use the loop function to get the job status???


Thank u so much,
ICE



loveojha2 wrote:You would need to use

Code: Select all

Result = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
which will give you the status of the job.
where JobHandle is the Handle for the job returned by

Code: Select all

JobHandle = DSAttachJob (JobName, ErrorMode)
Use erroMode as DSJ.ERRNONE. You can get the name of the jobs from

Code: Select all

Call DSExecute("NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",cmd,output,sysretcode)
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

ICE wrote:Dear loveojha2,

May I know how to get the job name one by one???
Now your exp will give the series of jobs name.Right?So how to get one by one.I mean how to assign to a variable???I cannot assign to one variable when I run this DSExecute.
Or can I use the jobname as the alias of NAME from that query statement.I think it's a query statement.Right?
Sorry for my inconvinience.
I am very poor knowledge in this.
From
Call DSExecute("NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",cmd,output,sysretcode)

output will contain the list of the jobnames separated by @FM (it will also contain CHAR(10)s). Use Field function to select individual jobnames from this string.
Success consists of getting up just one more time than you fall.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

hmmm... that last post needs to be corrected!

The command to execute had 2 errors, it should read:

Code: Select all

Call DSExecute("UV","SELECT NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",output,sysretcode) 
Your output variable "output" will contain a multivalued list of the jobs located. You can then do something like:

Code: Select all

JobsFound = DCOUNT(output,@FM)
FOR I = 1 TO JobsFound
  JobNameToCheck = output<I>
  ** do your processing here **
NEXT I
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Thank you so much.

But I still have some more questions.
Can I output to the txt file in batch job?
How to make it???

Can I call a routine from batch job???
How to call ???

Thanks in Advance,


ArndW wrote:hmmm... that last post needs to be corrected!

The command to execute had 2 errors, it should read:

Code: Select all

Call DSExecute("UV","SELECT NAME FMT '60R' FROM DS_JOBS WHERE NAME NOT LIKE '%\%';",output,sysretcode) 
Your output variable "output" will contain a multivalued list of the jobs located. You can then do something like:

Code: Select all

JobsFound = DCOUNT(output,@FM)
FOR I = 1 TO JobsFound
  JobNameToCheck = output<I>
  ** do your processing here **
NEXT I
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I think we're becoming confused. By "batch job" do you mean the task of getting each job's job status?

Can I output to the txt file in batch job? Yes
How to make it??? OpenSeq, WriteSeq, CloseSeq

Can I call a routine from batch job??? Yes
How to call ??? What kind of routine?

Why not just create a regular server job that processes DS_JOBS using a Hashed File stage or UniVerse stage (you need only the NAME column; declare it as VarChar(254)) to get the job names, call a routine via a Transformer stage to get the job status, and direct the output to a Sequential File stage?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
djm
Participant
Posts: 68
Joined: Wed Mar 02, 2005 3:42 am
Location: N.Z.

Post by djm »

I don't know whether they will work for DS 4.x, as they have only been used in anger against DS 6.x & DS 7.x, but one option for you may be to try either this thread or this one.

Both threads provide DS jobs that allow different dumps of DS Director job log. The first thread (you can ignore the spreadsheet bit if you want - the DS job creates a flat file that you can always manipulate) provides a summary of each job that has been run, with one of the columns created being the job status. The second thread provides a complete dump of the Director log content and you could always pick apart the job and steal this bits you want if the first thread isn't of any use.

<aside>Craig, is that an improvement on the "Try here" message? :wink: </aside>

David
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Great.Thank u so much ,Ray.
Really thanks to u.
Yeah,I wanna check all of my jobs status whether successfully done or not.
Now I created regular server job according to your suggestion.It works.Thank u so much.

ICE

ray.wurlod wrote:I think we're becoming confused. By "batch job" do you mean the task of getting each job's job status?

Can I output to the txt file in batch job? Yes
How to make it??? OpenSeq, WriteSeq, CloseSeq

Can I call a routine from batch job??? Yes
How to call ??? What kind of routine?

Why not just create a regular server job that processes DS_JOBS using a Hashed File stage or UniVerse stage (you need only the NAME column; declare it as VarChar(254)) to get the job names, call a routine via a Transformer stage to get the job status, and direct the output to a Sequential File stage?
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Dear Ray,

Now I got the jobs name but the DSJ.JOBSTATUS are always -1 even though they are not the same status.
May I know what is that???
May I know how to know the staus as -1 is what,1 is what.Like that way.Where can I find those information???I don't see any clarification in DS Dev help files.


Thank u so much.


ray.wurlod wrote:I think we're becoming confused. By "batch job" do you mean the task of getting each job's job status?

Can I output to the txt file in batch job? Yes
How to make it??? OpenSeq, WriteSeq, CloseSeq

Can I call a routine from batch job??? Yes
How to call ??? What kind of routine?

Why not just create a regular server job that processes DS_JOBS using a Hashed File stage or UniVerse stage (you need only the NAME column; declare it as VarChar(254)) to get the job names, call a routine via a Transformer stage to get the job status, and direct the output to a Sequential File stage?
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Hi ICE,

For me job status is -1 when I create a new job and its yet to be compiled.
But not very sure on this.
ICE wrote:Dear Ray,

Now I got the jobs name but the DSJ.JOBSTATUS are always -1 even though they are not the same status.
May I know what is that???
May I know how to know the staus as -1 is what,1 is what.Like that way.Where can I find those information???I don't see any clarification in DS Dev help files.


Thank u so much.


ray.wurlod wrote:I think we're becoming confused. By "batch job" do you mean the task of getting each job's job status?

Can I output to the txt file in batch job? Yes
How to make it??? OpenSeq, WriteSeq, CloseSeq

Can I call a routine from batch job??? Yes
How to call ??? What kind of routine?

Why not just create a regular server job that processes DS_JOBS using a Hashed File stage or UniVerse stage (you need only the NAME column; declare it as VarChar(254)) to get the job names, call a routine via a Transformer stage to get the job status, and direct the output to a Sequential File stage?
Success consists of getting up just one more time than you fall.
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Post by ICE »

Hi loveojha2,

Thanks for ur sharing.......
My jobs are with different kinds of status.But I got all of the status as -1.
So,I wanna to know what this.At least it should be different status .Right?

Thanks,
ICE

loveojha2 wrote:Hi ICE,

For me job status is -1 when I create a new job and its yet to be compiled.
But not very sure on this.
ICE wrote:Dear Ray,

Now I got the jobs name but the DSJ.JOBSTATUS are always -1 even though they are not the same status.
May I know what is that???
May I know how to know the staus as -1 is what,1 is what.Like that way.Where can I find those information???I don't see any clarification in DS Dev help files.


Thank u so much.


ray.wurlod wrote:I think we're becoming confused. By "batch job" do you mean the task of getting each job's job status?

Can I output to the txt file in batch job? Yes
How to make it??? OpenSeq, WriteSeq, CloseSeq

Can I call a routine from batch job??? Yes
How to call ??? What kind of routine?

Why not just create a regular server job that processes DS_JOBS using a Hashed File stage or UniVerse stage (you need only the NAME column; declare it as VarChar(254)) to get the job names, call a routine via a Transformer stage to get the job status, and direct the output to a Sequential File stage?
Post Reply