The BIN function returns a character-string value that is the
binary equivalent of the specified parameter. The return value
is compatible with all other string types.
Syntax:
BIN( x [[, length[[, digits]]]] )
The parameter 'x' is the expression to be converted. This
parameter must have a size that is known at compile time; it
cannot be VARYING OF CHAR, a conformant parameter, or a schema
type.
Two optional integer parameters specify the length of the
resulting string and the minimum number of significant digits to
be returned. If you specify a length that is too short to hold
the converted value, the resulting string is truncated on the
left.
If you omit the optional parameters, the bit width of the
converted parameter value determines the string length and the
number of significant digits. By default, the number of
significant digits is the minimum number of characters necessary
to express all the bits of the converted parameter. This
default length is one character more than the default number of
digits, which causes a leading blank to be included in the
resulting string when both parameters are omitted.