NET/MASTER Network Control Language (NCL) Reference Manual

BITAND, BITOR, and BITXOR
Built-in Functions
4–10 106126 Tandem Computers Incorporated
Logical or Boolean AND operation (AND):
If in the comparison of two strings, both strings contain 1 in the same
corresponding bit position, the result is 1; otherwise, the result is 0 (zero).
Logically: 1 AND 1=1
1 AND 0=0
0 AND 1=0
0 AND 0=0
Logical or Boolean OR operation (OR):
If in the comparison of two strings, either string has 1 in the same corresponding
bit position, the result is 1; otherwise, the result is 0 (zero).
Logically: 1 OR 1=1
1 OR 0=1
0 OR 1=1
0 OR 0=0
Logical or Boolean exclusive OR operation (XOR):
If in the comparison of two strings, the strings have unlike values in the same
corresponding bit position, the result is 1; otherwise, the result is 0 (zero).
Logically: 1 XOR 0=1
0 XOR 1=1
1 XOR 1=0
0 XOR 0=0
Examples
In the following example, a logical AND operation is performed on the strings '73'x
and '27'x, which are the values assigned to the variables &A and &B, respectively:
&A = '73'x
&B = '27'x
&RESULT1 = BITAND(&A,&B)
&RESULT2 = C2X(BITAND(&A,&B))
SAY "&RESULT1 IS " &RESULT1 "AND &RESULT2 IS " &RESULT2
The output string assigned to the variable &RESULT1 is a pound sign (#), which,
when converted to hexadecimal using the C2X built-in function and assigned to the
variable &RESULT2, is '23'x. The suffix “x” indicates that the preceding string is
hexadecimal.
In the following example, a logical AND operation is performed on the strings '13'x
and '5555'x:
SAY BITAND('13'x,'5555'x)
The output string is “.U”, which is '1155'x when converted to hexadecimal.
In the following example, a logical OR operation is performed on the string “Fred”
and the pad character '40'x:
SAY BITOR(Fred,,'40'x)
The output string is “FRED”.