Routine - select a column in the job log

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
teddycarebears
Participant
Posts: 18
Joined: Wed May 12, 2010 11:57 pm

Routine - select a column in the job log

Post 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.
Able was I ere I saw Elba
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
teddycarebears
Participant
Posts: 18
Joined: Wed May 12, 2010 11:57 pm

Post 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 :)
Able was I ere I saw Elba
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
teddycarebears
Participant
Posts: 18
Joined: Wed May 12, 2010 11:57 pm

Post 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.
Able was I ere I saw Elba
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
teddycarebears
Participant
Posts: 18
Joined: Wed May 12, 2010 11:57 pm

Post 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: :( :!:
Able was I ere I saw Elba
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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