ML [ n [ m ] ] [ Z ] [ , ] [ C | D | M | E | N ] [ $ ] [ F ] [ intl ] [ ( fx ) ]
MR [ n [ m ] ] [ Z ] [ , ] [ C | D | M | E | N ] [ $ ] [ F ] [ intl ] [ ( fx ) ]
The ML and MR codes allow special processing and formatting of numbers and monetary amounts. If the code includes the F or I option, the conversion is monetary, otherwise it is numeric. ML specifies left justification; MR specifies right justification.
If NLS is enabled and the conversion is monetary, the thousands separator comes from the THOU_SEP field of the Monetary category of the current locale, and the decimal separator comes from the DEC_SEP field. If the conversion is numeric, the thousands separator comes from the THOU_SEP field of the Numeric category, and the decimal separator comes from the DEC_SEP field.
When NLS locales are enabled, the <, -, C, and D options define numbers intended for monetary use. These options override any specified monetary formatting. If the conversion is monetary and no monetary formatting is specified, it uses the POS_FMT, NEG_FMT, POS_SIGN, and NEG_SIGN fields from the Monetary category of the current locale.
They are unaffected by the Numeric or Monetary categories. If no options are set, the value is returned unchanged.
| Arguments | Explanation | Note |
|---|---|---|
| Z | Specifies that 0 be output as an empty string. |
|
| , | Specifies that thousands separators be inserted every three digits to the left of the decimal point on output. |
|
| C | Suffixes negative values with CR. |
|
| D | Suffixes positive values with DB. |
|
| M | Suffixes negative numbers with a minus sign ( - ). |
|
| E | Encloses negative numbers in angle brackets ( < > ). |
|
| N | Suppresses the minus sign ( - ) on negative numbers. |
|
| $ | Prefixes a local currency sign to the number before justification. The $ option automatically justifies the number and places the currency sign just before the first digit of the number output. |
|
| F | Prefixes a franc sign ( F ) to the number before justification. (In all flavors except IN2, you must specify F in the conversion code if you want ICONV to accept the character F as a franc sign.) |
|
| intl | An expression that customizes output according to different international conventions, allowing multibyte characters. The intl expression can specify a prefix, a suffix, and the characters to use as a thousands delimiter and as the decimal delimiter. The intl expression has the following syntax: |
|
| [ prefix , thousands , decimal , suffix ] |
||
| The bold brackets are part of the syntax and must be typed. The four elements are positional parameters and must be separated by commas. Each element is optional, but its position must be held by a comma. For example, to specify a suffix only, type [,,,suffix ]. |
||
| prefix | Character string to prefix to the number. If prefix contains spaces, commas, or square brackets, enclose it in quotation marks. | |
| thousands | Character string that separates thousands. If thousands contains spaces, commas, or square brackets, enclose it in quotation marks. | |
| decimal | Character string to use as a decimal delimiter. If decimal contains spaces, commas, or right square brackets, enclose it in quotation marks. | |
| suffix | Character string to append to the number. If suffix contains spaces, commas, or right square brackets, enclose it in quotation marks. | |
| f | One of three format codes: |
|
| # | Data justifies in a field of x blanks. | |
| * | Data justifies in a field of x asterisks ( * ). | |
| % | Data justifies in a field of x zeros. |
The format codes precede x, the number that specifies the size of the field.
You can also enclose literal strings in the parentheses. The text is printed as specified, with the number being processed right- or left-justified.