Using Script File Result Codes

Top  Previous  Next

 

Each Robo-FTP script command returns a four-digit numeric result code when it completes to indicate success or failure. When Robo-FTP is used interactively, or if you need to interpret a log file, it is not necessary to know the specific numeric values because Robo-FTP translates all of these values to English phrases in the form of status messages. When writing these messages to the log file, Robo-FTP includes the numeric value in brackets at the end of the message to assist you in building error recovery into your script files.

 

When writing a script file you may want to take advantage of the IFERROR command to test for specific result codes. In this case, use these numeric values, or the corresponding predefined $ERROR_xxx variable (see below ), in the IFERROR command to test for a specific result.

 

Robo-FTP always returns a zero result code if a script command is completed successfully. Therefore a script file checks for a non-zero result code to determine if an operation failed. If you choose to check for specific result codes when a command fails, you have more flexibility in recovering from errors.

 

Robo-FTP defines a set of internal variables referred to as $ERROR constants. $ERROR constants allow you to use descriptive variable names rather than a raw numeric result code value when using the IFERROR command. This results in easier to understand script files.

 

The Robo-FTP $ERROR constants and corresponding numeric result codes are listed below:

 

$ERROR Constant Name

Code

Description

$ERROR_SUCCESS

0

No error occurred

$ERROR_INVALID_CMD_LINE

1001

Invalid Shortcut Target command line

$ERROR_FILE_OPEN_ERROR

1003

Cannot open file

$ERROR_NO_MORE_VARS

1008

Variable value or name too large, or too many variables assigned

$ERROR_VAR_NOT_FOUND

1009

Variable not found

$ERROR_VAR_INVALID

1010

Variable name invalid

$ERROR_NO_WILD_CARDS

1011

File name wildcard characters not allowed

$ERROR_COMMAND_INVALID

1012

Missing, invalid, or unrecognized command

$ERROR_PROMPT_CANCELLED

1013

Cancel button clicked in Prompt dialog

$ERROR_INVALID_FILE_NAME

1014

Invalid file/path name

$ERROR_COPY_CANCELLED

1018

File copy canceled

$ERROR_FILE_NOT_RENAMED

1020

File could not be renamed

$ERROR_FILE_NOT_DELETED

1021

File could not be deleted

$ERROR_FILE_NOT_COPIED

1022

File could not be copied

$ERROR_IS_CONNECTED

1024

Line is already connected

$ERROR_NOT_CONNECTED

1025

Line not connected

$ERROR_NO_MODEM_RESP

1027

Modem not responding

$ERROR_DIALOUT_ERROR

1029

Connect error -- no carrier

$ERROR_CONNECT_TIMEOUT

1030

Connect time-out expired (this may also occur on dial commands)

$ERROR_INVALID_MODEM_CMD

1031

Invalid/Unrecognized modem response

$ERROR_BUSY_SIGNAL

1034

Line is busy

$ERROR_ANSWER_ERROR

1039

Unable to answer

$ERROR_CONN_CANCELLED

1042

Connect canceled

$ERROR_SEND_FILE_ERROR

1046

File read error, canceling transmission

$ERROR_XMT_ERROR

1050

File transmission error

$ERROR_ASCII_SEND_FILE_CANCEL

1051

ASCII send file operation canceled

$ERROR_NO_FILES_FOUND

1053

No files found matching wildcard pattern

$ERROR_SEND_FILE_CANCELLED

1054

Transmission canceled

$ERROR_FILE_NOT_FOUND

1055

File not found

$ERROR_LINE_DROPPED

1057

Line dropped, disconnecting...

$ERROR_FILE_RCV_ERROR

1059

File receive operation failed

$ERROR_NO_RELATIVE_PATHS

1062

Relative paths not allowed in command

$ERROR_WRITE_ERROR

1063

File write error

$ERROR_READ_ERROR

1069

File read error

$ERROR_READ_EOF

1070

End-of-file (EOF) detected on read

$ERROR_AUTO_NAME_FAIL

1074

File auto-naming failed

$ERROR_MALLOC_FAILURE

1076

No buffers available

$ERROR_RCV_FILE_CANCELLED

1077

Receive canceled

$ERROR_FILE_NAME_REQUIRED

1078

Command requires receive file name

$ERROR_PTR_FAILURE

1080

Printing failed

$ERROR_PTR_CANCELLED

1083

Printing canceled

$ERROR_ASCII_RCV_FILE_CANCEL

1087

ASCII receive file operation canceled

$ERROR_CANNOT_RUN_SCRIPT

1088

Cannot run script

$ERROR_LOG_FILE_ERROR

1089

Cannot open script log file

$ERROR_LOG_NOT_OPEN

1092

Script log is file not open

$ERROR_CANNOT_OPEN_SCRIPT

1096

Cannot open script file

$ERROR_SCRIPT_EOF

1097

Past end-of-file on script file

$ERROR_UNKNOWN_COMMAND

1099

Unknown/Undefined script command

$ERROR_INVALID_ARGUMENT

1100

Invalid argument

$ERROR_INVALID_LABEL

1101

Invalid label

$ERROR_LABEL_NOT_FOUND

1102

Label not found

$ERROR_TOO_MANY_LABELS

1103

Maximum number of labels exceeded

$ERROR_DUPLICATE_LABEL

1104

Duplicate label found

$ERROR_MAX_FIELDS

1105

More than 10 arguments not allowed

$ERROR_FILE_POS_ERROR

1106

Cannot position script file

$ERROR_WAIT_TIMED_OUT

1109

Time-out expired

$ERROR_CHAIN_FAILED

1113

Script file chain command failed

$ERROR_SCRIPT_READ_ERROR

1116

Error reading script file

$ERROR_NO_REGISTRY

1120

Windows registry values not found

$ERROR_HW_NOT_CFGD

1121

Hardware error

$ERROR_EXEC_FAILED

1123

EXEC command failed

$ERROR_CMD_NOT_SUPPORTED

1124

Command not supported with current

$ERROR_CRONTAB_EMPTY

1125

The cron event file contains no scheduling condition(s)

$ERROR_INTEGRITY_CHECKING_FAILED

1126

The file checksums did not match

$ERROR_NO_TIMERS_AVAILABLE

1134

Cannot time-out /drop Option

$ERROR_OPTIMEDOUT

1139

Operation timed out

$ERROR_TRACE_LOG_NOT_OPEN

1145

Trace log file not currently open

$ERROR_TRACE_LOG_ERROR

1146

Error writing to trace log file

$ERROR_EVENT_LOGGING_ERROR

1147

Error writing to NT event log

$ERROR_FTP_INIT_ERROR

1150

Winsock initialization error

$ERROR_FTP_CONNECT_FAILURE

1152

Connection to FTP site failed

$ERROR_FTP_IS_LOGGED_ON

1153

FTP connection already established

$ERROR_FTP_CMD_FAILED

1157

FTP command issued via FTPCMD failed

$ERROR_FTP_BAD_LOGON

1162

Must specify user name and password

$ERROR_FTP_NO_USER_NAME

1163

Cannot logon due to missing user name

$ERROR_NO_FILE_FOUND

1164

No file found

$ERROR_NO_SITE_DEFINED

1165

No default FTP site defined

$ERROR_NOT_IBM_MODE

1166

IBM host FTP features not enabled

$ERROR_NO_DIR_ACCESS

1167

Cannot access/create local folder or server directory

$ERROR_NO_RELATIVE_PATHS

1168

Relative pathnames not allowed here

$ERROR_RAS_NOT_INSTALLED

1170

Dial-Up Networking not installed

$ERROR_RAS_CONNECTION_FAILED

1172

Dial-Up Networking connect failed

$ERROR_AUTHORIZATION_FAILED

1175

Authorization not found

$ERROR_INVALID_MINIMIZED

1176

Script command not permitted when console window is minimized

$ERROR_NOT_ADMIN_USER

1177

Functionality restricted to Administrator users

$ERROR_THREAD_ERROR

1180

Internal thread launch failure

$ERROR_NO_ACTIVITY_TIMEOUT

1181

No activity time-out expired during file send or receive

$ERROR_INVALID_FUNCTION_NAME

1185

Invalid function name

$ERROR_FUNCTION_FILE_ERROR

1186

Function file creation error

$ERROR_TOO_MANY_ARGUMENTS

1189

Too many arguments passed to function

$ERROR_BAD_ARGUMENT_LIST

1190

Number of function arguments do not match declaration.

$ERROR_TOO_MANY_FUNCTIONS

1192

Too many functions defined or nesting calls too deep (maximum depth 32)

$ERROR_FUNCS_NOT_RECURSIVE

1193

Function may not call itself

$ERROR_EMAIL_CANNOT_CREATE

1200

Cannot create e-mail message

$ERROR_EMAIL_CANNOT_SEND

1201

Cannot send e-mail message

$ERROR_EMAIL_CANNOT_GET

1202

Cannot get e-mail message

$ERROR_EMAIL_NO_MESSAGES

1203

No messages on e-mail server

$ERROR_SRVMONITOR_FAILED

1210

Unable to launch Monitor applet (SrvMonitor.exe)

$ERROR_NO_REST_CMD

1220

REST command not supported by FTP site

$ERROR_SRVR_FILE_NEWER

1221

File on server is newer

$ERROR_SRVR_FILE_OLDER

1222

File on server is older

$ERROR_SRVR_FILE_LARGEREQ

1223

File on server same size or larger

$ERROR_SRVR_FILE_EXISTS

1224

File exists on server

$ERROR_SRVR_FILE_LARGER

1226

File on server is larger

$ERROR_SRVR_FILE_SMALLER

1227

File on server is smaller

$ERROR_NO_SRVR_FILE_EXISTS

1228

File does not exist on server

$ERROR_SRVR_FILE_EMPTY

1229

File exists on server but its length is 0

$ERROR_INVALID_COMPARISON

1230

Invalid file statistics comparison

$ERROR_FILE_INFO_UNAVAIL

1231

Local or server file data unavailable

$ERROR_LOCAL_FILE_NEWER

1232

Local file is newer

$ERROR_LOCAL_FILE_OLDER

1233

Local file is older

$ERROR_FILES_SAME_SIZE

1234

Local and FTP site files identical in size

$ERROR_LOCAL_FILE_LARGER

1235

Local file is larger

$ERROR_LOCAL_FILE_SMALLER

1236

Local file is smaller

$ERROR_LOCAL_FILE_LARGEREQ

1237

Local file same size or larger

$ERROR_LOCAL_FILE_EXISTS

1238

Local file exists

$ERROR_NO_LOCAL_FILE_EXISTS

1239

Local file does not exist

$ERROR_LOCAL_FILE_EMPTY

1240

Local file exists but length equals 0

$ERROR_FILES_SAME_DATETIME

1241

Local and FTP site files have same date and time

$ERROR_OLE_COMPARISON_TRUE

1250

Comparison set via OLE interface evaluated TRUE

$ERROR_OLE_COMPARISON_FALSE

1251

Comparison set via OLE interface evaluated FALSE

$ERROR_OLE_CMD_ACCEPTED

1252

Statement or label submitted via OLE has been accepted

$ERROR_ZIP_DLL_MISSING

1255

Zip component is missing

$ERROR_ZIP_FILE_CREATE

1256

Error updating or creating zip file

$ERROR_ZIP_FILE_CANCELLED

1257

Zip file operation canceled

$ERROR_ZIP_FILE_EXTRACT

1258

Zip file extraction error

$ERROR_ZIP_FILE_EMPTY

1259

Zip file is empty

$ERROR_SSHSSL_NOT_INSTALLED

1260

SSH/SSL components not available; this is an installation issue - verify that the SSH/SSL components were chosen

$ERROR_PGP_NOT_INSTALLED

1270

PGP components not available; this is an installation issue - verify that the PGP components were chosen

$ERROR_PGP_KEYID_MISSING

1271

User name, comment, and/or e-mail address required to identify recipient of encrypted file

$ERROR_PGP_UNACCEPTABLE_FILE

1272

Cannot import PGP keys from this file

$ERROR_PGP_UNRECOGNIZED_FILE

1273

Key file is not in a recognized format

$ERROR_PGP_KEY_EXISTS

1274

Key already exists in your keyring

$ERROR_PGP_IMPORT_FAILED

1275

PGP import operation failed

$ERROR_PGP_NO_KEYRING_FILE

1276

PGP keyring file cannot be created

$ERROR_PGP_ENCRYPTION_FAILED

1277

PGP encryption operation failed or canceled

$ERROR_PGP_DECRYPTION_FAILED

1278

PGP decryption operation failed or canceled

$ERROR_PGP_INITIALIZATION_FAILED

1279

PGP component failed to initialize

$ERROR_PGP_KEY_DOES_NOT_EXIST

1280

Key does not exist in your keyring

$ERROR_PGP_PASSPHRASE_BLANK

1281

Passphrase not present

$ERROR_GNUPG_CMD_FAILED

1282

External GnuPG command failed or canceled

$ERROR_PGP_KEYSPEC_AMBIGUOUS

1283

Key specification ambiguous, more than one key matches

$ERROR_PGP_SIGNATURE_INVALID

1284

Cannot validate signature

$ERROR_PGP_EXPORT_FAILED

1285

PGP export operation failed

$ERROR_SNAPSHOT_CANCELLED

1290

SNAPSHOT command canceled

$ERROR_DIFF_CANCELLED          

1291

DIFF command canceled

$ERROR_DB_NO_FILE_OPEN

1300

No user database file currently open

$ERROR_DB_NO_QUERY_RESULTS

1301

No results available from previous query

$ERROR_DB_ALL_RESULTS_RTND

1302

All results returned from previous query

$ERROR_DB_QUERY_FAILED

1303

Query failed

$ERROR_DB_QUERY_RESULT_NULL

1304

Query result empty

$ERROR_DB_RAW_QUERY_RESULTS

1305

Query result processing failed, raw result saved

$ERROR_DB_NATIVE_CONNECT

1306

ODBC Connection Failure, see tracelog for details

$ERROR_DB_UNSUPPORTED_RESULT

1307

Unsupported data type in query result

$ERROR_RSCMD_INITIATED_OKAY

1311

Non-blocking command initiated

$ERROR_RSCMD_IN_PROGRESS

1312

Remote command in progress

$ERROR_RSCMD_FAILED

1313

Remote command failed

$ERROR_RSCMD_TIMEOUT

1315

Remote command timed out

$ERROR_RSCMD_NO_RESPONSE

1316

Server does not respond to command

$ERROR_LICENSE_VIOLATION

2000

Product not licensed or license removed

 

 

 

The follow constants may be used to assist in writing more legible and self-documenting scripts:

 

 

 

Doing File Comparisons

 

 

$FILE_EMPTY

3000

Other file exists but is empty

$FILE_LARGER

3001

Other file is larger

$FILE_SMALLER

3002

Other file is smaller

$FILE_SAME_SIZE

3003

Other file is same size

$FILE_NEWER

3004

Other file is newer

$FILE_OLDER

3005

Other file is older

$FILE_SAME_DATETIME

3006

Other file has same date/time

 

 

 

Determining FTP Server Type (These constants are currently unused but reserved for future enhancements.)

$FTP_FTP

4000

FTP

$FTP_FTPS

4001

FTPS (FTP + SSL) secure control channel only

$FTP_FTPS_DATA

4002

FTPS (FTP + SSL) control

$FTP_FTPS_IMP

4003

FTPS (implicit via port 990)

$FTP_SFTP

4004

SFTP (FTP + SSH)

$FTP_FTPS_CCC

4005

FTPS (FTP + SSL) secure data channel only

 

 

 

Identifying Difference From DIFF/FTPDIFF Commands

$DIFF_FILE_NOT_FOUND

5001

File not found

$DIFF_FILE_IS_NEW

5002

File is new

$DIFF_FILE_SIZE

5003

File size has changed

$DIFF_FILE_DATETTIME

5004

File date/time stamp has changed

 

 

Related Command(s): IFERROR, FTPSETERROR

See also: %lasterror, %lasterrormsg