FTP Stage

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
meorz
Participant
Posts: 8
Joined: Thu Jul 28, 2005 6:00 pm

FTP Stage

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
Last edited by chulett on Tue Sep 06, 2005 3:33 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mdan
Charter Member
Charter Member
Posts: 46
Joined: Mon Apr 28, 2003 4:21 am
Location: Brussels
Contact:

Re: FTP Stage

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

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mdan
Charter Member
Charter Member
Posts: 46
Joined: Mon Apr 28, 2003 4:21 am
Location: Brussels
Contact:

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