FTP through Developer - Assistance needed

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

Hi John,

The above scenario is all doable.
The WmPublic package contains the main set of FTP commands that you could possible want to use.

  • append
  • cd
  • cdls
  • delete
  • dir
  • get
  • login
  • logout
  • ls
  • mdelete
  • mget
  • mput
  • put
  • quote
  • rename
    sessioninfo
    There is a parent service in this package that actually raps a subset of the above set in a multipurpose utility that perform a login - ls, get/put and then logs outs - but for the scenario that you have describe you may want to build your own.

In step (4) this is a little tricky and there are a couple of approaches. If you talking about only handling “text” files then you could download the source files onto the Integration Server host and then use a command line Java service (sample package is available on Advantage using RuntimeExec) to copy the files into one file - e.g. Cmd /c: copy *.txt output.txt

Once you transfer the file to the target FTP host, the service normal returns a completion code, you would evaluate this code (which I can’t remember now what the value is) to verify that the transfer occurred without error.

A description of the built in FTP service can be found in the …\Developer\doc\IntegrationServerBISReference.pdf document (or also available on Advantage Bookshelf).

Regards Nino…

One additional method for option 4… the PSUtilities package has a writeToFile service. This service allows you to send an “Append” flag, so if you mget the file data you could loop over the data and append it to a single file on disk. That would save you writing out multiple files to disk and also avoid running the system commands to concat the files.

James…

Hi John,

Can you please tell me if I access a file from FTP server from command prompt, will it be there in IS? If it is there then how can I get it into developer?