Page 1 of 1

validate the existence of a file

Posted: Wed May 09, 2018 9:13 am
by tricampeon81
FRIENDS FROM datastage I need to validate if there is a file who can show me an example

Posted: Wed May 09, 2018 9:45 am
by chulett
Will this file have a fixed filename or does it change every day, meaning a wildcard match will be required for this test?

Posted: Wed May 09, 2018 10:29 am
by tricampeon81
fixed filename

Posted: Wed May 09, 2018 11:45 am
by chulett
Okay, that opens up the possible solutions. How about expanding on where this validation fits into whatever it is controlling? Meaning once the file shows up, what do you need to happen?

Without knowing any details, the first thought is a Wait For File stage in a Sequence job. The job can run and wait of it to show up and then trigger downstream processing when it does. And you can define a failure path if the file does not show up after a period of time. Another option is letting an Enterprise Scheduler handle that, if you have anything of the sort there.

Posted: Wed May 09, 2018 12:54 pm
by UCDI
in a sequence, execute command and parse the results of a ls or similar check is pretty easy for a binary presence answer without waiting on it to suddenly appear.

Posted: Wed May 09, 2018 1:08 pm
by chulett
Sure... on the UNIX side I would use a shell "file test operator", specifically -e for that. Wasn't sure what the Windows equivalent would be so hadn't brought that up. Yet. :wink:

Posted: Wed May 09, 2018 6:22 pm
by ray.wurlod
Since versions 8.x are running alongside MKS Toolkit, you can use the same UNIX command (test).

A test can similarly be performed using a DataStage BASIC routine, but I'm guessing you don't really want to go there.

Posted: Thu May 10, 2018 12:58 pm
by tricampeon81
UCDI wrote:in a sequence, execute command and parse the results of a ls or similar check is pretty easy for a binary presence answer without waiting on it to suddenly appear.
thank you very much this was what I needed

Posted: Thu May 10, 2018 1:45 pm
by chulett
Still going to note that IMHO a "binary presence answer" would be way more straight-word using a file test than parsing the results of a listing. Especially considering the filename is fixed, not variable. :wink:

Posted: Thu May 10, 2018 11:18 pm
by ray.wurlod
... like the OpenSeq statement in DataStage BASIC taking the Then path if the file exists and the Else path if the file does not exist?