Having written an "automated" FTP command for the AS/400 in 1996, I read Tim Granatir's recent FTP tip with considerable interest. While the approach taken in Tim's tip was similar to mine -- and numerous others -- it doesn't address two of the biggest shortcomings of FTP on the iSeries. For one, the ability to dynamically generate a JOBLOG from each/every FTP client session. More than that, how can you immediately terminate an FTP session when a recognizable error condition occurs? The answer: a trigger.
As FTP writes its standard output (STDIO) to file OUTPUT, it is entirely possible to attach a database trigger to OUTPUT, where by, the triggered program "receives" the contents of the record being added to OUTPUT. The triggered program can then interpret the record for recognizable FTP error conditions. As the triggered program executes in the same program/invocation stack as the FTP process, the triggered program, upon identifying a valid FTP error condition, can issue a CPC2402 *ESCAPE message. This terminates the FTP client session immediately.
The attached .ZIP file contains my "twist" on automating FTP on the iSeries. While very similar to Tim's, I provide for immediate termination of FTP client sessions and the "echoing" of
To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

FTP Client subcommands and responses to the jobs JOBLOG. The following summarizes the components in the .ZIP file:
STRFTP -- Command line interface.
STRFTPCL -- STRFTP command processing program; creates required files in QTEMP, adds trigger and performs other trivial, yet essential tasks.
WRTSRCDTA -- Like Tim's FTP15R, it writes entry for each FTP command supplied to STRFTP.
FTPERRORS -- Triggered program; like Tim's FTP200c, it processes each STDIO record written monitoring for specific FTP errors; also uses OS/400 API's to "echo" FTP commands/responses to JOBLOG.
FTPERRORS2 -- Similar to FTPERRORS, performs second pass through STDIO output file to handle use of SYSCMD, SYSC and "!" subcommands. As this was written in 1996, I can't remember why but I think it had/has something to do with the lack of uniform standards of functions across FTP implementations.
APIERRORS -- DDS defining OS/400's API error Data Structure. Currently implemented as External DS, but not required. It's simply a matter of personal preference.
Download the file.
==================================
MORE INFORMATION
==================================