Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference TESTON
Functions and Expressions Reference Guide
198
TESTON
The TESTON function tests a specified bit in a binary number to see whether it is
on.
Syntax
TESTON ( single-binary-number-expression,
single-integer-expression )
Meaning
TESTON ( binary_number_to_test ,bit_to_test )
The value of bit_to_test specifies the bit of binary_number_to_test to test for
the value 1. If bit_to_test has the value 1, it refers to the leftmost bit of
binary_number_to_test.
Returns
This function returns TRUE or FALSE
Returns TRUE if the specified bit is on; it has the value 1. Returns FALSE if the
specified bit is off; it has the value 0.
If bit_to_test is less than one or greater than the number of bits of
binary_number_to_test,
TESTON returns FALSE.
Examples
Assume A is the two-byte binary value 1 (which is all zeros except for bit 16).
The binary representation of the value in A is: 0001.
TESTON ( A , 16 )
Returns TRUE.
TESTON ( A , 20 )
Returns FALSE because bit 20 does not exist in a two-byte value.