LIST

LANSA Integrator

LIST

The LIST command gets a list of file names from the remote FTP server.

 

 LIST ---- PATH ---------- directory path -------------------->

 

       >-- FORMAT -------- *AUTO ----------------------------->

                           *NAME

                           *UNIX

                           *UNIX8

                           *UNIX9

                           *ISERIES

                           *WINDOWS

 

       >-- DATEFORMAT ---- *NONE ----------------------------->

                           *DMY

                           *MDY

                           *YMD

                           *YDM

 

       >-- DATALINK ------ *PASV -----------------------------|

                           *PORT

 

Keywords

PATH

If no PATH keyword is present, the current directory is used. The path can contain operating system wild characters.

FORMAT

The default value *AUTO uses auto-detect list format:

  • *AUTO - Auto-detect LIST format.
  • *NAME - Uses NLST subcommand. 1 column.
  • *UNIX -List is in UNIX format. 9 columns.
  • *UNIX8 - List is in UNIX format. 8 columns.
  • *UNIX9 - List is in UNIX format. 9 columns.
  • *ISERIES - List is in IBM i format.
  • *WINDOWS - List is in Windows format.

When using FTP between IBM i servers it is important to note the FTP attributes LISTFMT value (use CHGFTPA). For example, if the FTP Attributes has LISTFMT(*UNIX) then using LIST PATH(/TMP/*.*) FORMAT(*ISERIES) will not return any data. Changing to FORMAT(*UNIX) or using the SITE COMMAND(LISTFMT 0) will return data.

DATEFORMAT

The default value *NONE means that no formatting is applied to the date field. Dates are formatted to ISO8601 format.

  • *NONE - No date formatting.
  • *DMY - Except the date to be in day, month, year order.
  • *MDY - Except the date to be in month, day, year order.
  • *YMD - Except the date to be in year, month, day order.
  • *YDM - Except the date to be in year, day, month order.

 

DATALINK

The DATALINK keyword determines how the "control" session is initiated. The default value is *PASV.

In passive mode, *PASV, the FTP the client initiates both connections to the server. Passive mode causes the FTPService to send a PASV subcommand to the remote FTP server, the FTP server returns the port number of the socket server it has started and a data transfer channel is established from the local server using this port number. This is known as "Passive FTP" and is often used to get around firewall difficulties. Using "Passive" FTP, the local server establishes the second connection, not the remote FTP server. Most firewalls will allow your computer to transfer files in this second connection to the remote FTP server (just as it allowed your computer to establish the first connection).

Port mode, *PORT, causes the FTPService to start a socket server and informs the remote FTP server via the PORT subcommand of the port number this socket server is listening on, the remote FTP server then connects to this socket server and a data transfer channel is established.

Refer to Technical Specifications for more information.

Comments / Warnings

RDML Clients require the list definition to be passed using the SERVICE_LIST keyword. The list object argument requires one, two or five fields.

If a one field list is being used, then the unprocessed lines are added to the list.

If a two field list is being used, the first field receives the file type and second field receives the file name.

If a five field list is being used, the first field receives the file type , the second field receives the date, the third field receive the time, the fourth field receives the size and fifth field receives the file name.

The type field can contain the following values:

  • F - File
  • D - Directory
  • L - Link

Examples

RDML

 

DEFINE FIELD(#TYPE) TYPE(*CHAR) LENGTH(1)

DEFINE FIELD(#FILE) TYPE(*CHAR) LENGTH(80)

DEF_LIST NAME(#WRKLST) FIELDS((#TYPE) (#FILE)) TYPE(*WORKING) ENTRYS(100)

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('LIST SERVICE_LIST(TYPE,FILE)') TO_GET(#JSMSTS #JSMMSG #WRKLST)

 

RDMLX

 

use builtin(jsmx_command) with_args(#jsmxhdle1 'list path(/tmp/*.*) format(*unix)') to_get(#jsmxsts #jsmxmsg #worklist)