Urgent Regarding 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
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

Urgent Regarding FTP stage

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

Post 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
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

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

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

Post 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.
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

Post 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.
raviyn
Participant
Posts: 57
Joined: Mon Dec 16, 2002 6:03 am

Post 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...
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

Post 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.
sankar18
Participant
Posts: 34
Joined: Mon Dec 16, 2002 1:18 am

Post 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
raviyn
Participant
Posts: 57
Joined: Mon Dec 16, 2002 6:03 am

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

Post 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.
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

Post by asnagaraj »

Many thanx for ur suggestions guys. :)

Naga.

Programmer Analyst,
Cognizant,
Chennai.
DaleK
Premium Member
Premium Member
Posts: 68
Joined: Fri Jun 27, 2003 8:33 am
Location: Orlando

Post 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
Amos.Rosmarin
Premium Member
Premium Member
Posts: 385
Joined: Tue Oct 07, 2003 4:55 am

Post by Amos.Rosmarin »

Use the 'telnet after command ' and a rename ( mv x1 x2 ) command

HTH
Post Reply