MASK( ) function

Returns the individual bits from the first byte of a character expression.

Syntax

MASK(character_value, character_mask)

Parameters

character_value

Character.

character_mask

Character.

Output

Character.

Remarks

You can use the MASK( ) function to identify specific bit patterns in a byte of data.

MASK( ) performs a bit-wise logical AND operation on the first characters of character_value and character_mask, returning a one-character-long string. If either parameter is longer than one byte, subsequent characters are ignored. The usual usage is to have the byte in question as character_value and a mask value as character_mask.

A bit-wise AND operation compares the two bytes, one bit at a time. The result for each bit position is 1 if both the corresponding bits are 1. Otherwise, the result is 0 for that bit.

Example

MASK("A", CHR(15)) = CHR(1)
(where A = 65 = 01000001, 15 = 00001111, A and 15 = 00000001)


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback