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.

<strong>Caché</strong> <strong>ObjectScript</strong> Special Variables$ZREFERENCEContains the current global reference.$ZREFERENCE$ZRDescription$ZREFERENCE contains the name and subscript(s) of the last global reference. This isknown as the naked indicator.The last global reference can be either a global (^myglob) or a process-private global(^||myppg). In this description of $ZREFERENCE, the word “global” refers to both typesof variables.The last global reference is the global most recently referred to by a command or a function.Because <strong>ObjectScript</strong> performs operations in left-to-right order, the last global reference isalways the rightmost global. When a command or function takes multiple arguments, theglobal specified in the rightmost argument is the last global reference. When an argumentcontains multiple global references, the rightmost specified global is the last global reference.This strict left-to-right order holds true even if parentheses are used to define the order ofoperations.<strong>Caché</strong> updates $ZREFERENCE when an explicit global reference is issued. Invoking anexpression (such as a local variable) that evaluates to a global reference does not update$ZREFERENCE.$ZREFERENCE contains the most recent global reference, even if this global referencewas not successful. When a command references an undefined global, generating an error, <strong>Caché</strong> updates $ZREFERENCE to that global reference, just as ifthe global were defined.$ZREFERENCE often contains the most recent global reference, even if the commandexecution was not successful. $ZREFERENCE is updated as each global is referenced. Forexample, a command that generates a error (attempting to divide a number by 0)updates $ZREFERENCE to the last global referenced in the command before the erroroccurred. However, a error does not update $ZREFERENCE.If the last global reference was a naked global reference, $ZREFERENCE contains theexternal, readable, full form of the current naked global reference. This is demonstrated inthe following example:484 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!