11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

$ECODE can also contain error codes that are the same as <strong>Caché</strong> General System error codes(the error codes returned at the terminal prompt and to the $ZERROR special variable).However, $ECODE appends a “Z” to these error codes, and removes the angle brackets.Thus the $ECODE error ZSYNTAX is a error, ZILLEGAL VALUE is an error, and ZFUNCTION is a error. $ECODE doesnot retain any additional error info for those error codes that provide it; thus ZPROTECT isa error; the additional info component is kept in $ZERROR, but not in$ECODE. For more information about <strong>Caché</strong> error codes, see $ZERROR; for a completelist, see General System Error Messages in the <strong>Caché</strong> Error <strong>Reference</strong>.If an error occurs when $ECODE already contains an error code, <strong>Caché</strong> appends the codefor the new error to the current $ECODE value as a new piece in a string delimited by commas,as follows:,ZSTORE,M6,ZILLEGAL VALUE,ZPROTECT,In the above case, the most recent error is a error.Error codes accrue in the $ECODE special variable until one of the following happens:• You explicitly clear or set $ECODE.• The length of the accumulated string in $ECODE exceeds the maximum string datalength for your implementation.• You terminate the current process.Clearing or Setting $ECODEYou can clear or set $ECODE with the SET command. For example, you can clear $ECODEby setting it to the null string as follows:SET $ECODE=""Clearing the value of $ECODE also affects error processing flow of control for $ETRAPerror handlers and clears the error stack for your job. See Error Processing in Using <strong>Caché</strong><strong>ObjectScript</strong> for more details.You can force an error by setting $ECODE. Setting $ECODE to any non-null value forcesan interpreter error during the execution of a <strong>Caché</strong> <strong>ObjectScript</strong> routine. After <strong>Caché</strong> sets$ECODE to the non-null value that you specify, <strong>Caché</strong> takes the following steps:1. Generates an error condition (setting $ZERROR to the value )2. Passes control to any error handlers you have established.$ECODE<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 421

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!