Page 1 of 1

Extract DS Job Logs

Posted: Thu May 25, 2006 10:44 am
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!

Posted: Thu May 25, 2006 4:28 pm
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.

Posted: Fri May 26, 2006 2:58 am
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