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.

$INCREMENTKILL xyzWRITE !,$INCREMENT(xyz,""); null string initializes to 0WRITE !,$INCREMENT(xyz,2); increments by 2WRITE !,$INCREMENT(xyz,""); null string increments by 0 (xyz=2)WRITE !,$INCREMENT(xyz,"3A4"); increments by 3 (rest of string ignored)WRITE !,$INCREMENT(xyz,"A4"); nonnumeric string evaluates as zero (xyz=5)WRITE !,$INCREMENT(xyz,"1E2"); increments by 100 (exponential notation)Notes$INCREMENT and $ZINCREMENT$INCREMENT and $ZINCREMENT have the same syntax and effects. You can use$ZINCREMENT in any situation in which you would use $INCREMENT.$INCREMENT and Global VariablesYou can use $INCREMENT on a global variable or a subscript node of a global variable.You can access a global variable mapped to another namespace using an extended globalreference. You can access a subscripted global variable using a naked global reference.<strong>Caché</strong> evaluates parameters in left-to-right order. If num (the amount to increment) is a subscriptedglobal, <strong>Caché</strong> uses this global reference to set the naked indicator, affecting all subsequentnaked global references.Locking and Simultaneous Global Increments$INCREMENT and $ZINCREMENT do not perform a lock operation when they incrementvariable nor does using the LOCK command on variable prevent $INCREMENT fromincrementing or decrementing its value. For example, suppose process 1 executes a lock on^COUNTER:LOCK ^COUNTERThen suppose, process 2 increments ^COUNTER:SET x=$INCREMENT(^COUNTER,VAL)Process 2 is not prevented from incrementing ^COUNTER by the lock held by process 1.The two processes are not guaranteed their own unique ^COUNTER values unless both areusing $INCREMENT.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 223

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

Saved successfully!

Ooh no, something went wrong!