Page 1 of 1

Routine - select a column in the job log

Posted: Tue Sep 14, 2010 1:16 am
by teddycarebears
I created a routine that basically takes all log and inserts it into an array.

Code: Select all

LogArray = DSGetLogSummary(JobHandle, DSJ.LOGFATAL, StartTime, StopTime, MAXLOGLINES)
It works fine but I discovered a little problem. If job has Invocation Id an extra column is generated in the log. Other parameters might as well modify the number of columns in the log also.

That is why I am wondering if there is any way to recover from the log only the Event column.

Posted: Tue Sep 14, 2010 2:30 am
by ArndW
No, not using the API calls to get the log entries and it is better to modify your current return string to remove the invocation id column than to access the log files directly. I don't have access to DS right now, but if you post your output with invocation id included then I'm sure that I or someone else can give you the BASIC code to strip it out.

Posted: Tue Sep 14, 2010 3:52 am
by teddycarebears
Hi ArndW,

I am using the code bellow which takes care of the presence of Invocation Id. What I am looking for is to obtain Event column in another way, maybe by its name, rather than by its position which could always give errors if other job parameters modify the columns order in the job log.

Code: Select all

LogArray = DSGetLogSummary(JobHandle, DSJ.LOGFATAL, StartTime, StopTime, MAXLOGLINES)
LogLines = DCount(LogArray , "@FM")

if DSJobInvocationId ne "" then
	for i = 1 to LogLines ;
	Msg := Fields(Fields(LogArray,"@FM",i,1), ":", 1, 5)
	next i
end else if DSJobInvocationId eq "" then
	for i = 1 to LogLines ;
	Msg := Fields(Fields(LogArray,"@FM",i,1), ":", 1, 4)
	next i
end
If there are anymore ideas in the air I am always glad to listen :)

Posted: Tue Sep 14, 2010 3:59 pm
by ray.wurlod
These are the only two possibilities. Therefore keep using the code that you're using.

Incidentally, the semi-colons at the ends of the For statements are not required. They introduce harmless empty statements.

Posted: Wed Sep 15, 2010 12:56 pm
by teddycarebears
Unfortunately I have found a third possibility and that is when the job is called from a sequence with the Invocation Id passed from the sequence, then it is read the job's log and not the job.InvocationId's log.

So my problem is now how to read the job.InvocationId log and also another problem occurred and that is to determine which is the last column from the log. I have no idea how to count the columns from the log although I can parse them without a problem with fields.

Posted: Wed Sep 15, 2010 5:21 pm
by ray.wurlod
Yes, but that doesn't give you a third format.

The log that you read is whichever one the current job handle relates to. You must control this in your code. You can use functions like DSGetJobInfo() with DSJ.JOBCONTROLLER to determine the parent sequence's name.

Posted: Thu Sep 16, 2010 1:15 am
by teddycarebears
Guys, it is very frustrating in the very own topic that I start to see the premium account image covering all the information I am asking for. Neither of Ray's answers are visible.

If I am asking and you are answering for me, couldn't it be possible that the premium image not to exists when the author of the topic is reading it ?

Maybe you are offering useful information but since I am not a premium member I can not see anything. And yes, it is frustrating a little bit.

:roll: :( :!:

Posted: Thu Sep 16, 2010 3:34 am
by ray.wurlod
And yet it is so easy to obtain a premium membership, which will allow you to read entire premium posts, as well as gaining other advantages.