Page 1 of 1

Date and Time of Last Successful Job Run

Posted: Tue Dec 30, 2008 5:06 am
by snassimr
Hi !!!

I need to know when last time the JOB finished with status Ok ( =1)
Can I know it with DS Functions without to scan Log of Job ?

Thank you

Posted: Tue Dec 30, 2008 5:45 am
by ArndW
I don't have access to the documentation here to give you the exact options, but the command is DSGetJobInfo()

Posted: Tue Dec 30, 2008 7:08 am
by ray.wurlod
The answer is no. This is only possible by scanning the job log. DSGetJobInfo() can return the current (= most recent) job run's information.

Posted: Tue Dec 30, 2008 7:58 am
by chulett
Right... and this supposes that the 'last successful run' information is still in the log. If you really need this, you'd be better off capturing it elsewhere after every job run.

Posted: Tue Dec 30, 2008 8:15 am
by ArndW
Ahh, when I responded I skipped over the "successful" keyword, I thought the poster just wished the last run information. As stated, this information is not directly available and perhaps not even available at all if the log has been cleared or purged.
To date I've implemented systems where the statistics are automatically collected after each job run and added to a statistics hashed file. This can be done by several methods, each of which have their advantages and disadvantages. One method is to add an after-job call to each job, another is to have a background job running constantly and checking every n-minutes for completed run and the last method I've used is to modify the verb in the VOC that calls jobs to automatically trigger the statistics collection.

Posted: Tue Dec 30, 2008 8:17 am
by sachin1
You cannot directly test for "OK", you need to use below function and track the value of Status_value(a user defined variable), if the Status_value = 2 then your job finished "ok"

Status_value = DSGetJobInfo (DSJ.ME, DSJ.JOBINTERIMSTATUS)

also the function DSGetLogSummary can help.

but as replied earlier by ray you need to read a job log where all information is stored.

Posted: Tue Dec 30, 2008 8:53 am
by ray.wurlod
That is so wrong. Status 1 means OK, status 2 means that there was at least one warning/alert message logged. But we're straying off topic.

Posted: Tue Dec 30, 2008 9:00 am
by snassimr
Thank you all . It seems to collect statistics permanently and not from time to time is the best way.