Page 1 of 2

Capturing part of job log using routine

Posted: Tue May 27, 2008 12:06 am
by Roopanwita
Hi,

I want to capture part of job log(e.g - job has finished /aborted - with error msg line) using a DS ROUTINE.
My actual requirement is ,in a Sequence I m sending a mail notification after successful competion of process & if it abort in any intermediate stage ,then it send a failure msg.
Rather than going into job log ,i want to know it from mail msg.

Thanks in advance

Posted: Tue May 27, 2008 1:29 am
by ArndW
The routines you need to use are:

DSAttachJob()
DSGetJobInfo()
DSGetLogSummary()
DSGetLogEntry()
DSDetachJob()

Posted: Tue May 27, 2008 1:36 am
by Roopanwita

Posted: Tue May 27, 2008 1:43 am
by bkumar103
what is the problem you are getting? Is it running properly?

Posted: Tue May 27, 2008 2:11 am
by Roopanwita
I am unable to compile this routine.

Then if I m using in Routine Activity,do I need 2 pass value of arguments?

Posted: Tue May 27, 2008 4:23 am
by ArndW
Did you declare this as a routine or a before/after job routine? There is a big difference. What is your compiler error?

Posted: Tue May 27, 2008 5:15 am
by thumati.praveen
Roopanwita wrote:Hi,
I wrote a Routine

$INCLUDE DSINCLUDE JOBCONTROL.H
Ans=0
Erroid = 0
ErrorDetail=0
JobName= ' '
handleJob = DSAttachJob(JobName, DSJ.ERRNONE)
If NOT(handleJob) Then
Errorid = -99
End
Else
/*Ans = DSGetJobInfo(handleJob, DSJ.LOGFATAL) */
Errorid = DSGetNewestLogId (handleJob, DSJ.LOGFATAL)
EventDetail = DSGetLogEntry(JobHandle, DSJ.LOGFATAL)
End
DetachResult = DSDetachJob(handleJob)


But it is not working.
Can you help me to fix it.

Thanks in advance.
Change the EventDetail = DSGetLogEntry(handleJob, DSJ.LOGFATAL)

JobHandle not declared before

Posted: Tue May 27, 2008 5:18 am
by thumati.praveen
what you want to output ErrorID or ErrorDetail ?

assign These variable to Ans.

Posted: Tue May 27, 2008 5:49 am
by Roopanwita

Posted: Tue May 27, 2008 5:50 am
by Roopanwita

Posted: Tue May 27, 2008 6:03 am
by thumati.praveen
Roopanwita wrote:I want Error detail
My code looks like

$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = 0
Errorid=0
ErrorDetail=0
jobname=' '
handleJob = DSAttachJob(JobName, DSJ.ERRNONE)
If NOT(handleJob) Then
Errorid = -99
Ans = DSGetJobInfo(handleJob, DSJ.LOGFATAL)
Errorid = DSGetNewestLogId (handleJob, DSJ.LOGFATAL)
EventDetail = DSGetLogEntry(handleJob, DSJ.LOGFATAL)
End
DetachResult = DSDetachJob(handleJob)
/*Reply = DSSendMail(Ans)
*/
DSGetLogEntry() This function requires two parameters one is job name anithor one is EventID .

DSGetLogEntry(handleJob, Errorid) use this it should work now.

and finally assign the Ans to EventDetails

Posted: Tue May 27, 2008 6:37 am
by chulett
Are you aware that if you simply 'Include job status' in the email, the last message in the email will be from the failed job and the error will be in the email as well?

Posted: Tue May 27, 2008 7:08 am
by Roopanwita
My requirement is to post Error msg by mail,in case of job failure.I coudn't get your msg.
Can you explain it again.

Posted: Tue May 27, 2008 7:18 am
by chulett
Notification Activity. 'Include job status' option. Try it, see if it gets you what you want without all that extra who-ha.

Posted: Tue Jun 03, 2008 11:44 pm
by Roopanwita
Hi,
Thanks for help.
I have checked with Notification Activity Stage. It sends the status msg (like finished successfully/finisished with warning/Aborted) only.

I want to capture the error msg line(in case of fatal error) from the job log, so that in case of job failure i can understand the reason of failure rather than going & checking it from job log...