Execute command activity and Exception Handler

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
djbarham
Participant
Posts: 34
Joined: Wed May 07, 2003 4:39 pm
Location: Brisbane, Australia

Execute command activity and Exception Handler

Post by djbarham »

In a sequence job, I have "Automatically handle activities that fail" enabled and a generic exception handler that calls a routine to log a message and generate an email.

One of the steps is an Execute Command activity.

This shell command returns 0 on success, 1 if it didn't find the file (on a remote FTP server) it was looking for or other values if something broke (eg it couldn't connect to the FTP server). The script uses rsh to execute FTP on another server (due to firewall restrictions).

My issue is this ... the generated code for the exception handler always checks the result FIRST, before any trigger code. Although it reports the error as an unhandled exception, it ignores my attempts to handle it.

I have found the only way to stop the exception handler from intervening (apart from completely disabling it) is to use the "Otherwise" trigger.

It does not make sense to my why the triggers are not evaluated before the exception handler steps in.

The next best solution I can see is to have triggers for the 0 and 1 return values and then an "Otherwise" that goes to a routine activity that duplicates the one in the exception handler.

Anyone have any other thoughts about why it behaves this way or a better way to approach this?
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

The exception handler does not evaluate the result of any command- or job activities being called by a sequence. It will identify errors like jobs not being in a runnable state and handle those. The result of the activities has to be evaluated using triggers - as you already found out.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you have an explicit Failure trigger it should pre-empt anything the Exception Handler might be set up to do. A Failure trigger should fire if the exit status is any non-zero value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply