ESSCMD error-handling features provide error checking and handling for your script files. You can write error-handling commands into your script file to check for errors and, if necessary, branch to an appropriate error-handling 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; a state called nonzero status.
For error checking within an ESSCMD script file, ESSCMD provides the following error-handling commands:
IFERROR checks the previously executed command for a nonzero return status (failure to execute). If the status is not zero, processing skips all subsequent commands and jumps to a user-specified point in the file, where it resumes. 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 file, if the LOADDATA command does not execute successfully, ESSCMD branches to the end of the file to avoid attempting to calculate and run a report script on the empty database:
LOGIN "localhost" "User1" "password" "Sample" "Basic"; LOADDATA 2 "calcdat"; IFERROR "Error"; CALC "Calc All;"; IFERROR "Error"; RUNREPT 2 "Myreport"; IFERROR "Error"; [possible other commands] EXIT; :Error
For the syntax and usage of ESSCMD error commands, see the Oracle Essbase Technical Reference.