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?
Wait For File Activity generating incorrect code?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
"You can never have too many knives" -- Logan Nine Fingers
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.chulett wrote:To check for file existence, set the timeout to zero.
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.