validate the existence of a file

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
tricampeon81
Participant
Posts: 19
Joined: Thu Apr 19, 2018 11:06 am
Location: chile
Contact:

validate the existence of a file

Post by tricampeon81 »

FRIENDS FROM datastage I need to validate if there is a file who can show me an example
dfgdfg
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
tricampeon81
Participant
Posts: 19
Joined: Thu Apr 19, 2018 11:06 am
Location: chile
Contact:

Post by tricampeon81 »

fixed filename
dfgdfg
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tricampeon81
Participant
Posts: 19
Joined: Thu Apr 19, 2018 11:06 am
Location: chile
Contact:

Post 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
dfgdfg
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
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