Capturing part of job log using routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Capturing part of job log using routine

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The routines you need to use are:

DSAttachJob()
DSGetJobInfo()
DSGetLogSummary()
DSGetLogEntry()
DSDetachJob()
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Last edited by Roopanwita on Thu Jun 19, 2008 10:00 pm, edited 1 time in total.
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

what is the problem you are getting? Is it running properly?
Birendra
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post 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?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
thumati.praveen
Participant
Posts: 106
Joined: Wed Oct 04, 2006 5:21 am

Post 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
thumati.praveen
Participant
Posts: 106
Joined: Wed Oct 04, 2006 5:21 am

Post by thumati.praveen »

what you want to output ErrorID or ErrorDetail ?

assign These variable to Ans.
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Last edited by Roopanwita on Thu Jun 19, 2008 10:01 pm, edited 1 time in total.
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Last edited by Roopanwita on Thu Jun 19, 2008 10:20 pm, edited 1 time in total.
thumati.praveen
Participant
Posts: 106
Joined: Wed Oct 04, 2006 5:21 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Notification Activity. 'Include job status' option. Try it, see if it gets you what you want without all that extra who-ha.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post 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...
Post Reply