Using Script File Result Codes

Top  Previous 

 

Each FileLink script command returns a four-digit numeric result code when it completes to indicate success or failure. When FileLink is used interactively, or if you need to interpret a log file, it is not necessary to know the specific numeric values because FileLink translates all of these values to English phrases in the form of status messages. When writing these messages to the log file, FileLink 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.

 

FileLink always returns a zero result code if a script command is completed successfully. Therefore a script file checks for a non-zero result codes 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.

 

FileLink defines a set of internal variables referred to as $ERROR variables. $ERROR variables 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 FileLink $ERROR variables and corresponding numeric result codes are listed below:

 

$ERROR Variable 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

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_NO_CARRIER

1029

Connect error -- no carrier tone detected

$ERROR_CONNECT_TIMEOUT

1030

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

$ERROR_INVALID_MODEM_CMD

1031

Invalid/unrecognized modem response

$ERROR_BUSY_SIGNAL

1034

Line is busy

$ERROR_NO_DIAL_TONE

1035

Connect error -- no dial tone detected

$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_WRITE_ERROR

1063

File write error

$ERROR_READ_ERROR

1069

File read error

$ERROR_RCV_ERROR

1070

Unable to receive characters

$ERROR_RCV_CANCELLED

1073

Receive canceled

$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_NOT_XE_VERSION

1082

FileLink XE is required

$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 (Terminal is active)

$ERROR_LOG_FILE_ERROR

1089

Cannot open script log file

$ERROR_LOG_NOT_OPEN

1092

Script log 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_WORD_LENGTH_BAD

1110

Selected protocol requires 8-bit data byte

$ERROR_CHAIN_FAILED

1113

Script file chain command failed

$ERROR_SCRIPT_READ_ERROR

1116

Error reading script file

$ERROR_NO_REGISTRY

1120

Registry values not found for COMx

$ERROR_HW_NOT_CFGD

1121

Hardware error or COM port not found

$ERROR_EXEC_FAILED

1123

EXEC command failed

$ERROR_PIPE_FAILED

1125

PIPE command failed

$ERROR_PIPE_OPEN_TIMEOUT

1127

Pipe open timed out

$ERROR_PIPE_READ_FAILED

1128

Pipe read failure

$ERROR_PIPE_READ_TIMEOUT

1129

Pipe read timed out

$ERROR_PIPE_WRITE_FAILED

1130

Pipe write failure

$ERROR_PIPE_WRITE_TIMEOUT

1131

Pipe write timed out

$ERROR_INVALID_PIPE_PROTOCOL

1132

Bad pipe protocol - ignored

$ERROR_NO_TIMERS_AVAILABLE

1134

Cannot time-out /drop option

$ERROR_OPTIMEDOUT

1139

Operation timed out

$ERROR_PIPE_NOT_CREATED

1140

Pipe not previously created

$ERROR_PIPE_ALREADY_EXISTS

1141

Pipe already exists

$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_NO_FILE_FOUND

1164

No file found

$ERROR_NO_DIR_ACCESS

1167

Cannot access/create local folder

$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 connection failed

$ERROR_AUTHORIZATION_FAILED

1175

Authorization not found

$ERROR_INVALID_MINIMIZED

1176

Script command not permitted when main window is minimized or when running as NT service

$ERROR_NO_MODEMS_DETECTED

1177

No modems detected in system

$ERROR_NO_PORTS_DETECTED

1178

No COM ports detected in system

$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

$ERROR_FUNCTIONS_NOT_RECURSIVE

1193

Functions may not be called recursively

$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_CRONTAB_EMPTY

1210

crontab.txt file contains no scheduling condition(s)

$ERROR_SRVMONITOR_FAILED

1210

Unable to launch SrvMonitor

$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 server 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 server files have same date and time

$ERROR_OLE_COMPARISON_TRUE

1250

Comparison results is TRUE

$ERROR_OLE_COMPARISON_TRUE

1251

Comparison results is FALSE

$ERROR_OLE_CMD_ACCEPTED

1252

Statement or label accepted

$ERROR_ZIP_DLL_MISSING

1255

Zip library file is missing

$ERROR_ZIP_FILE_CREATE

1256

Error updating or creating zip file

$ERROR_ZIP_FILE_CANCELED

1257

Zip file operation canceled

$ERROR_ZIP_FILE_EXTRACT

1258

SSH/SSL components not installed

$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 key ring

$ERROR_PGP_PASSPHRASE_BLANK

1281

Passphrase not present

$ERROR_GNUPG_CMD_FAILED

1282

External GnuPG command failed or canceled

$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_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

 

 

 

Identifying Difference From DIFF 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