ML and MR codes format numbers and justify the result to the left or right respectively. The codes provide the following capabilities:
ML provides left justification of the result.
MR provides right justification of the result.
n is a number from 0 to 9 that defines the decimal precision. It specifies the number of digits to be output following the decimal point. The processor inserts trailing zeros if necessary. If n is omitted or is 0, a decimal point will not be output.
m is a number that defines the scaling factor. The source value is descaled (divided) by that power of 10. For example, if m=1, the value is divided by 10; if m=2, the value is divided by 100, and so on. If m is omitted, it is assumed to be equal to n (the decimal precision).
Z suppresses leading zeros. Note that fractional values which have no integer will have a zero before the decimal point. If the value is zero, a null will be output.
, is the thousands separator symbol. It specifies insertion of thousands separators every three digits to the left of the decimal point. You can change the display separator symbol by invoking the SET-THOU command. Use the SET-DEC command to specify the decimal separator.
If a value is negative and you have not specified one of these indicators, the value will be displayed with a leading minus sign. If you specify a credit indicator, the data will be output with either the credit characters or an equivalent number of spaces, depending on its value.
$ specifies that a currency symbol is to be included. A floating currency symbol is placed in front of the value. The currency symbol is specified through the SET-MONEY command.
fm specifies a format mask. A format mask can include literal characters as well as format codes. The format codes are as follows:
The justification specified by the ML or MR code is applied at a different stage from that specified in field 9 of the data definition record. The sequence of events starts with the data being formatted with the symbols, filler characters and justification (left or right) specified by the ML or MR code. The formatted data is then justified according to field 9 of the definition record and overlaid on the output field - which initially comprises the number of spaces specified in field 10 of the data definition record.
Input conversion works with a number that has only thousands separators and a decimal point.
In the last example, the leading and trailing parenthesis are ignored.