Handling Command Errors in a Script File

ESSCMD provides error checking and handling. You can check for errors and, if necessary, branch to an appropriate response.

After each ESSCMD command is executed, a number is stored in an internal buffer. If the command executes successfully, 0 is returned to the buffer; if the command is unsuccessful, the error number is stored in the buffer. Unsuccessful execution is called non-zero status.

ESSCMD provides the following error-handling commands:

In this LOAD.SCR example, if a command does not execute successfully, ESSCMD branches to the end of the file to avoid completing other operations.

LOGIN "local" "User1" "password" "Sample" "Basic";
LOADDATA 2 "calcdat";
IFERROR "Error";
CALC "Calc All;";
IFERROR "Error";
RUNREPT 2 "Myreport";
IFERROR "Error";
[possible other commands]
EXIT;
 
:Error
 
EXIT;

Note:

You can use the OUTPUT command to log errors.