Page 1 of 1

finding unix file

Posted: Wed Dec 28, 2005 6:14 am
by Veni
How to check file is found in a specific direcotry using datastage sequence.

Posted: Wed Dec 28, 2005 6:29 am
by koolnitz
Use Unix find command in a Execute Command activity in your job sequence.

Posted: Wed Dec 28, 2005 7:52 am
by chulett
You could also investigate the WaitForFile stage, which actually doesn't have to wait at all. You can use it as a file existance checker, for example, and branch accordingly.

Posted: Thu Dec 29, 2005 7:27 am
by Veni
chulett wrote:You could also investigate the WaitForFile stage, which actually doesn't have to wait at all. You can use it as a file existance checker, for example, and branch accordingly.
i am using find #path#/Test.txt in execute command in sequence how do check the status.. if file found i need to do one process if not found another process... problem i encounter here is if file is not found , it is throug warning like this "file can't open ... no such file in directory' instead

Posted: Thu Dec 29, 2005 8:23 am
by chulett
Did you give the WaitForFile stage a shot? :?

Don't use 'find' as the command, try using something like 'test' instead. Check your man pages.

Posted: Thu Dec 29, 2005 8:43 am
by Veni
chulett wrote:Did you give the WaitForFile stage a shot? :?

Don't use 'find' as the command, try using something like 'test' instead. Check your man pages.
yes i try with WaitForFile stage this success for file exits if file is not found i need to run another job. here in trigger what value do i need to check
beceause if file is not there job through warning and got aborted .

Posted: Thu Dec 29, 2005 8:49 am
by chulett
Set the WaitForFile to not wait and it will simply check for existance. Two links out - one 'Ok' link for the file being found and an 'Otherwise' link for when the file isn't found. By itself it should throw a warning, from what I recall.

Pretty much the same thing you'd do for the Execute Command stage with the 'test' command...

Posted: Thu Dec 29, 2005 9:03 am
by Sreenivasulu
Hi,

Help for using the find command

find ./ -name FILENAME - to search from current directory

Regards
Sreeni

Posted: Thu Dec 29, 2005 3:10 pm
by ray.wurlod
You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.

Posted: Thu Dec 29, 2005 4:24 pm
by vincentph
ray.wurlod wrote:You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.
There may be another advantage to using the test command: we found that WaitForFile requres read permission on the file. That could be a problem if the process you are waiting for has sent the trigger file to your server via FTP in which case the file permissions may be such that your process cannot read it.

Posted: Thu Dec 29, 2005 7:59 pm
by ray.wurlod
Welcome aboard! :D

And thank you for a useful contribution. Your observation makes a point that I know about, and should have mentioned rather than assuming everyone knows all there is to know about UNIX commands. :oops:

Posted: Fri Dec 30, 2005 5:20 am
by Veni
vincentph wrote:
ray.wurlod wrote:You could also use an Execute Command activity and use the test command. Again, supply two triggers, driven by the exit status of the command.
There may be another advantage to using the test command: we found that WaitForFile requres read permission on the file. That could be a problem if the process you are waiting for has sent the trigger file to your server via FTP in which case the file permissions may be such that your process cannot read it.
Thanks a lot to every body.

Posted: Fri Dec 30, 2005 8:56 am
by kumar_s
Hi veni,
Also be aware of the fact that, if you it is designed to wait for a file which is about to produce by any other job, the WaitForFile stage will trigger the its sequence as soon as the file appear in the folder. But it is not sure the file present may or may not be a full file. :?
To overcome this you can produce a indicator file and you can check for that. :wink:

-Kumar