ML and MR Codes

Formatting Decimal Numbers. The ML and MR codes allow special processing and formatting of numbers and dollar amounts. ML left-justifies the data within the masking field, MR right-justifies the data.

Format

M {L | R} [n [m]] [Z] [,] [options] [$] [(format-code)]

Parameter(s)

n

Specifies the number of digits to be printed to the right of the decimal point. If n is omitted or is zero, no decimal point is printed.

m

Specifies that the decimal point is to be moved m places to the left on output. If m is not specified, m = n is assumed.

Z

Indicates that a data value of zero is to be output as null.

.

(comma) Specifies that commas are to be inserted every three digits to the left of the decimal point.

$

Places a dollar sign immediately in front of the first digit of the number.

options

C

Adds CR after negative values.

D

Adds DB after positive values.

E

Encloses negative numbers in angle brackets (< >).

M

Adds a minus sign () after negative values.

N

Suppresses the minus sign on negative numbers.

format-code

$

Places a dollar sign at the beginning of the output field rather than immediately in front of the number.

#n

Specifies that data is to be justified in a column of n blanks. If n is not specified, only one column is displayed.

*n

Specifies that data is to be justified in a column of n asterisks. If n is not specified, only one column is displayed.

%n

Specifies that data is to be justified in a column of n zeros. If n is not specified, only one column is displayed.

Description

Literal strings may also be enclosed in parentheses. The text is printed as specified, with the number being processed right- or left-justified.

NOTE

The justification within the masking field is distinct from the column justification specified by line 9 of an Attribute Definition item.

The ML and MR codes provide capabilities such as:

Example

The example below shows the elements in the conversion code MR24$.

R

Right-justifies the column of figures within the masked field.

2

Specifies that two digits are to be printed after the decimal point.

4

Moves the decimal point four places to the left. Since only two decimal places are to be displayed on output, the amounts are rounded off.

$

Added immediately in front of each amount.

When MR24$ is applied to an attribute containing the unformatted dollar amounts, they are listed in INFO/ACCESS reports in the following output format:

Internal Format

External Format

7270492

$727.05

375026

$37.50

13011344

$1301.13

489975

$49.00

3737373

$373.74

9294239

$929.42

459626

$45.96

199041

$19.90

2688098

$268.81

2365033

$236.50

1960013

$196.00

1125024

$112.50

497488

$49.75

The table below contains sample ML and MR codes.

Data

Code

Output

5824

MR2

58.24

5824

MR2D$

$58.24DB

–5824

MR2E

<58.24>

5824133

MR2,$(*14)

****$58,241.33

5824133

MR2,($*14)

$****58,241.33

5824133

ML(###-##-##)

582-41-33

See Also

Formatting Data

D Code

MT Code

MC Codes

MCDX and MCXD Codes

MX and MY Codes