SeanHoppe.com › CLEO Examples › EXTOL Integrator as FTP Client
EXTOL Integrator as FTP Client
The OS/400 FTP client is actually designed as an interactive client program for which the keyboard input and screen output may optionally be re-directed to files for batch processing. A new command (BATCHFTP) has been added to the EXTOL system to facilitate this. While this approach is in general equivalent to the usual client-mode communications process, it does have the limitation that individual FTP command responses cannot be reacted to during the actual FTP session. In other words, no “IF” branches are possible in the script. If in the future IBM provides a command-at-a-time API to the FTP client (or if another FTP client for the AS/400 becomes available with such an interface), more sophisticated processing will become possible. In the meantime, the present OS/400 implementation requires that the output file be analyzed for any possible error conditions “post-mortem”. As an interim solution, an EXTOL utility command (SCANTXTSRC) has been provided. Using this command, a particular user-specified FTP response message may be scanned for and used to set the connection status as appropriate. Since the actual command responses from an FTP server vary considerably from one server implementation to another, a more FTP-aware utility is being developed which will scan for patterns of commands and responses to provide more intelligent error reporting.
The remote system name (or IP address), user ID, password, etc. are all specified in FTP commands in the control script. The script is processed at run time and passed to the FTP program as an input file; the FTP program produces an output file which is captured and echoed to the message queue for the connection (“M” option on the Work with Connections panel). Since the entire FTP session conversation is visible in the connection message queue, it is not necessary to look anywhere else to resolve FTP connection or transfer problems.
The control script may also contain any number of OS/400 commands to be executed either before or after the FTP process. These may be used (for example) to convert between fixed-record-length files and “stream” files if required by the remote system. Example control scripts are supplied which may be copied and edited to customize them for specific FTP servers.
Set-up Details
The following steps will enable TCP/IP processing through FTP in the EXTOL system:
- Create a user profile for temporary use for FTP batch processing. The shipped example script uses “ftpdummy” with password “ftpdummy”. The profile may be created with INLPGM(*NONE) and INLMNU( *SIGNOFF). This profile is only necessary to get the batch FTP process started on the local machine. (See “TCP/IP Configuration and Reference”, SC41-3420-02 for an explanation).
- Create one or more Networks named “*FTPxxxxxxxxxxx”, where xxxxxxxxxxx are any characters. For ease of command entry when using the network ID as a parameter, it is suggested that embedded spaces be avoided.
- Under these networks, create Network Ports for each outgoing intermediate file. Normally, the only reason to have more than one would be if the remote systems to which the files are being sent require more than one format (e.g., wrapped vs. non-wrapped). The same options are available as under network *FILE (record length, create file, add member, add/replace records).
- Under these networks, create Network Ports for each outgoing intermediate file. Normally, the only reason to have more than one would be if the remote systems to which the files are being sent require more than one format (e.g., wrapped vs. non-wrapped). The same options are available as under network *FILE (record length, create file, add member, add/replace records).
- Under these networks, create control scripts to contain the FTP commands. See the example shipped control scripts for details. The control script writes FTP commands to a QTXTSRC file member and executes FTP in batch with input and output overridden to separate QTXTSRC members.
- On the Trading Partner Details 2 panel for those trading partners to whom you wish to send via FTP, change the Network ID, Network Port, and Default Send Control Script to the appropriate values. As usual, these values may be overridden at a document level by using the corresponding entries on the Trading Partner Message Class details 2 panel.
- Use the normal sending processes in the EXTOL system: the NETSND parameter on the various outgoing processing commands (CRTAPPDTAB etc.), or the Start outgoing connections panel (Mailroom menu #12). The connection status will be updated appropriately to Sent or Send Error; the FTP server session history is visible using the “M=Messages” option on the Work with Connections panel.
By: Sean Hoppe on