The MC code includes a suffixed operator code that specifies one of the following processes:
MC codes retain delimiters within the string being converted, except for MCP and its variants which convert delimiters as described.
You should use the MC codes in attribute 8 except where the list below notes that input conversion is valid:
MC0 Extract only characters in standard alphabet.
MC1 Extract only characters in primary added alphabet.
MC2 Extract only characters in secondary added alphabet.
MCA Extract only characters in standard, primary added and secondary added alphabets.
MC/A Extract only nonalphabetic characters.
MCAB{S} Convert ASCII character codes to binary representation (suppress spaces).
MCAX Convert ASCII character codes to hexadecimal representation.
MCB Extract only alphabetic and numeric characters.
MC/B Extract only special characters that are neither alphabetic nor numeric.
MCBA Convert binary representation to ASCII characters.
MCBX Convert a binary value to its hexadecimal equivalent.
MCC;x;y Change all occurrences of character string x to character string y.
MCDR Convert a decimal value to its equivalent Roman numerals. This code's input conversion works effectively.
MCDX Convert a decimal value to its hexadecimal equivalent. This code's input conversion works effectively.
MCL Convert all upper case
letters
MCN Extract only numeric
characters
MC/N Extract only nonnumeric characters.
MCNP{c} Convert paired hexadecimal digits preceded by a tilde or character c to ASCII code.
MCP{c} Convert each nonprintable character (X'00' to X'1F' and X'80' to X'FE') to a tilde (~) or to character c.
MCPN{c} Same as MCP but insert the two-character hexadecimal representation of the character immediately after the tilde or character c.
MCRD Convert Roman numerals to the decimal equivalent. This code's input conversion works effectively.
MCT Convert all upper case
letters
MCU Convert all lower case
letters
MCXA Convert hexadecimal representation to ASCII characters.
MCXB{S} Convert a hexadecimal value to its binary equivalent (suppress spaces).
MCXD Convert a hexadecimal value to its decimal equivalent. This code's input conversion works effectively.
Note: Alternative alphabets
(used by MCA, MC1 and MC2 codes) can be set up via the denationalisation system.
See the
The following synonym codes are also available:
MCAN Synonym for MCB.
MC/AN Synonym for MC/B.
MCD Synonym for MCDX.
MCI Synonym for MC0.
MCNA Synonym for MCB.
MC/NA Synonym for MC/B.
MCR Synonym for MCRD.
MCX Synonym for MCXD.
MX Synonym for MCAX.
MY Synonym for MCXA.
Some MC codes change letters from upper case to lower case or vice versa.
Input conversion does not invert. It applies the character conversion to the input data.
MCL Convert all upper case
letters
MCT Convert all upper case
letters
A word starts at the beginning of the string or with the first alphanumeric character following a space, double quotation mark, left parenthesis or hyphen.
MCU Convert all lower case
letters
The following examples demonstrate changing case with MC codes. The first two examples translate a character string to upper case and lower case respectively. In the third example, the first letter of each word is translated to upper case and the remaining characters to lower case:
MC Code | Stored Value | Converted Value |
---|---|---|
MCU | abcdEFg |
ABCDEFG |
MCL | abcdEFg |
abcdefg |
MCT | 'TIS THE TIME for all good PeOple to... |
'tis The Time For All Good People To... |
Some MC codes extract characters from a string. The classes of characters that can be extracted are: alphabetic, non-alphabetic, numeric, non-numeric, alphanumeric and non-alphanumeric.
Input conversion does not invert. It applies the character conversion to the input data.
MC0 Extract only characters in standard alphabet.
MC1 Extract only characters in primary added alphabet.
MC2 Extract only characters in secondary added alphabet.
MCA Extract only characters in standard, primary added, and secondary added alphabets.
MC/A Extract only nonalphabetic characters.
MCB Extract only alphanumeric characters.
MC/B Extract only special characters that are neither alphabetic nor numeric.
MCN Extract only numeric
characters
MC/N Extract only nonnumeric characters.
Note: Alternative alphabets (used by MCA, MC1
and MC2 codes) can be set up via the denationalisation system. See the
MCAN is a synonym for MCB.
MC/AN is a synonym for MC/B.
MCNA is a synonym for MCB.
MC/NA is a synonym for MC/B.
In the following table, the first two examples extract only alphabetic or numeric characters respectively. The other two examples extract only alphanumeric characters or special characters respectively.
MC Code | Stored Value | Converted Value |
---|---|---|
MCA | ABC;123/DEF | ABCDEF |
MC/A | ABC;123/DEF | ;123/ |
MCB | ABC;123/DEF | ABC123DEF |
MC/B | ABC;123/DEF | ;/ |
Some MC codes replace some characters with other characters. These codes
Input conversion does not invert. It applies the character conversion to the input data.
MCC;x;y Change all occurrences of character string x to character string y.
MCP{c} Convert each nonprintable character (X'00' to X'1F' and X'80' to X'FE') to a tilde (~) or to character c.
MCPN{c} Same as MCP, but insert the two-character hexadecimal representation of the character immediately after the tilde or character c.
MCNP{c} Convert paired hexadecimal digits preceded by a tilde or character c to ASCII code. This code inverts the conversion performed by the MCPN code.
In the following example, the existing string 'A1B' is replaced by 'C2D'.
MC Code | Stored Value | Converted Value |
---|---|---|
MCC;A1B;C2D | A1B567A1B | C2D567C2D |
In the following examples, nonprintable characters are translated to tildes and the second example shows the insertion of the hexadecimal representation after each tilde:
MC Code | Stored Value | Converted Value |
---|---|---|
MCP | 123xABCy456 | 123~ABC~456 |
MCPN | 123xABCy456 | 123~00ABC~05456 |
x is CTRL+@ and y is CTRL+E
You can use the same codes but specify a character other than the default tilde to use as the substitution character:
MC Code | Stored Value | Converted Value |
---|---|---|
MCP& | 123xABCy456 | 123&ABC&456 |
MCPN# | 123xABCy456 | 123#00ABC#05456 |
The MCNP code inverts the results of the MCPN code:
MC Code | Stored Value | Converted Value |
---|---|---|
MCNP | 123~00ABC~05456 | 123xABCy456 |
MCNP# | 123#00ABC#05456 | 123xABCy456 |
Some MC codes convert ASCII character codes to their binary or hexadecimal equivalents or vice versa.
Input conversion does not invert. It applies the character conversion to the input data.
MCAB{S} Convert ASCII character codes to binary representation (suppress spaces).
MCAX Convert ASCII character codes to hexadecimal representation.
MCBA Convert binary representation to ASCII characters.
MCXA Convert hexadecimal representation to ASCII characters.
The codes MCAB and MCABS convert each ASCII character to its binary equivalent as an eight-digit number. If there is more than one character, MCAB puts a blank space between each pair of eight-digit numbers. MCABS suppresses the spaces.
When converting from binary to ASCII characters, MCBA uses blank spaces as dividers if they are present. MCBA effectively scans from the right end of the data looking for eight-bit chunks of binary digits. If the process encounters a blank space and the chunk is not a multiple of eight binary digits, it appends zeros to the front of the number until it has a multiple of eight digits. The process continues doing this until it gets to the leftmost digit, at which point it appends zeros if necessary. It then converts each eight-digit chunk into an ASCII character.
MX is a synonym for MCAX.
MCY is a synonym for MCXA.
Note: When you specify the codes MCBA or MCXA, you must take care that the codes do not cause unusual displays on the terminal screen or on a printer. The code X'0C', for example, is the clear screen code in ASCII. If you were to translate it using MCXA, it would clear the screen when it was sent to the terminal.
In the following example, the MCXA converts codes expressed as hexadecimal numbers to their ASCII equivalents. The MCAX does the reverse.
MC Code | Stored Value | Converted Value |
---|---|---|
MCXA | 412B423D43 | A+B=C |
MCAX | Calif. | 43616C69662E |
In the following examples, MCAB converts letters to their binary equivalents with intervening spaces. MCABS does the same but without spaces. MCBA converts from binary representation to ASCII code.
MC Code | Stored Value | Converted Value |
---|---|---|
MCAB | FI | 01000110 01001001 |
MCABS | FI | 0100011001001001 |
MCBA | 01010111 01100101 | We |
MCBA | 1010111 1100101 | We |
MCBA | 101011101100101 | We |
Some MC codes convert numeric values, as opposed to characters, to their equivalents in other number bases or representation. There are MC codes for performing the following conversions:
Input conversion works for MCDR, MCDX, MCRD and MCXD. The other codes do not invert; they apply the character conversion to the input data.
MCBX Convert a binary value to its hexadecimal equivalent.
MCDR Convert a decimal value to its equivalent Roman numerals.
MCDX Convert a decimal value to its hexadecimal equivalent.
MCRD Convert Roman numerals to the decimal equivalent.
MCXB{S} Convert a hexadecimal value to its binary equivalent (suppress spaces).
MCXD Convert a hexadecimal value to its decimal equivalent.
These codes convert numeric values as opposed to individual characters. Thus, the decimal number 67 converted to hexadecimal is X'43'; converted to Roman numerals, it is LXVII. The value of the number 67 is converted, not the characters "6" and "7."
Except for MCBX{S}, these codes stop on a character that is not a digit of the number system. MCDX and MCDR stop on a nondecimal digit; MCRD stops on a non-Roman numeral; and MCXB and MCXD stop on a nonhexadecimal digit.
MCBX allows blank spaces as dividers between binary numbers; otherwise, it stops on a nonbinary digit.
When a conversion processor does not find any valid digits of its number system, it outputs a zero except for MCDR, which outputs null.
MCXB converts a hexadecimal number to a binary number. Because the processor outputs binary numbers in eight-digit chunks, it must add a leading zero when processing an odd number of hexadecimal digits.
The codes MCXB and MCXBS convert each hexadecimal digit to its binary equivalent as an eight-digit number. If there is more than one hexadecimal digit, MCAB puts a blank space between each pair of eight-digit numbers. MCABS suppresses the space.
When converting from binary to hexadecimal digits, MCBX uses blank spaces as dividers if they are present. MCBX effectively scans from the right end of the data looking for eight-bit chunks of binary digits. If the process encounters a blank space and the chunk is not a multiple of eight binary digits, it appends zeros to the front of the number until it has a multiple of eight digits. The process continues doing this until it gets to the leftmost digit, at which point it appends zeros if necessary. It then converts each eight-digit chunk into a hexadecimal digit.
MCD is a synonym for MCDX.
MCR is a synonym for MCRD.
MCX is a synonym for MCXD.
The following examples demonstrate the MC codes for converting numeric values:
MC Code | Stored Value | Converted Value |
---|---|---|
MCBX | 1111101001111101 | FA7D |
MCBX | 101011 | 2B |
MCBX | 10 1011 | 020B |
MCXB | 2EA7 | 0010111010100111 |
MCXB | EA7 | 0000111010100111 |
MCXBS | 2EA7 | 0010111010100111 |
MCDR | 1989 | MCMLXXXIX |
MCRD | MX | 1010 |
MCDX | 154 | 9A |
MCXD | AA | 170 |