BITSON: Determining If a Bit Is On or Off

How to:

The BITSON function evaluates an individual bit within a character string to determine whether it is on or off. If the bit is on, BITSON returns a value of 1. If the bit is off, it returns a value of 0. This function is useful in interpreting multi-punch data, where each punch conveys an item of information.


Top of page

x
Syntax: How to Determine If a Bit Is On or Off
BITSON(bitnumber, source_string, output)

where:

bitnumber

Integer

Is the number of the bit to be evaluated, counted from the left-most bit in the character string.

source_string

Alphanumeric

Is the character string to be evaluated. The character string is in multiple eight-bit blocks.

output

Integer



Example: Evaluating a Bit in a Field

BITSON evaluates the 24th bit of LAST_NAME:

BITSON(24, LAST_NAME, 'I1')

For SMITH, the result is 1.

For CROSS, the result is 9.


iWay Software