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.

All $ZBOOLEAN operations parse both arg1 and arg2, including bit_op values 0, 3, 5, 10,12, and 15.The $ZBOOLEAN arg1 and arg2 parameters can resolve to one of the following types:• An integer. A positive or negative whole decimal number of up to 18 digits. No charactersother than the numbers 0–9 and, optionally, one or more leading plus and minus signsare permitted. Leading zeros are ignored.• A string. Enclosed in quotation marks, a string of any length with any contents is permitted.Note that the string “123” and the integer 123 are not the same. A null string is permitted,but if arg2 is the null string, $ZBOOLEAN always returns the value of arg1, regardlessof the bit_op value.• A signed string. A string preceded by a plus or minus sign is parsed as an integer,regardless of the string's contents. Signed strings are subject to the same length restrictionas integers. A signed null string is equivalent to zero.It is strongly recommended that arg1 and arg2 either both resolve to an integer or both resolveto a string. Generally, arg1 and arg2 should be the same data type; combining an integer anda string in a $ZBOOLEAN operation does not give a useful result in most cases.Parametersarg1The first argument in the bitwise logical expression. For strings, the length of the returnedvalue is always the same as the length of this argument.arg2The second argument in the bitwise logical expression.bit_op$ZBOOLEANThe bitwise logical operation to be performed, specified as a numeric code from 0 to 15,inclusive. Because this code is handled as a bit mask, a value of 16=0, 17=1, 18=2, etc.The bit_op values 0 and 15 return a constant value, but they also evaluate the arguments. Ifarg1 is an integer (or signed string), bit_op 0 returns 0, and bit_op 15 returns –1 (the one'scomplement of 0.) If arg1 is a string, bit_op 0 returns a low value (hex 00) for each characterin arg1, and bit_op 15 returns a high value (hex FF) for each character in arg1. If arg2 is thenull string (""), both operations return the literal value of arg1.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 517

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

Saved successfully!

Ooh no, something went wrong!