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:
IFERROR checks the previously executed command for a non-zero (failure) return status. If the status is not zero, processing skips all subsequent commands and jumps to resume at a user-specified point in the file.
The script file can branch to an error-handling routine or the end of the file.
RESETSTATUS reverts all saved status values to 0 (zero) in preparation for more status checking.
GOTO forces unconditional branching to a user-specified point in the file, whether or not an error occurred.
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. |