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.

$ESTACK$ESTACKContains the number of context frames saved on the call stack from a user-defined point.$ESTACK$ESDescription$ESTACK contains the number of context frames saved on the call stack for your job froma user-defined point. You specify this point by creating a new copy of $ESTACK using theNEW command.The $ESTACK special variable is similar to the $STACK special variable. Both contain thenumber of context frames currently saved on the call stack for your job or process. <strong>Caché</strong>increments and restores both when changing context. The major difference is that you canreset the $ESTACK count to zero at any point by using the NEW command. You cannotreset the $STACK count.Context Frames and Call StacksWhen a <strong>Caché</strong> image is started, before any contexts have been saved on the call stack, thevalues of both $ESTACK and $STACK are zero. Each time a routine calls another routinewith DO, <strong>Caché</strong> saves the context of the currently executing routine on the call stack, increments$ESTACK and $STACK, and starts execution of the called routine in the newly-createdcontext. The called routine can, in turn, call another routine, and so on. Each time anotherroutine is called, <strong>Caché</strong> increments $ESTACK and $STACK and places more saved contextson the call stack.Issuing a DO command, an XECUTE command, or a call to a user-defined function establishesa new execution context. Issuing a GOTO command does not.As DO commands, XECUTE commands, or user-defined function references create newcontexts, <strong>Caché</strong> increments the values of $STACK and $ESTACK. As QUIT commandscause contexts to exit, <strong>Caché</strong> restores the previous contexts from the call stack and decrementsthe values of $STACK and $ESTACK.The $ESTACK and $STACK special variables cannot be modified using the SET command.Attempting to do so results in a error.Creating a New $ESTACKYou can create a new copy of $ESTACK in any context by using the NEW command. <strong>Caché</strong>takes the following actions:<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 423

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

Saved successfully!

Ooh no, something went wrong!