Read log files and write custom messages in Exception file.

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

Post Reply
bikan
Premium Member
Premium Member
Posts: 128
Joined: Thu Jun 08, 2006 5:27 am

Read log files and write custom messages in Exception file.

Post by bikan »

Hi All,

In this job I am working at I have to write custom messages in the exception report file.

Messages like "Output file failed to open"
No of records parsed in each link
No of records parsed with a particular field being NULL
On completion of output file write it shoul mention that the output file has been closed and end with a end timestamp.

ANy suggestions or ideas on how to contruct such a file.

Thanks
PIyush
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Re: Read log files and write custom messages in Exception fi

Post by JoshGeorge »

After the job completes you can call your routine and generate this report.
If the file failed to open your job would have aborted, in that case your first field can be job status. Here you can capture the specific fatal error reason and state user specific messages for the ones you can anticipate (Else a default one or the real fatal message from the log) in case of failure. (Ex: Messages like "Output file failed to open"). Link row counts can be retrieved using the respective functions after job handling.
No of records parsed with a particular field being NULL - This can be written to a file or user status using a counter inside the job and retrieved inside the routine. For end timestamp again use any function call of your preference.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use DSGetLogSummary() to determine whether there were any warnings. Presumably, if there were none, you don't want to write to the exceptions file. You can obtain the row counts from "active stage finishing" messages in the log.

Statements OpenSeq, WeofSeq or Seek, WriteSeq and CloseSeq will allow you to work with a text file from a routine. To save a lot of work and to obviate the first three, search the forum for a function called OpenSequentialFile.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bikan
Premium Member
Premium Member
Posts: 128
Joined: Thu Jun 08, 2006 5:27 am

Post by bikan »

Could any one provide me with some code on how to actually do it as it would be very helpful. I am trying to make a after job routine for the same but am unable to achieve the desired functionality.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That, my friend, is called consulting, and is how some of us make our living.

If you would like to post what you have attempted, and why you believe it does not fulfil expectations (with error messages if any exist), then we would certainly comment upon that.

Make sure your code is nicely formatted and commented, and enclose it in Code tags.
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