Wait for File
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
Wait for File
Hi,
I have a requirement that the job should wait for 2 hours if the file does not come to our server. The file name comes as TXFile_Date ( everyday the date vaires)
I am using wait for file activity but this is not working. I used TXFile_* and it is working in sequential file stage but it is not working in wait for file stage. Its not able to detect the *. can anyone help me out.
Thanks,
I have a requirement that the job should wait for 2 hours if the file does not come to our server. The file name comes as TXFile_Date ( everyday the date vaires)
I am using wait for file activity but this is not working. I used TXFile_* and it is working in sequential file stage but it is not working in wait for file stage. Its not able to detect the *. can anyone help me out.
Thanks,
Rajesh Kumar
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Interesting, never tried this. But, if you couldn't do it the way you are attempting to do, you could always:
1) "ls <filename>*" in a Execute command activity and use the output in the Wait for file activity.
or
2) If it is the current date that the file has, then get that in a User variables activity, build the file name there and use that variable in the Wait for File activity
Hope this helps...
1) "ls <filename>*" in a Execute command activity and use the output in the Wait for file activity.
or
2) If it is the current date that the file has, then get that in a User variables activity, build the file name there and use that variable in the Wait for File activity
Hope this helps...
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
Vivek,
I will try to explain this more clearly. This is what we do. Whenever the sequence starts, we do a ls with the file pattern. and if the file is out there, we will get the file name. If the file is not there, we need to wait for 2 Hrs before aborting the job.
Here I need to pass the file name to the 'Wait for File' activity. But I have only my file pattern. And Wait for file activity doesnt work with file patterns. That expects the exact file name.
The date in my file name would be a cycle date and there is no way to determine the date before the file comes in. Is there a way to handle this in datastage without a unix script?
I will try to explain this more clearly. This is what we do. Whenever the sequence starts, we do a ls with the file pattern. and if the file is out there, we will get the file name. If the file is not there, we need to wait for 2 Hrs before aborting the job.
Here I need to pass the file name to the 'Wait for File' activity. But I have only my file pattern. And Wait for file activity doesnt work with file patterns. That expects the exact file name.
The date in my file name would be a cycle date and there is no way to determine the date before the file comes in. Is there a way to handle this in datastage without a unix script?
Arun
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Not that I am aware of. If you want a pure DS solution, then you might have to "ls" and check if the file exists, if not do a "SLEEP" and loop back. This is kind of (not exactly) simulating what the wait for file activity does. The easier way would be to have a Unix script.
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Premium Member
- Posts: 79
- Joined: Thu Mar 22, 2007 4:58 pm
- Location: USA
An alternative would be to have a branch in your sequencer that it goes to if the file is not found.
An execute command there does a sleep nnn to get you your 2 hours. Then you perform your check for the file again using ls and your file pattern.
Abort if not found, merge the flow back in to the rest of your sequence if it is.
An execute command there does a sleep nnn to get you your 2 hours. Then you perform your check for the file again using ls and your file pattern.
Abort if not found, merge the flow back in to the rest of your sequence if it is.
Jack Thornton
----------------
Spectacular achievement is always preceded by spectacular preparation - Robert H. Schuller
----------------
Spectacular achievement is always preceded by spectacular preparation - Robert H. Schuller
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Well, he doesn't want to wait for 2 hrs and then check the file. He wants the process to start doing its thing within those two hours if there is a file available, else abort.jcthornton wrote: An execute command there does a sleep nnn to get you your 2 hours. Then you perform your check for the file again using ls and your file pattern.
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
The "Wait For File" stage does not support wildcards, so you'll need to "work around" that by building your own mechanism. I've coded this in the past as a shell script that loops / checks / sleeps over the X hour period needed, you can then use an Execute Command stage to run it.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: