Page 1 of 1

FTP Stage

Posted: Tue Sep 06, 2005 5:14 am
by meorz
Thank you for the support all this while :)

Currently I need to GET a file from an FTP Server.

However I should only trigger this when the file exist on the FTP server.

Any idea how to achieve this?

Thanks a lot

Posted: Tue Sep 06, 2005 6:15 am
by ray.wurlod
Currently I need to drink a glass of water when George Bush scratches his ear.

Only when he scratches his right ear.

Any idea how to achieve this?

:roll:

Try and sleep and try and sleep until you get it.

Posted: Tue Sep 06, 2005 6:52 am
by chulett
Oh dear, now we are mixing politics and DataStage... and not even Tasmanian politics at that. How 'bout "I need to drink a glass of water when Paul Lennon scratches his ear". :wink:

In there after the rolly eyes bit is an actual suggestion: unless someone is going to do something to let you know the file is there and ready for you - you need to go look for yourself. Build some sort of looping construct, either running the job that does the FTP get using the FTP stage, or script it and run it in your own job control code. Once the script has found the file, hand it off to a processing job. In either case if it can't be found, sleep awhile and try again. Make sure you build an out so it doesn't run forever. :shock:

I prefer the latter as you have more control over exactly what happens and it just seems 'cleaner' to me. The DataStage job will abort if the file it attempts to get doesn't exist, but that can be handled.

Re: FTP Stage

Posted: Tue Sep 06, 2005 3:13 pm
by mdan
short answer: use a wait for file stage.
better if you ask for a flag file, because if you get the file when is still processed you may get it incomplete ... or ask for the file to be pushed to you server (better) and then for a flag file. In a wait for file you may set the waiting time ...
BTW: you have it in the docs
meorz wrote:Thank you for the support all this while :)

Currently I need to GET a file from an FTP Server.

However I should only trigger this when the file exist on the FTP server.

Any idea how to achieve this?

Thanks a lot

Posted: Tue Sep 06, 2005 3:32 pm
by chulett
short responce: Can't. :wink:

The Wait For File stage is for waiting on files being pushed to the DataStage server, while the OP needs to go get a file from a remote server.

Posted: Tue Sep 06, 2005 4:16 pm
by mdan
ok .. my mistake :roll: ... however, if the remote ftp server is an unix machine and he has telnet access, he can run a shell script to wait for the file (or a flag file), in Telnet Before Command.

waitforfile.sh
---
#!/usr/bin/ksh
while test ! -e /tmp/testfile; do
sleep 5
done
---
could be adjusted to exit after a timeout
chulett wrote:short responce: Can't. :wink:

The Wait For File stage is for waiting on files being pushed to the DataStage server, while the OP needs to go get a file from a remote server.