Page 1 of 1

DSGetNewestLogId

Posted: Fri May 27, 2005 2:03 am
by palmeal
I am using DSGetNewestLogid (in conjunction with DSGetLogEntry) for DSJ.LogStarted and this returns the latest "control" type from the Director Log. This is as stated in the BASIC manuals.

I expected this to return the start time of the Server Job in question but unfortunatley for me the row returned is for an abort (as it is the latest occurence of type "control" - event type 5). Inspecting the Director Log shows two entries of type "control" - the start time of the server job and the abort for the job.

I know that this is the way that DSGetNewestLogId works but is there any way of going back to the next again message so that I can pull out the actual start time of the Server Job ?
If this can't be done using these functions is the only alternative DSGetLogSummary ?

Posted: Fri May 27, 2005 2:23 am
by ArndW
Palmeal,

Isn't using the DSGetJobInfo function with the mnemonic key DSJ.JOBSTARTTIMESTAMP easier and more direct than looking into the log files?

Posted: Fri May 27, 2005 3:00 am
by palmeal
Cheers Arnd

I'm also pulling out control types info/warning/fatal - this is related to the thread where our Company does not support Job Sequences. In order for me to use the Job Sequences to be supported I'm having to pull out the log information from a Server Job on failure hence the commands I am using.

viewtopic.php?t=92923&highlight=job+seq ... +supported

If I can use other commands such as DSGetJobInfo to obtain the same information then I'm all ears.

Posted: Fri May 27, 2005 3:22 am
by palmeal
I've built in your suggestion Arnd for the start time and it works as you said - I'll keep the GetNewestLogId for warnings and fatal messages as I need to get the exact log messages.
Is there anyway to get the Job Finished time so that I could pass this and the start time as values into DSGetLogSummary ?

Posted: Fri May 27, 2005 4:53 am
by palmeal
I've had a play at creatinf a finish time and am using the TIMEDATE() function. It doesn't matter if this is a few seconds ahead of when the Server Job finished.
I already have the DSJ.STARTTIMESTAMP value so I only need the finish datetime. Unfortunately TIMEDATE() returns the date as hh:mm:ss dd mmm yyyy and DSGetLogSummary requires YYYY-MM-DD hh:mm:ss.

Using Substrings (and an if end else for Jan then 01, Feb then 02 etc) I have managed to create the required value in the format required.

This is all works fine but is there a more aesthetic/simplistic way of generating the finish date ?

I am putting this to rest now unless/until a better method is posted.

Posted: Fri May 27, 2005 5:03 am
by ArndW
Palmeal - the DSGetJobInfo also has a DSJ.JOBLASTTIMESTAMP for the finish time of the last run.

Posted: Fri May 27, 2005 5:06 am
by palmeal
Thanks Arnd - guess I'm a poor reader - I did go through the options - thread closed !!!!

Posted: Fri May 27, 2005 5:14 am
by ArndW
No problem - I wouldn't have found it unless I actually used it, either.