Extract DS Job Logs

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
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Extract DS Job Logs

Post by ririr »

I am using the ExtractLogMsgs subroutine to collect the job logs in a text file.

The subroutine works fine for existing files with the JobName.log in the below call.

Call DSLogInfo("Open Output Log Filename ", "ExtractLogMsgs")
OutputLogFname = LogFileDirectory:"\dsEtl_":JobName:".log"

How can I tell the routine to create the JobName.log file if the file does not exist.

I currently do that in a shell script. But wondering if this can be done from DS subroutine (ExtractLogMsgs).

Any help is appreciated!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

ExtractLogMsgs is one of yours, not one of DataStage's. All DataStage routines have names beginning with "DS". You can post the code here (a) if your employer permits and (b) you want us to check it over. Don't forget to enclose it in Code tags so that formatting is preserved.

There is a Create statement in DataStage BASIC, but you don't need it.

Note that OpenSeq will take the ELSE clause if the file does not exist, but the file is nevertheless open for writing.

CloseSeq will create the file if any write operation (WriteSeq, WeofSeq, WriteBlk) has occurred. You don't have to do anything.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Try the following this will create file and write to0

* t.var is directory name
* Filename is name of file
* Logrec is log record

Openpath DirName to fvar then
write Logrec to fvar, FileName


Thanks,
Anupam
Post Reply