Page 1 of 1

Automatically handle activities that fail.

Posted: Fri Sep 10, 2004 9:03 am
by Mat01
Hi All,

I have a question concerning the option "automatically handle activities that fail" in the job sequencer. It seems to work fine but when I have a routine or an execute command in my sequencer, it fails no matter how the activity finishes. The routine is executed successfully but the sequencer aborts after that. Removing the check for this option solves the problem of the routine abort but I'd like it to work with the error handler. Anybody knows why that is?

Here are the error messages:
1 (Warning).

Code: Select all

 Routine_Seq..JobControl (@Routine_Activity_0): Controller problem: Unhandled failure (1) encountered calling routine DSX.UTILITYMESSAGETOLOG
2 (Fatal).

Code: Select all

Routine_Seq..JobControl (fatal error from @Coordinator): Sequence job (restartable) will abort due to previous unrecoverable errors
I am on DS v7.1

Regards,

Mat

Posted: Fri Sep 10, 2004 9:46 am
by chulett
Check this post and see if it helps.

Posted: Fri Sep 10, 2004 10:12 am
by Mat01
Thanks,

It may have something to do with the return value of the routine. I set up a test with a sequencer that has only a routine activity (With a standard write to log routine). My sequencer doesn't have any trigger since there is only one "activity". The job sequencer fails anyway after the routine has been executed successfully. I am still puzzled as to why...

Posted: Fri Sep 10, 2004 10:50 am
by Mat01
Hi,

I found out why this is happening. The generated job control code for the sequencer checks the return code of the routine. If the return code is not 0, it fails!!!

I tested it with a routine that returns 0 and...no failure this time. This means that we can't use any of our routines which return non-zero values (like row counts) if we want to turn on the feature to handle errors.

Thanks.

Posted: Fri Sep 10, 2004 5:44 pm
by ray.wurlod
That's the documented behaviour of before/after subroutines.

However, in a Routine Activity you can specify custom triggers or triggers based on any return value. Having these overrides the default "activities that fail" rule.

Posted: Fri Sep 10, 2004 8:11 pm
by chulett
Mat01 wrote:The generated job control code for the sequencer checks the return code of the routine. If the return code is not 0, it fails!!!
:lol: Which is exactly what the post I sent you to explains, including Ray's advice.

Posted: Fri Sep 10, 2004 9:30 pm
by Mat01
Sorry guys. I'm probably very slow...

So I added a second routine to my test sequence and used a custom trigger (Routine_Activity_0.$ReturnValue = 1) instead of the return value trigger alone. As you see, I want my next job to be triggered when the return value is 1. It still fails and if you look at the code below, the error is still triggered for any return value <> 0.

Code: Select all

 Call 'DSX.UTILITYMESSAGETOLOG'(r$V0S0, p$V0S0$1)
   summary$<1,-1> = Time$$:Convert(@VM, " ", DSMakeMsg("DSTAGE_JSG_M_0064\%1 finished, reply=%2", "Routine_Activity_0":@FM:r$V0S0))
   IdV0S0%%Result1%%1 = r$V0S0
   IdV0S0%%Name%%3 = "DSX.UTILITYMESSAGETOLOG"
   If (r$V0S0 <> 0) Then
   err$source = "Routine_Activity_0"; err$number = 1
   msg$ = DSMakeMsg("DSTAGE_JSG_M_0042\Unhandled failure (%1) encountered calling routine %2", r$V0S0:@FM:"DSX.UTILITYMESSAGETOLOG")
   msg$id = "@Routine_Activity_0"; GoTo L$ERROR
   End


What am I missing?

Thank you for your help

Mat

Posted: Fri Sep 10, 2004 10:45 pm
by chulett
Hmm... not really using this feature of Sequence jobs, so not sure about some of the subtleties. :? Question - what other triggers do you have off the routine? Do you have an 'Otherwise' trigger or something else that handles what it would consider 'failures'?

From what I recall from reading the release notes, if you do that then it won't add the 'Unhandled failure' code that is causing you grief when you select that option. I think.

Posted: Sat Sep 11, 2004 7:42 am
by Mat01
I added an "otherwise" trigger to my routine and it did work this time. I guess if you don't have a "failure trigger" it keeps checking for this 0 return value...I do not usually use a failure trigger with every routine...some are so simple that they could not really fail. Well that serves me right for being to confident!

Thanks a lot for your help. Sorry it took me a while to get it...

Mat

Posted: Sat Sep 11, 2004 1:17 pm
by chulett
No problem. :wink: Glad you got it working for you!