Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

3.  Because the FTP functions performed by this activity are determined by the user-provided FTP script, it does not inherently have any "inbound" or "outbound" sense.  The script can perform any combination of FTP subcommands supported by the i FTP client, including PUT/MPUT, GET/MGET or both.

INPUT Parameters:

FTPCONFIG: Optional

This parameter can contain the name of an FTP configuration.  If specified, it is suggested that you use an FTP configuration of type 'Command List', although you can also specify an Inbound or Outbound configuration.  This activity will, at most, use the following attributes of the FTP configuration:

...

Similarly, if the FTP configuration is not specified, then your script must contain the FTP subcommands (such as 'open') necessary to establish the required connection along with the necessary credentials.  In this case, you must provide the remote host, port (if necessary) and credentials through the FTP subcommands in the script.

FTPSCRIPTFILE: Optional

This parameter is optional, but if it is not provided, then you must provide the FTP subcommand script either through the FTPSCRIPTLIST parameter or in the 'Command list file' field of the FTP configuration.  If this parameter is provided, then it must specify the full path to a text file that contains the FTP subcommand script to be executed.  See FTP Subcommand Script below for more information.

FTPSCRIPTLIST: Optional

This parameter is optional, but if it is not provided, then you must provide the FTP subcommand script either through the FTPSCRIPTFILE parameter or in the 'Command list file' field of the FTP configuration.  If this parameter is provided, then it must contain a list of the FTP subcommands to be executed.  See FTP Subcommand Script below for more information.

OUTPUT Parameters:

FTPOUTPUT:

Upon completion, this parameter will contain a variable list of FTP log output lines generated by running the FTP script.  (The FTP log results are also available in the Processing Sequence log, depending on the logging level.)

If you wish to process the FTP log output lines in your Processing Sequence, then you could do so using, for example, a LOOP processing sequence directive.  Refer to Variables and Lists for more information about the use of list variables.

FTPERRORCOUNT:

Upon completion, this parameter will contain a count of the lines in the FTP log that the activity interprets as representing errors.  This is defined as lines that begin with an FTP response code in the range 400-499 and 500-599.

...

For all these reasons, the activity does NOT return an error status if the apparent error count is greater than zero. It is up to you to test the output parameters to determine the success of the operation and to handle error conditions in your Processing Sequence.

FTP Subcommand Script

Whether you specify your FTP script through the FTP configuration, or through the FTPSCRIPTFILE or FTPSCRIPTLIST parameters, you should compose your script according to the following guidelines:

...

Refer to the documentation for the FTP client software for information on the FTP subcommands supported.  On IBM i servers, you can start the FTP client by typing the command FTP RMTSYS(*NONE) at a command line.  When the FTP client has started type the command HELP and press Enter to access on-line help about the supported FTP subcommands.

Substituting Processing Sequence Variables in the FTP Subcommand script

The activity supports substitution variables in the FTP script.  When found, they will be replaced by the value of the named variable in the Processing Sequence variable pool.

...

Typically you could circumvent these limitations, if necessary, by assigning the desired compound or indexed variables to a simple variable name before executing the script.

Example FTP Subcommand Script

The following script might be used with a correctly configured FTP configuration to copy the contents of a source library on the source IBM i system to a target library on the target IBM i system.  The processing sequence must set the value of the processing sequence variables SOURCELIB and TARGETLIB in order to specify the respective library names.  The FTP configuration used must specify the remote host name and the remote user and password used to connect to the remote host.

************************************

* This is a sample FTP script

************************************

BINARY

NAMEFMT 1

SENDEPSV 0

CWD  /QSYS.LIB/%%var.TARGETLIB%%.LIB/

MPUT /QSYS.LIB/%%var.SOURCELIB%%.LIB/

CLOSE

QUIT

************************************