5.6.10 PUT

The PUT command is used to copy a local file to the remote FTP server.

Syntax:

Command

Keyword

Value

Developer notes

PUT

FROM

value

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

TO

value

Required. Remote file path.
This value can be a relative or absolute path. If the path is relative, the current working directory is the remote FTP server's current directory.

FROM_ENCODING

encoding

Encoding is used to convert the FROM file content to an intermediate Unicode string.
A default value is obtained from the from.encoding property resource. If no property resource is located the value defaults to Cp037.
Only use this keyword when CONVERT is set as *YES.

TO_ENCODING

encoding

Encoding is used to convert the intermediate Unicode string to target encoding.
A default value is obtained from the to.encoding property resource. If no property resource is located the value defaults to ISO8859_1.
Only use this keyword when CONVERT is set as *YES.

CONVERT

*NO

Default is No conversion.

*YES

Indicates that after each record size read, the data will be converted to the specified target encoding and sent to the FTP server.

RECORD_SIZE

integer

An integer value specifies the read size, in bytes, to be used on the source file.
The default value is 1024 bytes.
Refer to Comments / Warnings below.

*NOMAX

This value sets the read size to the length of the source file.

RECORD_DELIMITER

*LF

Add LF to the end of each converted record.

*CRLF

Add CRLF to the end of each converted record.

*NONE

Default. No record delimiter.

DATALINK

*PASV

Default. Use passive mode.

*PORT

Use port mode.

 

Example

PUT FROM(/folder/file.pdf) TO(/folder/file.pdf)

 

PUT FROM(/QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MYFILE.MBR) TO(file.txt) CONVERT(*YES) RECORD_SIZE(423) RECORD_DELIMITER(*CRLF) FROM_ENCODING(Cp037) TO_ENCODING(Cp1252)

 

Comments / Warnings

If the FROM file is an IBM i physical file:

Normal stream files can also be converted: