FTP help neededmultiple fileshow group together

We’re using Developer version 6.1

My requirement is as follows 1) I need to connect to an external ftp server. 2) download the file 3) run a mget to grab all the files that have a .txt extension 4) if multiple files, concatenate them together into one file 5) send the file to another ftp server, utilizing a put 6) upon successful completion, rename the original .txt file to a .snt extension (on the server that I originally grabbed the file from)

I’m having three issues that I wanted to ask about:

(1)Step # 4 mentioned above
(2)How to ensure in # 6 that the ftp session completed successfully - what do I evaluate to determine that? If there’s docs on that, please let me know.
(3) Does the above FTP scenario make sense?

Thanks for any help that you can provide. In addition, if any extra advice could be given concerning the above scenario, please let me know.
John

John,
Will you be downloading the files on your wM server OR you want these 2 FTP process to be connected (in which case u don’t need to download the file) ???

#4 - When you do mget, you can check the dirlist. If dirlist has multiple files, you can loop over dirlist and concatenate the files.
#6 - Check the FTP return code as 200 for success.

You need to make sure that if the 2 FTP process are connected, than try to drop the variables used in FTP services as soon as you can. Else it will be very chaotic in your flow.

You can rename the file on the host server once your file transfer on the destination server is successful. Don’t forget to explicitely logout from each session as soon as you are done.

Hope this helps.
RS

I am grabbing files from an external server and then I will immediately place those files onto another server. I will not be storing the files anywhere on IS. Not sure what is meant by “2 FTP processes are connected”?

As for the concatenation, is the below what I would do:

pub.client.ftp:mget (Change the filenamepattern to ZPT_*.txt)
LOOP over /dirlist
pub.string:concat (would I link filenames (pipeline in) to inString1 of the concat? What would be linked to inString2?)

Thanks and if there’s any other tips on this that you can provide, it will be greatly appreciated.

Basically your process involves “FTP get” from server-1 and then “FTP put” on Server-2. Since you are not storing the files on the local server, the above 2 FTP process can be seen as connected process.

You can implement this as below:
Login to Server-1
cd (if required)
mget (returns list of files)
LOOP over /dirlist
get (get the file from server)
byteToString
Cocatnate
End of LOOP
Logout from Server-1
Login to Server-2
cd (if required)
put (put the concatenated file)
logout from Server-2

Hope this helps.
RS