Radix Conversion

Formats

MX [0C ]   Hexadecimal conversion (base 16)
MO [0C ]   Octal conversion (base 8)
MB [0C ]   Binary conversion (base 2)
MU0C    Hexadecimal Unicode character conversion

The MX, MO, and MB codes convert data from hexadecimal, octal, and binary format to decimal (base 10) format and vice versa.

With ICONV

The decimal, or ASCII, format is the internal format for data representation. When used with the ICONV function, MX, MO, and MB without the 0C extension convert hexadecimal, octal, or binary data values (respectively) to their equivalent decimal values. MX, MO, and MB with the 0C extension convert hexadecimal, octal, or binary data values to the equivalent ASCII characters rather than to decimal values.

Use the MU0C code only if NLS is enabled. When used with ICONV, MU0C converts data in Unicode hexadecimal format to its equivalent in the internal character set.

Characters outside of the range for each of the bases produce conversion errors. The ranges are as follows:

MX (hexadecimal)
0 through 9, A through F, a through f
MO (octal)
0 through 7
MB (binary)
0, 1
MU0C (Unicode)
No characters outside range

With OCONV

When used with the OCONV function, MX, MO, and MB without the 0C extension convert decimal values to their equivalent hexadecimal, octal, or binary equivalents for output, respectively. Nonnumeric data produces a conversion error if the 0C extension is not used.

MX, MO, and MB with the 0C extension convert an ASCII character or character string to hexadecimal, octal, or binary output format. Each character in the string is converted to the hexadecimal, octal, or binary equivalent of its ASCII character code.

Use the MU0C code only if NLS is enabled. When used with OCONV, MU0C converts characters from their internal representation to their Unicode hexadecimal equivalents for output. The data to convert must be a character or character string in the internal character set; each character in the string is converted to its 4-digit Unicode hexadecimal equivalent. Data is converted from left to right, one character at a time, until all data is exhausted.