BIT-OF
The BIT-OF function returns an alphanumeric character string consisting of characters "1" and "0" that correspond to the binary value of each byte in the input argument.
The type of the function is alphanumeric.
- argument-1
- Can be a data item, literal, or intrinsic function result of any data class. argument-1 identifies the source character string for the conversion.
The returned value is an alphanumeric character string consisting of the bytes of argument-1 converted to the bit pattern corresponding to the binary value of each byte in argument-1. The length of the output character string in bytes is eight times the length of argument-1 in bytes.
Note: If argument-1 is invalid,
the behavior is undefined.
Examples
- FUNCTION BIT-OF('Hello, world!') returns '11001000100001011001001110010011100101100110101101000000101001101001011010011001100100111000010001011010'
FUNCTION BIT-OF(BIN) returns '00000000000000000000000000001100'01 BIN PIC 9(9) BINARY VALUE 12. . .
FUNCTION BIT-OF(PAC) returns '000100100011010001011111'01 PAC PIC 9(5) COMP-3 VALUE 12345. . .
FUNCTION BIT-OF(ZON) returns '1111000111110010111100111111010011110101'01 ZON PIC 9(5) VALUE 12345. . .
- FUNCTION BIT-OF(NATIONAL-OF(' ')) returns '0000000000100000'