Page 1 of 1

Urgent Regarding FTP stage

Posted: Wed Jan 08, 2003 6:27 am
by asnagaraj
Can anyone help me with this issue ?

i have to develop a job that will ftp files from remote server to my local and also rename the ftped file once the ftp is done.

like if i have text1.txt i ftp that to my local and then rename it to text2.txt on the remote server side.

also it must be done for more than one file.

help me.

Programmer Analyst,
Cognizant,
Chennai.

Posted: Wed Jan 08, 2003 7:34 am
by chulett
There is no need to 'rename' the file on the other side in DataStage anymore than you need to do that in a 'regular' ftp. The name of the file that you feed into the ftp stage doesn't need to bear any resemblance to the file name on your ftp target.

Simply supply the 'new' name in the ftp stage.

-craig

Posted: Wed Jan 08, 2003 7:55 am
by asnagaraj
No, that doesnt answer my question. if u can help me out by describing more on that or point me to some place where i can get more information.

please.

Programmer Analyst,
Cognizant,
Chennai.

Posted: Wed Jan 08, 2003 9:58 am
by chulett
Well, let me see..

In it's simplest form, let's say you have a job with only a Sequential Stage and an FTP stage. In the Sequential stage you specify that directory and name of the file to be transferred, in your example 'text1.txt' is the file name. In the FTP stage on the General / Properties tab you supply Server Name to FTP to plus the Userid and Password required to log on. On the Input / Properties tab you then have to specify the 'Remote Path', ie where you want the file to go, and also the 'Remote File Name' ie what you want it called on the target server. To continue your example, you would put 'text2.txt' in as the 'Remote File Name' and that's what it will be called on the target server, no renaming required.

Does that answer your question now or am I missing something in what you are actually trying to do?

-craig

Posted: Wed Jan 08, 2003 3:47 pm
by ray.wurlod
To summarise Craig's point, you provide two file names to the FTP stage; the source name and the destination name.
If these are not the same, then renaming occurs automatically.

Posted: Wed Jan 08, 2003 9:27 pm
by asnagaraj
hey guys,

thanx very much for those answers, that clearly explains about how should i go about doing thingz with an FTP Stage, still (sorry..) i dont think you have understood my question guys.

I have an ftp server and iam ftping things to my local(that doesnt matter i know) but my question was to download files not a single file..using a single job that runs once.

Also after i ftp the files to my local, the filenames must be changed on the server side..not surely on the client side.

please do help me.



Programmer Analyst,
Cognizant,
Chennai.

Posted: Wed Jan 08, 2003 9:42 pm
by raviyn
I don't think u can ftp multiple flenames ..I think u might need to go two job strategy and run the second Job(ur actual job) with different filenames....U can read the filenames from a sequential file containing all filenames if the filenames are all fixed.

If ur DS server is on windows can't u execute a batch file(in Exec DOS command) this kept on ur server and commands inside manuplating on the Ftp server side(i.e renaming the file etc)....

Hope this might help...

Posted: Wed Jan 08, 2003 10:19 pm
by asnagaraj
hi raviyn,

i understand that i cannot do thingz with a single job as u said.

But regarding ur answer for renaming i feel that this is not possible if my datastage server and the ftp server that iam accessing are on different system, is'nt that ???

Programmer Analyst,
Cognizant,
Chennai.

Posted: Wed Jan 08, 2003 10:35 pm
by sankar18
Hi,

you ca pass parameter value to ExecDos routine, place the batch file in the ftp system or server system, you pass the batch filename with the path as the parameter value to the ExecDos routine. you can try this. I hope it will do.

with regards,
T Sankar

Posted: Wed Jan 08, 2003 10:49 pm
by raviyn
For the second answer what i meant was if u have batch file in which u can have connect to the server through ftp comand
and within that all the commands pertainning to the local server...
I am talking abt .bat files in windows we create to automate generally the ftp's etc...
So through the EXEC DOS option run....
I think if u connect using FTP mode u can give the rename command forgotten the command u can check it out...
Or check out the rsh command also

Posted: Wed Jan 08, 2003 11:54 pm
by ray.wurlod
Within FTP you can use MPUT to send, or MGET to retrieve, multiple files based on a regular expression. Use PROMPT to disable FTP prompting for each name resolved via a wildcard.
You can also supply a list of file names (even on stdin) for FTP to process.
Check out the man page for the ftp command on your server. Or, if on a Windows platform, get into ftp in a DOS shell then use the help subcommand. Here you will learn about RENAME and the other subcommands referred to by earlier posters.

Posted: Thu Jan 09, 2003 12:44 am
by asnagaraj
Many thanx for ur suggestions guys. :)

Naga.

Programmer Analyst,
Cognizant,
Chennai.

Posted: Tue Oct 21, 2003 8:16 am
by DaleK
How do you use the mget command in the FTP stage? I need to ftp some data files from an unix box. The number of files will vary each day, but they are named the same with a ".##' appended i.e. datafile.01, datafile02...
Due to restrictions on the user id I use to FTP, I can not do a telnet command. Otherwise I would do a "cat datafile.* > bigdatafile" and FTP over bigdatafile. Looking for a solution that will still use the FTP stage and be straight forward for our operations team to support and troubleshoot.
I would like to use the Mget command, but not sure how to use with the FTP stage.

Appreciate any help or advice you have.
Thanks

Posted: Tue Oct 21, 2003 8:23 am
by Amos.Rosmarin
Use the 'telnet after command ' and a rename ( mv x1 x2 ) command

HTH