Page 1 of 1

Wait For File Activity

Posted: Wed Aug 06, 2003 9:52 pm
by calvinlo
Hi all

Could i do sth like Wait For file in a Directory?
Since the input file always comes with a timestamp, e.g. accounts20030805.dat and the timestamp is arbitrary....how can i make use of the "WaitForFile" stage instead of writing DS script.
Thanks

Cal

Posted: Thu Aug 07, 2003 12:11 am
by ray.wurlod
I don't have access to DataStage at the moment, but could you not specify a wildcard in the name of the file for which you're waiting?

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518

Posted: Thu Aug 07, 2003 12:52 am
by calvinlo
I've tried wildcard but it doesn't work and so hope to know if there are other solution

Thanks

Cal

Posted: Thu Aug 07, 2003 9:05 am
by peterh
You can build a routine which construct the file name (based on the date for example) and use WaitForFile routine inside code. Result (file name) could be passed as parameter to the next job.
WaitFor File does not support wildcards as I know.

Peter

Posted: Thu Aug 07, 2003 12:05 pm
by chulett
If it still follows the original code I have for WaitForFile, it does an 'OpenSeq' to check for the existence of the file so wildcards are out.

If you are opposed to writing job control, can what you are being sent be changed? We use semaphore or 'flag files' which are ftp'd *after* the data file. We wait for the flag file to appear before processing the corresponding data file. In your case, that file could have a constant name. Depending on your situation, you could have the name of the data file as a record in the flag file and pull it from there (we typically have control totals in it that are verified).

Also, what about using the Folder stage? I haven't played with it much, but it supports wildcards. Not pretty, but you could run the job in a loop until it finds something to process. [:p]

Or you could just bite the bullet, write some looping job control to get wildcard listings from the target directory and when the file shows up, pull the filename from the output and pass it off to your job stream.

-craig