FTP_INBOUND

LANSA Composer

FTP_INBOUND

This Activity retrieves a list of files from a remote host using FTP. It connects to the remote FTP host and retrieves files from a directory on the remote host. The files are placed in a local directory. Details of the remote host and directories is taken from an FTP Configuration. A list of the files retrieved is output. The list is output in two formats - one containing just the file names, the other containing the full local path and file name.

Activities that populate list variables are often followed by a LOOP processing sequence directive or other constructs to process the contents of the list.  Refer to Variables and Lists for more information about the use of list variables.

An email Event notification named FTPINFAILED is available in this Activity. If this event is active and a failure occurs in this Activity, then an email will be sent. Refer to Event Maintenance for setting up Event notifications.

INPUT Parameters:

FTPCONFIG : Required

This parameter should contain the name of an FTP Configuration with type of Inbound. This Configuration can be created and maintained using the FTP Configuration option in the Navigator.

If this parameter is not provided or is not found, this Activity will return an error and processing will be abandoned.

REMOTEDIRECTORY : Optional

If it contains a non-blank value it will be used as the directory on the remote host from which files are retrieved. If this parameter is not provided, then the remote host directory from the FTP Configuration will be used.

LOCALDIRECTORY - Optional

If it contains a non-blank value it will be used as the local directory into which the retrieved files are placed. If this parameter is not provided, then the local directory from the FTP Configuration will be used.

GETLIKE – Optional

This parameter may specify a pattern to identify the files to be retrieved from the remote host.For example:  (1) the pattern '*.ord' will retrieve files with a file extension of 'ord', (2) 'ord*' will retrieve files whose names start with the characters 'ord', irrespective of the file extension.

If specified, the value of this parameter overrides the specifications in the FTP inbound configuration for Get like pattern.  If this parameter is not specified, the values in the FTP inbound configuration for Get selection and Get like pattern will apply.

OUTPUT Parameters:

FILELIST

Specifies the name of a list variable that will contain a list of files retrieved from the remote host. The list will contain only the file name.
For example:   order5.csv

FILEPATH

Specifies the name of a list variable that will contain a list of files retrieved from the remote host. The list will contain the full path and file name.
For example:   /inftp/order5.csv

This list may be used as an alternative to the FILELIST

Processing

This Activity uses either the LANSA Integrator FTPService or SFTPService (depending on FTP configuration choices).

It uses the Connection information from the FTP Configuration to connect to the remote host.

It changes directory on the remote host to the directory specified either in the input parameter or the FTP Configuration. It lists the files in that directory. If the FTP Configuration contains a Get files like pattern or the GETLIKE parameter has been specified, then only files which match that pattern are listed. FTP mode is changed to Binary if required. Processing then cycles through the list of files to GET each from the remote directory to the local directory. If required it deletes from the remote directory each file successfully transferred. The FTP session is terminated by a QUIT command.

The output lists will contain each file retrieved.

Any failure encountered when executing, will attempt to invoke the email Notification event, FTPINFAILED. If this event is active then an email will be sent to the specified email address with a notification of the failure.