Automatically handle activities that fail.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Mat01
Premium Member
Premium Member
Posts: 50
Joined: Wed Jun 02, 2004 11:12 am
Location: Montreal, Canada

Automatically handle activities that fail.

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

Post by chulett »

Check this post and see if it helps.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mat01
Premium Member
Premium Member
Posts: 50
Joined: Wed Jun 02, 2004 11:12 am
Location: Montreal, Canada

Post 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...
Mat01
Premium Member
Premium Member
Posts: 50
Joined: Wed Jun 02, 2004 11:12 am
Location: Montreal, Canada

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
Mat01
Premium Member
Premium Member
Posts: 50
Joined: Wed Jun 02, 2004 11:12 am
Location: Montreal, Canada

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

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

"You can never have too many knives" -- Logan Nine Fingers
Mat01
Premium Member
Premium Member
Posts: 50
Joined: Wed Jun 02, 2004 11:12 am
Location: Montreal, Canada

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

Post by chulett »

No problem. :wink: Glad you got it working for you!
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply