Page 1 of 1

Check to see if a file exists

Posted: Wed Jan 14, 2009 4:00 pm
by jherr22
I have a case where I do not know at runtime if an input file will exist. Is there a way to dynamically test from datastage if a file exists and continue on if it does not exist? I am running a sequence, and if the file does not exist, I do not want the job accessing it to abort, which would cause the sequence to abort. Any thoughts?

Posted: Wed Jan 14, 2009 4:13 pm
by chulett
You could use the Execute Command stage to do (off the top of my head) a "test -f filename" on the file and then conditionally run the job based on the result. Or perhaps "-s" if you need to check if it exists and is not empty as well.

Posted: Wed Jan 14, 2009 6:24 pm
by ray.wurlod
A Routine activity that did the same thing - either with a command or via BASIC statements such as OpenSeq - might be more flexible in terms of logging informative/alert messages. Of course you could also direct a trigger from the Execute Command activity to a logging routine activity.

Posted: Thu Jan 15, 2009 10:14 am
by jherr22
Thanks for the help - you sent me the answer I was looking for and it works PERFECT!