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?
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...
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.
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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
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...