Wait For File Activity

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
calvinlo
Participant
Posts: 31
Joined: Thu Jul 17, 2003 2:55 am

Wait For File Activity

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
calvinlo
Participant
Posts: 31
Joined: Thu Jul 17, 2003 2:55 am

Post by calvinlo »

I've tried wildcard but it doesn't work and so hope to know if there are other solution

Thanks

Cal
peterh
Participant
Posts: 9
Joined: Thu Feb 13, 2003 2:34 am

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

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