Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference SETON
Functions and Expressions Reference Guide
184
SETON
The SETON function sets to one a specified bit in a binary number.
Syntax
SETON ( single-binary-number-expression, single-integer-
expression )
Meaning
SETON ( binary_number_to_change, bit_to_turn_on )
Returns
This function returns a single-binary-number.
SETON uses the value of bit_to_turn_on to specify the bit of
binary_number_to_change that should be set to the value 1. The result is a
binary number item of the same size as binary_number_to_change.
Bit_to_turn_on represents the position of the single bit in
binary_number_to_change to be set on. (Bits are numbered from left to right,
with the leftmost bit being bit 1.) If bit_to_turn_on is less than one or greater
than the number of bits of binary_number_to_change,
SETON returns
binary_number_to_change, unchanged.
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.
SETON ( A , 15 ) returns the two byte binary value, 0011 (decimal value 3)
SETON ( A , 40 ) returns the two byte binary value, 1
The second example returns 1, the original value of A, because bit 40 does not
exist in A.