FTPSETERROR        Store FTP Result Value for Conditional Branching

Top  Previous  Next

Syntax:

FTPSETERROR

[ msg ]

Arguments:

[ msg ]

Optional variable or string containing the result message of the most recent FTP command performed; the result message is automatically saved in an internal variable %ftplastresult which is used if the [ msg ] argument is omitted.

Options:

None

 

 

 

Each time an FTP command is sent, the FTP site replies with a message in the following format:

 

[nnn] [text]

 

where [nnn] is a numeric value in the range of 100 to 599 and [text] is English description of the result. Robo-FTP recognizes server replies and saves the most recent one in the variable %ftplastresult. The following is an example of an FTP site reply:

 

226 Transfer complete.

 

Numeric values in an FTP server reply fall into one of the following five categories. More information on FTP site replies may be found in Section 4.2 of the RFC0959 FTP specification (refer to HTML document rfc959.htm included with the Robo-FTP package).

 

1nn  Positive Preliminary reply

2nn  Positive Completion reply

3nn  Positive Intermediate reply

4nn  Transient Negative Completion reply

5nn  Permanent Negative Completion reply

 

This script command parses the reply to extract the three digit numeric value such that conditional branching script commands (e.g., IFERROR) can be used to evaluate the result of an FTP command.

 

For example, let’s assume that the FTP reply expected is 226 Transfer complete., the following script command file segment would branch to a label if some other reply was received.

 

SENDFILE "uploadfile"

FTPSETERROR

IFERROR!= 226 goto transfer_failed

 

Use of FTP site replies is not mandatory in Robo-FTP script processing. The previous script file segment could also have been written as:

 

SENDFILE "uploadfile"

IFERROR goto transfer_failed

 

In this case, the normal script error handling is in effect. Use of the FTPSETERROR command allows you to test for specific FTP site replies and gives you lower level control over FTP file transfer sessions.

 

Related Command(s): IFERROR

See also: Using the Robo-FTP Client Applet