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.

$ZUTIL(69,0)012Issues the error for any undefined variable.Returns a null string for a reference to an undefined variable with subscripts, andissues the error for undefined variables without subscripts.Returns a null string (instead of issuing an error) for any undefinedvariable.Integers larger than 2 or smaller than –1 are ignored as no-ops. A value of –1 sets$ZUTIL(69,0) to 2.NotesThe $DATA function tests if a specified variable is defined. It returns 0 if the variable isundefined.The $GET function returns a default value if a specified variable is undefined. The basicform of $GET returns a null string if the specified variable is undefined.The $ZUTIL(69,0) function defines handling behavior for all undefined variables. Setting$ZUTIL(69,0) has no effect on $DATA or $GET.You can use the ZWRITE command to display defined variables that have a null string value;ZWRITE does not display undefined variables that return a null string.ExampleThe following example shows the system-wide and per-process settings for handling undefinedvariables.NEW fredWRITE !,"systemwide:",$ZUTIL(69,0)," process:",$ZUTIL(18)SET y=$ZUTIL(18,2)WRITE !,"systemwide:",$ZUTIL(69,0)," process:",$ZUTIL(18)SET x=$ZUTIL(69,0,1)WRITE !,"systemwide:",$ZUTIL(69,0)," process:",$ZUTIL(18)WRITE !,$GET(fred,"Variable is undefined")IF fred="" {WRITE !,"null string for undefined variable" }ELSE { WRITE !,"something is wrong here" }SET x=$ZUTIL(69,0,0) // reset to default for next timeQUITSee Also• $ZUTIL(18) Undefined Variable Behavior function• ZWRITE command• $DATA function<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 635

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

Saved successfully!

Ooh no, something went wrong!