MP Code - Masked Packed Decimal
The MP code converts packed decimals to unpacked decimal representation for output or decimal values to packed decimals for input.
Input Conversion
Input conversion is valid. Generally, for selection processing you should specify MP codes in atttribute 7 of the data definition item.
Syntax
MP
Comments
The MP code is generally used as an output conversion. On input, the MP processor combines pairs of 8-bit ASCII digits into single 8-bit digits as follows:
- The high order four bits of each ASCII digit are stripped off.
- The low order four bits are moved into successive halves of the stored byte.
- Leading plus signs (+) are ignored.
- Leading minus (-) signs are stored as a four-bit code (D) in the upper half of the first internal digit.
- Leading zeros are added to any odd-packed half.
Recommendation
Do not use packed decimal fields in your application.
When you want to display packed decimal data, you should specify the MP code because packed values do not display in a recognizable format and many packed codes are recognized by terminals as terminal control characters.