Hi,
I am trying to write a job, which dumps some information of the director to a file on unix when the job has aborted due to a fatal error.
I've been looking with the search function and found some solutions using dsjob.
Now I have the following statement
dsjob -logsum -type FATAL -max 3 INTFUAT refresh_ODS_MV
(INTFUAT is the projectname, refresh_ODS_MV is the jobname)
Is it possible with the above, not to limit the output to the last 3 entries, but to limit the output for the final run ?
Thanks for any help
Capturing the director log metadata
Moderators: chulett, rschirm, roy
Purely playing from memory here, but I think dsjob has an option somewhere of -lognewest that would restrict to output from most recent run. Best bet, as ever, first and always, would be to refer to the product documentation
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
Hi,
thanks from the feedback but I've taken a bit of a different approach. I've created an after routine with the following code:
Now I have a problem. The routine is called in a job which collects meta data in all cases (even if the job has run successfully).
I only want this piece of code to be executed, if the job for which meta data is collected had a fatal error. Can i do a null check on the GetLogSum ? The help guide sais it is an array so i am not sure how to do a check for empty values on it. Or can i do a check earlier in the code ?
thanks from the feedback but I've taken a bit of a different approach. I've created an after routine with the following code:
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode = 0
JobName = Trim(Field(InputArg,";",1,1))
DirName = Trim(Field(InputArg,";",2,1))
Suffix = ".txt"
Call DSLogInfo('InputArg passed : ' : JobName , 'Job20Stat')
Call DSLogInfo('InputArg2 passed : ' : DirName , 'Job20Stat')
handlejob=DSAttachJob (JobName,DSJ.ERRNONE )
*JobName = DSGetJobInfo(handlejob,JobName)
JobStarted = convert(" :-","_",DSGetJobInfo(handlejob,DSJ.JOBSTARTTIMESTAMP))
FileName = JobName:"_":JobStarted:Suffix
StartTimeStamp = DSGetJobInfo (handlejob, DSJ.JOBSTARTTIMESTAMP)
EndTimeStamp = DSGetJobInfo (handlejob, DSJ.JOBLASTTIMESTAMP)
*Only retrieve the FATAL errors
GetLogSum = DSGetLogSummary(handlejob,DSJ.LOGFATAL ,StartTimeStamp,EndTimeStamp,0)
Openpath DirName to t.fvar then
write GetLogSum to t.fvar, FileName else
call DSLogWarn("Failed to write file ":FileName:" to directory ":DirName, "GetJobLog")
end
end
else
call DSLogWarn("Failed to open directory ":DirName, "GetJobLog")
end
close t.fvar
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
I only want this piece of code to be executed, if the job for which meta data is collected had a fatal error. Can i do a null check on the GetLogSum ? The help guide sais it is an array so i am not sure how to do a check for empty values on it. Or can i do a check earlier in the code ?