Radix Conversion (MB, MO, MX) |
|
|
The radix conversion codes convert a number to/from binary (MB), octal (MO) or hexadecimal (MX).
Input Conversion
The MB, MO and MX conversions take a number represented by a character string of binary, octal or hexadecimal digits and converts it to an internal integer value. The Z suffix described below for output conversion is ignored on input conversion.
Addition of the 0C suffix to these codes (MB0C, MO0C, MX0C) takes a character string holding a series of binary, octal or hexadecimal digits and translates each group of 8, 3 or 2 digits to the corresponding ASCII character. If the source data is not an exact multiple of 8, 3 or 2 digits in length, as appropriate to the conversion type, implied leading zeros are added.
The MBUC, MOUC and MXUC conversion codes are similar to MB0C, MO0C and MX0C but take a character string holding a series of binary, octal or hexadecimal digits and translates each group of 16, 6 or 4 digits to the corresponding character. If used on a non-ECS mode system, attempting to convert data that would yield characters outside the 8 bit set will fail.
Output Conversion
The MB, MO and MX conversions convert a number to binary, octal or hexadecimal form as a character string. Non-integer values are truncated towards zero. Negative values are treated as unsigned 32 bit values. Leading zeros are suppressed by default. If the Z suffix is added to the conversion code (e.g. MXZ) leading zeros are added to form a 32 bit value or, if the source data is over 32 bits, a 64 bit value.
The addition of the 0C suffix to any of these conversion codes treats the source data as a character string and converts each character to its eight digit binary, three digit octal or two digit hexadecimal representation.
The MBUC, MOUC and MXUC conversion codes are similar to MB0C, MO0C and MX0C but return the data for each character as a sixteen digit binary, six digit octal or four digit hexadecimal value. Although supported on all versions of QM, these are of particular use of ECS mode systems where MB0C, MO0C and MX0C will not produce the correct result for characters outside the 8 bit set.
Examples
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||