EXTOL Integrator as FTP Server

EXTOL Integrator as FTP Server

FTP Server :: Background

Another mode to be considered is that of the EXTOL system acting as the server, where the outside party (whether a VAN or private trading partner) specifies the purposes of the conversation. While this mode is possible to a limited extent using the other communications methods, the built-in operating system support for a full FTP server implementation makes it much more practical for the EXTOL system to act as a network server using TCP/IP than when using the other methods. In other words, it is possible to use the OS/400 FTP server function as front-end “network software” to the EXTOL system, providing such features as individual mailbox management, store-and-forward capabilities, etc.

FTP Server :: Set-up

The remote user connects to the AS/400 FTP server program using a pre-arranged user profile and password. A special profile may be created for this purpose and it may be granted whatever authority is desired. The current library (CURLIB) defined on the profile becomes the initial FTP directory. If the profile is created with Initial program INLPGM(*NONE) and Initial menu INLMNU( *SIGNOFF), it will not be possible to use the profile interactively, either through direct attach terminals, display station passthrough, or TELNET.

The remote user will in general use the FTP PUT command (synonym STORE) to send one or more files to the AS/400. They may also use the FTP GET command (synonym RETRIEVE) to receive one or more files from the AS/400. The user profile with which the remote user signs on must have the appropriate authorities to the files and directories or libraries; otherwise, the FTP server will return an error.

As indicated above under “OS/400 Prerequisites”, the available mechanisms for triggering incoming processing vary depending on the OS/400 release.

FTP Server :: Remote command

The basic method available in all cases is to have the remote system “PUT” one or more files into a pre-arranged directory or library on the AS/400, and then execute a “QUOTE RCMD xxxxxxxx”, where xxxxxxxx is any OS/400 command (or EXTOL command or user command, etc.), entered as a string with any parameters just as if it were entered on an AS/400 command line.

The “remote command” will be executed by the AS/400 in one of the FTP server jobs (job name QTFTPnnnnn under user QTCP in subsystem QSYSWRK). Since these are batch jobs, any commands will be executed in batch mode (e.g., a DSPLIB command will always produce printed output) and interactive-only commands (e.g., EDTLIBL) will return an error. Otherwise, the remote user may perform any command to which its profile is authorized (even though the server job is running under profile QTCP, the authority checked is that of the logged-in user profile).

In order to provide local control of the command parameters, the simplest method is to create a command which exposes only those parameters appropriate to be controlled by the remote user. An example (“INSCRIPT”) is shipped with source code. The example as shipped has only one parameter - the filename created by the remote user. It contains only one command (CRTCNNIMP) and some error-handling code. The typical usage would be that the remote user sends file “my_file_name” to a pre-arranged directory using the PUT command, and then issues “QUOTE RCMD INSCRIPT FILE(‘my_file_name’)”. The FTP server will return either a completion message or an error message to the remote user, depending upon whether INSCRIPT returns an escape message to indicate an error (if it does, the FTP server will return the message ID as part of it’s response). At this point, the remote user may issue a QUIT command.

Automatic process triggered by FTP exit point:

At V3R2M0 or V3R7M0 or above, an FTP exit point may be registered which may call any appropriate user-written program on the execution of any FTP command. The typical usage here would be for the exit program to record file names on any PUT commands, and then execute the CRTCNNIMP command when the remote user issues the QUIT command. The remote user in this case does not have to do anything other than log in and PUT data files.

For details on the FTP exit points, see “TCP/IP Configuration and Reference”, SC41-3420-02.

Set-up Details

The following steps will enable TCP/IP processing through FTP in the EXTOL system:

  • Create a user profile for the remote user to sign on with. (See the discussion above).
  • Under the existing network *FILE, create Network Ports for each incoming intermediate file. Normally, the only reason to have more than one would be if the remote systems from which the files are being received require more than one format (e.g., wrapped vs. Non-wrapped). The usual options are available for network *FILE (record length, create file, add member, add/replace records).
  • Under the existing network *FILE, create control scripts to process the incoming intermediate files using CRTCNNIMP. If no special processing (e.g., CPYFRMSTMF = Copy from stream file) is required, these may not be necessary. The example shipped script “RECEIVE” includes a CPYFRMSTMF command.
  • Use the shipped example INSCRIPT or create your own command to suit. Inform the remote user to execute the appropriate QUOTE RCMD command after sending a file.
  • The options on the CRTCNNIMP command inside the INSCRIPT command program control the processing of the incoming data. Translation may be triggered immediately, submitted to batch, or not run at all if desired.





By: on
EXTOL Business Partner Logo

More EXTOL Examples

We have over 300+ examples of how EXTOL can be customized to meet your organization's needs

Each of our exmaples are free to review and use.