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_format)

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, in multiple 8-bit blocks.

output_format

Integer



Example: Determining If a Bit is On or Off

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