11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

System and Other FunctionsWRITE $ZBOOLEAN(2,1,6)displays 3.WRITE $ZBOOLEAN(2,2,6)displays 0.WRITE $ZBOOLEAN(3,2,6)displays 1.WRITE $ZBOOLEAN(64,255,6)displays 191.The following example shows a 4-byte entity with all bytes set to 1:WRITE $ZBOOLEAN(5,1,15)displays -1.The following example will set x to 3 bytes with all bits set to 1:SET x=$ZBOOLEAN("abc",0,15)WRITE !,$LENGTH(x)WRITE !,$ASCII(x,1)," ",$ASCII(x,2)," ",$ASCII(x,3)The first WRITE displays 3; the second WRITE displays 255 255 255.NotesInteger ProcessingBefore $ZBOOLEAN performs the bitwise operation, it interprets each numeric value aseither an 8-byte or a 4-byte signed binary value, depending on size. $ZBOOLEAN alwaysinterprets a numeric value as a series of bytes. The boolean operation uses these bytes as astring argument. The result type is the same as the type of arg1.If either arg1 or arg2 is numeric and cannot be represented as an 8-byte signed integer (largerthan 18 decimal digits), a error results. If both arg1 and arg2 are numericand one of them requires 8 bytes to be represented, then both values are interpreted as 8-bytebinary values.After the previous transformations are complete, the given Boolean combination is appliedbit by bit to arg1 and arg2 to yield the result. The result returned is always the same lengthas arg1 (after the above transformations of numeric data). If the length of arg2 is less than520 <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!