I've made a few updates to the popular FTPFILE (formerly FTPSNDFILE) CL command.
You can download it from here. It is a SAVF that needs to be FTP'd up to your system and contains the most current version (updated 10 Feb 2012)
The updates include the following:
NOTE: I'm getting email asking about dropbox which I use to store the FTPFILE download. I previously wrote an article on the subject. Dropbox is a free service and widely used. Check out my article here for more information on Dropbox.
You can use the PUTGET parameter to specify PUTGET(*GET | *PUT). The former version of the command only sent database files. This new version will send (i.e., PUT) and receive (i.e., GET) database files or IFS files.
As mentioned, in addition to traditional CPF/OS/400/i5/i database files, the user may specify LCLFILE(*STMF) and then specify the IFS file to send and or receive using the LCLSTMF and RMTSTMF parameters. As always, full generic capabilities for both DB2 files and IFS files is supported.
The RCMD parameter accepts a CL command that may be run on the remote server after the transfer completes (or fails to complete). Currently this command is always run by adding it to the FTP script that is generated. It is run using the QUOTE RCMD commands in FTP. The parameter supports embedded prompting similar to the CMD parameter of the SBMJOB command.
Previously several diagnostic and completion messages along with ad hoc messages were written to the joblog when running the FTPFILE command. Now, those message are "swallowed". In place of them, more FTP-worthy message are generated including the following:
I use FTPFILE all the time to send or receive save files from other IBM i systems. Now with the new RCMD parameter, I can also restore from that save file immediately after the transfer without the need to sign on. Here's an example:
FTPFILE RMTSYS(MY720) PUTGET(*PUT) LCLFILE(QGPL/MYSAVF) USER(QPGMR) PWD(ROSEBUD) RCMD(RSTLIB SAVLIB(COZTOOLS) DEV(*SAVF) SAVF(QGPL/MYSAVF) MBROPT(*ALL) ALWOBJDIF(*ALL) FRCOBJCVN(*YES *RQD))
In this example, the save file named MYSAVF in QGPL is sent to the remote MY720 system. Then, after the transfer finishes, the RSTLIB command is run to restore the COZTOOLS library onto the remote system.
The FTPFILE command definition and its RPGIV command processing program source code is available on request. Simple post a message/comment in response to this article and I'll send you a note with information on where you can download the code.
And no, if you send me an email asking me for the link or the source code, I will not reply to it.
The FTPRCMD CL command, allows Users to run CL commands on remote IBM i servers without the need for REXEC to be started. Using FTP's rcmd statement, the FTPRCMD runs virtually any "batch" compatible CL command on the remote system. If you don't have REXEC which doesn't run CL until at least v7r1, or you're using some goofy Telnet trick, this new command might simplify things for you.
FTPRCMD is included in the FTPFILE save file/library.