Available Languages: reporting, Maintain
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.
BITSON(bitnumber, source_string, output)
Is the number of the bit to be evaluated, counted from the left-most bit in the character string.
Is the character string to be evaluated, enclosed in single quotation marks, or a field or variable that contains the character string. The character string is in multiple eight-bit blocks.
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.
BITSON evaluates the 24th bit of LAST_NAME and stores the result in BIT_24:
TABLE FILE EMPLOYEE PRINT LAST_NAME AND COMPUTE BIT_24/I1 = BITSON(24, LAST_NAME, BIT_24); WHERE DEPARTMENT EQ 'MIS'; END
The output is:
LAST_NAME BIT_24 --------- ------ SMITH 1 JONES 1 MCCOY 1 BLACKWOOD 1 GREENSPAN 1 CROSS 0