This section lists the FTP commands sent to the FTP server when the statement is executed (for a local host, no commands are sent). Some statements do not generate FTP commands. For such statements, the section is not present.
A parameter can have the following elements:
Append local file to file on FTP server.
APPEND localfile TO remotefile
;localfile
to a remote file remotefile
. If the file remotefile does not exist, it is created. The file localfile is not changed nor deleted. localfile
parameter must be an absolute path. The format of the path is system dependent. remotefile
parameter can be an absolute or relative path. The format of the path is system dependent. PORT <sp> host-port <crlf>
APPE <sp> remotefile <crlf>
# Activator installed on a Unix machine. # Remote host is a Windows machine. APPEND "/nfs/home/chpy/data/file.dat" TO "remotedir\\files.dat"; |
Change the current directory on the FTP server.
CD
remotedirectory;CD
statement changes the current directory on the FTP server. The remotedirectory
parameter can be an absolute or relative path. The format of the path is system dependent. CWD <sp> directory <crlf>
# Remote host is a Unix machine. CD "/tmp"; |
Log a partial FTP session in the message log.
DEBUG;
DEBUG
statement is executed during execution of a script, Debug is turned on. By default, Debug is turned off. A receive script normally receives one or more messages. A send script normally sends a single message. Activator logs a session record in the message log under the following conditions.
Condition |
Session record contains |
Send or receive script terminates (with errors) with Debug on or off. |
The entire FTP session. |
Send script completes (no errors) with Debug on. |
The entire FTP session. |
Receive script completes (no errors) with Debug on. |
The entire FTP session up to the command that received the given message. If the FTP session continued, which is the normal case, the last line in the session record consists of three periods (...). Statements (and the generated FTP commands) executed after the last statement that receives a message are not contained in any session record. |
Delete a file on the FTP server.
DELETE
filename;DELETE
statement deletes the file filename on the FTP server. The filename parameter can be an absolute or relative path. The format of the path is system dependent. DELE
<sp> filename <crlf>
# Remote host is a Windows machine. DELETE "ftpdata\\file.dat"; |
Copy a file from the FTP server without processing by an activity.
GET remotefile
TO
localfile
;
GET
statement copies the remote file remotefile
to the local file localfile
. If the file localfile exists, it is overwritten. remotefile
parameter can be an absolute or relative path. The format of the path is system dependent. localfile
parameter must be an absolute path. The format of the path is system dependent. RECV
statement is that a file copied using the GET
statement is not processed by the activity of which the method that contains the script is part. PORT <sp> host-port <crlf>
RETR <sp> remotefile <crlf>
# Remote host is a Windows machine. # Activator is installed on a Unix machine. GET "C:\\ftp\\out\\file.dat" TO "/nfs/home/chpy/files.dat"; |
Conditional execution.
IF (expression) { statements } [ELSE { statements } ]
IF ELSE
statement performs conditional execution of statements. The expression parameter is one of the following.
Expression |
The expression is true if variable |
variable = value |
Is equal to value. |
variable <> value |
Is different from value. |
variable < value |
Is less than value. |
variable <= value |
Is less than or equal to value. |
variable > value |
Is greater than value. |
variable >= value |
Is greater than or equal to value. |
variable IN list |
Matches an exact value or is within a range of values in list. |
variable NOT IN list |
Is not in list. |
|
Read the contents of a directory on the FTP server.
LIST remotedirectory INTO variable { statements }
LIST
statement reads the contents of a directory on the FTP server. If the variable does not exist, it is created. For each entry found, variable is set to the file name, and the statements block is executed. remotedirectory
parameter can be an absolute or relative path. The format of the path is system dependent. remotedirectory
parameter. TYPE <sp> A <crlf>
PORT <sp> host-port <crlf>
NLST <sp> directory <crlf>
TYPE <sp> original_type <crlf>
|
|
Execute a command at the local site.
! command;
Command
statement executes a command at the local site. The command, enclosed as a string, is preceded by a ! character. The result of the command is available in the %EXEC reserved variable. If the result is nonzero, the script terminates, unless the statement is preceded by the “-” qualifier. The command is executed using the sh shell on UNIX and the command shell on Windows.
!"echo START >> result.dat"; |
|
! "r4edi filecopy.x4 pathname1 pathname2"; |
Create a directory on the FTP server.
MKDIR remotedirectory
;MKDIR
statement creates a directory on the FTP server. remotedirectory
parameter can be an absolute or relative path. The format of the path is system dependent. MKD <sp> directory <crlf>
MKDIR "files"; |
Copy a local file to the FTP server.
PUT localfile TO remotefile;
localfile
to the remote file remotefile
. If the file remotefile exists, it is by default overwritten. The file localfile is not changed or deleted. localfile
parameter must be an absolute path. The format of the path is system dependent. remotefile
parameter can be an absolute or relative path. The format of the path is system dependent. PORT <sp> host-port <crlf>
STOR <sp> remotefile <crlf>
PORT <sp> host-port <crlf>
STOU <sp> remotefile <crlf>
|
Stop the script.
QUIT;
QUIT
statement stops the execution of the script without error. Send an FTP command.
QUOTE "command";
QUOTE
statement sends an FTP command to the FTP server. Normally, you would only send a command that is not supported by the script language. The command
parameter is an FTP command. command <crlf>
|
Receive a file from the FTP server.
RECV remotefile;
RECV
statement receives a file remotefile
from the FTP server. remotefile
parameter can be an absolute or relative path. The format of the path is system dependent. PORT <sp> host-port <crlf>
ETR <sp> remotefile <crlf>
|
Rename a file on the FTP server.
RENAME file TO newfile;
RENAME
statement renames a file on the FTP server. If the source and target directories are different, the file is moved to the target directory and then renamed. newfile
parameter can be an absolute or relative path. The format of the path is system dependent. RENAME
statement is often used in conjunction with the SEND
or PUT
statements to make sure that a file is not accessed until the transfer is complete. RNFR <sp> file <crlf>
RNTO <sp> newfile <crlf>
|
Remove a directory on the FTP server.
RMD <sp> directory <crlf>
|
Send a file to the FTP server.
SEND remotefile [APPEND];
SEND
statement then sends a file containing this message to the FTP server. If the APPEND
keyword is specified and the file remotefile
exists, the file is appended to the file remotefile
. If the APPEND
keyword is not specified and the file remotefile exists, by default, the file overwrites the file remotefile
. remotefile
parameter can be an absolute or relative path. The format of the path is system dependent. PORT <sp> host-port <crlf>
STOR <sp> file <crlf>
PORT <sp> host-port <crlf>
STOU <sp> remotefile <crlf>
PORT <sp> host-port <crlf>
APPE <sp> remotefile <crlf>
|
Toggle the value of the store-unique setting.
SUNIQUE;
SUNIQUE
statement toggles the value of the store-unique setting. It is useful for file transfers using the PUT
or SEND
statements: RENAME
statement may fail when used with the SEND
or PUT
statements. off
.
|
Set the representation type for data transfers.
TYPE type;
TYPE
statement sets the representation type for data transfers. The type parameter takes one of the following values.
Value |
Description |
"I" |
Binary files |
"A" |
ASCII files |
"E" |
EBCDIC files. The representation type used corresponds to Code page 500 (International Latin 1), which is the code page used on the AS/400 platform. |
TYPE <sp> type <crlf>
|
Loop control.
TYPE "I"; %Break = ""; # Every time we find files check the directory one more time. WHILE (%Break = "") { %Break = "BREAK"; -LIST "." INTO %F { -RECV %F; IF (%FTPSTATUS IN "200"-"299") { -DELETE %F; } %Break = ""; } } |