A new FTP_SCRIPT activity for LANSA Composer version 2.0

Date:27th April 2009
Product/Release:LANSA Composer V2.0
Abstract:A new FTP_SCRIPT activity for LANSA Composer version 2.0.
Submitted By:LANSA Technical Support

Hotfix 003 for LANSA Composer version 2.0 provides a new FTP_SCRIPT activity.

This activity is supported only on IBM i servers. It provides support for performing FTP operations on i5/OS using the native i5/OS FTP client rather than the LANSA Integrator FTPService. In particular, this is useful for transferring IBM i5/OS save files (*FILE objects with SAVF attribute) between IBM i systems.

Please see the notes for the new activity (included below) for more information.

The hotfix is available on request from LANSA Support.


This activity will execute a script of FTP subcommands. It is supported only on IBM i servers.

The FTP script may contain substitution variables that are replaced at run-time by the values of Processing Sequence variables. See below for details on this feature.

Other supplied FTP activities (including FTP_INBOUND, FTP_OUTBOUND and FTP_COMMANDLIST) use the LANSA Integrator FTPService in their implementation. However, in some cases it is desirable or necessary to take advantage of IBM i QSYS.LIB file system object support that is provided by the native IBM i5/OS FTP client but NOT available through the LANSA Integrator FTPService. This activity is provided for such cases. For example, this activity can be used for transferring IBM i5/OS save files (*FILE objects with SAVF attribute) between IBM i systems.


  1. The script is executed using the native IBM i5/OS FTP client.

  2. The FTP script will run to completion irrespective of any errors that may occur during its execution. If errors occur in the FTP operations, the activity does not end in error - see the description of the output parameter FTPERRORCOUNT for more information.

  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 i5/OS FTP client, including PUT/MPUT, GET/MGET or both.

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:

  • your script can consist of any valid FTP subcommands supported by the FTP client software

  • each FTP subcommand should be on a separate line or in a separate list entry

  • lines or list entries beginning with '*' are ignored and may contain comments

  • if you have specified an FTP configuration and the 'Remote Host' is not *NONE, then the activity will insert the remote user id and password from the FTP configuration in the first line of the script. In this case, there is no need to specify the credentials inside your script unless the remote FTP server requires additional account information or unless your script closes the connection and you subsequently wish to open another connection.

Refer to the documentation for the FTP client software for information on the FTP subcommands supported. On System 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.

You can specify a substitution variable in the following form:


where <variable-name> is the name by which the variable is known in the Processing Sequence variable pool. See the example FTP script below for an example of using substitution variables in an FTP script.

If you specify substitution variables in your FTP script, it is your responsibility to ensure that the variables named exist and have valid values assigned to them in the Processing Sequence that uses the script. The variables values may be set by any supported means - for example, they might be received as Processing Sequence parameters, explicitly set with an ASSIGN directive, or set as the result of running some other activity. If the named variables do not exist in the Processing Sequence when the FTP script is executed, this activity will issue a warning but execution will continue (the variable reference is removed from the FTP script).

Note that the following advanced forms of variable references are NOT supported by this feature:

  1. Compound or qualified variables - for example: *tradingpartner.xxx

  2. Indexed variables - for example: mylist(3)

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