Wait For File Activity generating incorrect code?

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

Wait For File Activity generating incorrect code?

Post by djbarham »

I've been having problems with a Wait For File activity going to the exception handler rather than the links indicated by triggers.

After playing around with different options and examining the generated code, it is my belief that a Wait For File Activity generates incorrect job control code if
* you have "Automatically handle activities that fail" enabled AND
* you do not have an "Otherwise" expression on one of the links.

The effect of the incorrect code is that it checks for a failure (any response <> 0) and branches to the error handler BEFORE it checks the trigger conditions.

Maybe I misunderstand how I am supposed to use this, but this seems wrong to me.

I was hoping to have one link check for DSJE.NOERROR, a second link check for DSJE.TIMEOUT and any other failures handled by the error handler.

Is anyone able to shed any light on this behaviour, or at least provide tips the conditions they usually use with a wait for file activity?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Timeout IS regarded as "failure" in the Wait For File activity. All you need are success and failure triggers. No other trigger will be honoured.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
djbarham
Participant
Posts: 34
Joined: Wed May 07, 2003 4:39 pm
Location: Brisbane, Australia

Post by djbarham »

Thanks Ray.

Yeah, I'm starting to think that I'll skip the WFF activity altogether. I really just want to know of the file is there or not, so I think I'll use a Unix command instead.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

To check for file existence, set the timeout to zero. Then as Ray noted, you just need "OK" and "Otherwise" triggers from the stage - the former for the file being found and the latter for it not being found. Those two triggers should also tell the generated code that you are handling any errors (since it covers all bases) and the "Automatically handle" option should no longer be an issue.
-craig

"You can never have too many knives" -- Logan Nine Fingers
djbarham
Participant
Posts: 34
Joined: Wed May 07, 2003 4:39 pm
Location: Brisbane, Australia

Post by djbarham »

chulett wrote:To check for file existence, set the timeout to zero.
Yes, I was doing that, but a time out still causes a warning to be logged. No file is a perfectly acceptable result for me so I'd prefer not to have the warning.

I'm now using a Unix if command and it is working fine. Still had to resort to a full "if then else" though to avoid a 1 being returned to DataStage (eg from "test ..." or "[ -f ... ] ..." )

eg

if [ -f filename ] ; then echo "FILE" ; else echo "NOFILE" ; fi

Thanks for the help, Ray and Craig.
Post Reply