DSMakeJobReport Code
Posted: Fri Dec 09, 2005 1:38 pm
Hi,
Any idea where do i get the code for DSMakeJobReport.
Thanks
Any idea where do i get the code for DSMakeJobReport.
Thanks
Code: Select all
$include DSINCLUDE JOBCONTROL.H
JobHandle = DSAttachJob (JobName, DSJ.ERRFATAL)
If NOT(JobHandle ) Then
Call DSLogFatal("Job not exists!", "JobControl")
Abort
End
Ans = DSMakeJobReport(JobHandle,Type,"LF")
Code: Select all
*************************************************************
* Attaching the job handle of the job, whose log has to be written -
* I.JobName and I.LogFile are parameters
*************************************************************
hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed":JobName, "JobControl")
Abort
End
************************************************SRI*****************
*LatestLogId = DSGetNewestLogId(hJob1,DSJ.LOGANY)
*LatestEventString = DSGetLogEntry(hJob1,LatestLogId)
*************************************************************
* Calculating the job start time and the current time - the window for
* getting the log and the invocation id of the job
*************************************************************
JobStartTime = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP)
CurrentTime = Oconv(Date(),"D-YMD[4,2,2]"):' ':Field(TimeDate(), " ", 1, 1)
JobInvocationId = DSGetJobInfo (hJob1, DSJ.JOBINVOCATIONID)
Call DSLogInfo("Job Start time":JobStartTime,"JobControl")
Call DSLogInfo("Current time":CurrentTime,"JobControl")
Call DSLogInfo("Current job Invocation id" : JobInvocationId, "JobControl")
*************************************************************
* Fetching the job log info using DSGetLogSummary in to the dynamic
* array LOGANY - Indicates all sort of log info
* 0 indicates unlimited records of log
*************************************************************
SummaryArray = DSGetLogSummary(hJob1,DSJ.LOGANY,JobStartTime,CurrentTime,0)
*************************************************************
* Computing the number of lines of log, filtering the log based on
* invocation id and writting into the log file
*************************************************************
ArrayLines = DCOUNT(SummaryArray,@FM) ;** count number of lines
OpenSeq LogFile To SeqOutFilePtr Then
WeofSeq SeqOutFilePtr ;* write end-of-file mark immediately
End
FOR Counter = 1 TO ArrayLines
TempLine = FIELD(SummaryArray,@FM,Counter)
If FIELD(TempLine,'\',4) = JobInvocationId
Then
WriteSeq TempLine To SeqOutFilePtr
On Error
Call DSLogFatal("Error from status=":Status(),"JobControl")
End
Else
Call DSLogInfo ("Unable to Write to ","JobControl")
End
End
NEXT Counter
CloseSeq SeqOutFilePtr
*************************************************************
*End
*************************************************************