Hi....
I am trying to archive the job log after every run, i need to save the full detail log in a flat file.
I am able to save the status of the job and runtime but i need the whole log even if it ran with OK, Warn or Aborted. Is there any way to get the log.
I am using 7.5.2 Version on Windows platform.
Any suggestions would be very helpful...
Thanks in advance... :D
Archive Datastage Job Logs
Moderators: chulett, rschirm, roy
Archive Datastage Job Logs
Victor
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
From the operating system (perhaps through ExecDOS) you can redirect the output of dsjob -logsum command. Or you can create your own routine using functions from the DataStage API to interrogate the log.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hi Ray & Duke..
Thanks for the response....
Duke -
Can you tell me something more about the UV stage and how can i read the log... What are the columns to specified to retrieve the log...
I tried with couple of dummy columns where I can get date occurred and event ... but i am not able to retrieve the first 2 records i.e., Starting job parameters and Environment variable settings.
Thanks ....
Thanks for the response....
Duke -
Can you tell me something more about the UV stage and how can i read the log... What are the columns to specified to retrieve the log...
I tried with couple of dummy columns where I can get date occurred and event ... but i am not able to retrieve the first 2 records i.e., Starting job parameters and Environment variable settings.
Thanks ....
Victor
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You might like to adapt the following example.
Code: Select all
SUBROUTINE ArchiveJobLog(InputValue, ErrorCode)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
$INCLUDE UNIVERSE.INCLUDE FILEINFO.H
DEFFUN OpenSequentialFile(FilePath,OpenMode,WriteMode,LogMode) CALLING "DSU.OpenSequentialFile"
ErrorCode = 0
* InputValue contains pathname of log file.
hFile = OpenSequentialFile(InputValue, "W", "O", "Y")
If FileInfo(hFile, FINFO$IS.FILEVAR)
Then
JobStartTimestamp = DSGetJobInfo(DSJ.ME, DSJ.JOBSTARTTIMESTAMP)
NewestStartId = DSGetLogInfo(DSJ.ME, DSJ.LOGSTARTED)
NewestLogId = DSGetLogInfo(DSJ.ME, DSJ.LOGANY)
InterimStatus = DSGetJobInfo(DSJ.ME, DSJ.JOBINTERIMSTATUS)
WriteCount = 0
For EventId = NewestStartId To NewestLogId
LogEntry = DSGetLogEntry(DSJ.ME, EventId)
TimeStamp = Field(LogEntry, "\", 1, 1)
UserInformation = Field(LogEntry, "\", 2, 1)
EventType = Field(LogEntry, "\", 3, 1)
EventMessage = Field(LogEntry, "\", 4, 99999)
WriteSeq LogEntry To hFile Then WriteCount += 1
Next EventId
InfoMsg = WriteCount : " lines written to archive file."
Call DSLogInfo(InfoMsg, "ArchiveJobLog")
End
Else
ErrMsg = "Unable to open " : Quote(InputFile)
Call DSLogWarn(ErrMsg, "ArchiveJobLog")
ErrorCode = 1
End
RETURN
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.