The READ command processes the nominated FILE and returns the information in a working list (unless the SVTABLE keyword is used).

To read a file from the local file system only requires the FILE keyword.

To read a file from a remote file system using the FTP protocol requires the HOST keyword with appropriate USER, PASSWORD and access details for the remote server.

The service also determines the encoding to apply to the read byte content to convert it to Unicode content and determines if the Unicode data needs to be archived.




 READ ---------- FILE ----------- file path ---------------------->




             >-- HOST ----------- host:port ---------------------->


             >-- USER ----------- value -------------------------->


             >-- PASSWORD ------- value -------------------------->


             >-- NAMEFMT -------- none --------------------------->




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



             >-- MODE ----------- *BINARY ------------------------>





             >-- CONTENT -------- *CSV --------------------------->




             >-- SEPARATOR ------ value -------------------------->






             >-- ENCODING ------- *DEFAULT ----------------------->



             >-- SVROW ---------- value -------------------------->


             >-- SVROWLIMIT ----- value -------------------------->





             >-- SVMODE --------- *NONE -------------------------->




             >-- SVHEAD --------- value -------------------------->


             >-- SVLABEL -------- value -------------------------->


             >-- SVTABLE -------- table name --------------------->


             >-- SVCOLUMN ------- value -------------------------->


             >-- NUMBERFORMAT --- *NONE -------------------------->






             >-- ARCHIVE -------- file path ----------------------|




Nominate the path and file name.

This value can be a relative or absolute path. If the path is relative, the current working directory is the JSM instance directory.


This keyword is only required when reading from a remote file system.

Nominate a FTP server to connect to. The FTP server can be specified as an IP address, nnn.nnn.nnn.nnn:port, or a domain name.

If a port number is not supplied on an IP address the default value 21 is used unless the keyword SECURE (*IMPLICIT) is used in which case the default port value is 990.


Only required when reading from a remote file system.


Only required when reading from a remote file system.

The password for the database server that corresponds to the USER keyword.


Only valid when reading from a remote file system.

A value of 0 indicates an IBM i path name format library/file.member is to be used.

A value of 1 indicates a Windows path name format /directory/directory/file is to be used.


Only valid when reading from a remote file system.

The possible values are *PASV (Passive) or *PORT (Port). *PASV is the default value.


Only valid when reading from a remote file system.

The default value is *BINARY. Use a value of *ASCII if required.


By default the nominated file is processed as *CSV.

Alternately the content can be processed as a Tab separated variables (*TSV) or separated by a variable (*SV) as specified in the separator keyword. If processing content that includes a separator variable, refer to the SEPARATOR, SVHEAD,  SVMODE, SVTABLE, SVCOLUMN, SVLABEL, NUMBERFORMAT, TRIM and TRUNCATE keywords for additional processing options.

The working list used to store the content must be defined with an appropriate number of columns to store the data.


This keyword is to indicate what character is used as a separator. The separator does not need to be defined if the content is indicated as *CSV or *TSV.

If the SEPARATOR keyword is present and no CONTENT keyword is supplied CONTENT(*SV) is assumed.

Refer to SEPARATOR for more information.


ENCODING is used to specify what encoding must be applied to a byte content to convert it to a Unicode string. The default value for the ENCODING keyword is *DEFAULT.

Refer to ENCODING for more information.


The SVROW keyword is used to specify the starting data record row.

Refer to SVROW for more information,


The SVROWLIMIT keyword is used to specify the number of data records to read. The possible values are *NONE, *LIST, *AVAILABLE or an integer value.

Refer to SVROWLIMIT for more information.


The SVMODE keyword is used by content handlers and services that process separated value data to indicate how to handle the inbound separated value data.

Refer to  SVMODE for more information.


The optional keyword SVHEAD is used to describe the field layout of the separated value data.

Refer to SVHEAD for more information.


If the SVTABLE keyword is present then the separated variable file data is inserted into the specified table using the current database connection. If no value is provided for SVTABLE the file data is returned in the working list argument.

Refer to SVTABLE for more information.


SVCOLUMN is only used in conjunction with the SVTABLE keyword. The SVCOLUMN separates value services to define the relational database columns. A look up on the service properties resource is done using the sv.column.{value}.

Refer to SVCOLUMN for more information.


SVLABEL is only used in conjunction with the SVTABLE keyword. SVLABEL is used to include the keyword value as the first column value for database table inserts or as the where constraint for database table selects.

Refer to SVLABEL for more information.


The optional keyword NUMBERFORMAT is used to handle numeric strings, where the decimal separator is not the decimal point character ".".

Refer to NUMBERFORMAT for more information.


Use the optional keyword ARCHIVE to nominate the path and file name used to archive content.

Refer to ARCHIVE for more information.


















#jsmcmd := 'read file(' + #jsmfile + ') content(*sv) separator(' + #separator + ')'

use builtin(jsmx_command) with_args(#jsmhandle #jsmcmd) to_get(#jsmsts #jsmmsg #valueslst)