ILE COBOL Programmer's Guide

LC_MONETARY Locale Category

In ILE COBOL, there is a subset of PICTURE-editing symbols for locale-based numeric-edited data items that correspond to definitions that can be made in the LC_MONETARY locale category. These symbols are: 9, ., $, and cs (currency symbol). For more information about these locale-based PICTURE-editing symbols, refer to the WebSphere Development Studio: ILE COBOL Reference. This section describes the LC_MONETARY locale category and relates each of the ILE COBOL locale-based PICTURE-editing symbols to the keywords used to define this locale category.

The LC_MONETARY category of a locale definition source file defines rules and symbols for formatting monetary numeric information. This category begins with an LC_MONETARY category header and ends with an END LC_MONETARY category trailer.

All operands for the LC_MONETARY category keywords are defined as string or integer values. String values are bounded by double-quotation marks (""). All values are separated from the keyword they define by one or more spaces. Two adjacent double-quotation marks indicate an undefined string value. A -1 indicates an undefined integer value. The following keywords are recognized in the LC_MONETARY category:

int_curr_symbol
Specifies the string used for the international currency symbol. The operand for the int_curr_symbol keyword is a four-character string. The first three characters contain the alphabetic international-currency symbol. The fourth character specifies a character separator between the international currency symbol and a monetary quantity. Specifies the string used for the local currency symbol. This keyword is not used by ILE COBOL.

currency_symbol
Specifies the string used for the local currency symbol. In ILE COBOL, this keyword is used along with several other keywords to format the cs locale-based PICTURE-editing symbol. Refer to "p_cs_precedes", "p_sep_by_space", "n_cs_precedes", and "n_sep_by_space".

mon_decimal_point
Specifies the string used for the decimal delimiter used to format monetary quantities. In ILE COBOL, this corresponds to the . locale-based PICTURE-editing symbol.

mon_thousands_sep
Specifies the string used for grouping digits to the left of the decimal delimiter in formatted monetary quantities.

mon_grouping
Defines the size of each group of digits in formatted monetary quantities. The operand for the mon_grouping keyword consists of a sequence of semicolon-separated integers. Each integer specifies the number of digits in a group. The initial integer defines the size of the group immediately to the left of the decimal delimiter. The following integers define succeeding groups to the left of the previous group. If the last digit is not -1, subsequent grouping is performed using the previous digit. If the last digit is -1, grouping is only performed for the number of groups specified.

The following is an example of the interpretation of the mon_grouping keyword. Assuming the value to be formatted is 123456789 and the operand for the mon_thousands_sep keyword is comma (,), the following results occur:

mon_grouping Value
Formatted Value

3;-1
123456,789

3
123,456,789

3;2
12,34,56,789

3;2;-1
134,56,789

positive_sign
Specifies the string used to indicate a nonnegative-valued formatted monetary quantity. In ILE COBOL, this corresponds to the + locale-based PICTURE-editing symbol.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the + locale-based PICTURE-editing symbol. Refer to "negative_sign", "p_sign_posn", and "n_sign_posn".

negative_sign
Specifies the string used to indicate a negative-valued formatted monetary quantity.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the + locale-based PICTURE-editing symbol. Refer to "positive_sign", "p_sign_posn", and "n_sign_posn".

int_frac_digits
Specifies an integer value representing the number of fractional digits (those after the decimal delimiter) to be displayed in a formatted monetary quantity using the int_curr_symbol value. This keyword is not used by ILE COBOL.

frac_digits
Specifies an integer value representing the number of fractional digits (those after the decimal delimiter) to be displayed in a formatted monetary quantity using the currency_symbol value. This keyword is not used by ILE COBOL.

p_cs_precedes
Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string precedes or follows the value for a non-negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that the currency symbol follows the monetary quantity.

1
Indicates that the currency symbol precedes the monetary quantity.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the cs locale-based PICTURE-editing symbol. Refer to "currency_symbol", "p_sep_by_space", "n_cs_precedes", and "n_sep_by_space".

p_sep_by_space
Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string is separated by a space from a non-negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that no space separates the currency symbol from the monetary quantity.

1
Indicates that a space separates the currency symbol from the monetary quantity.

2
Indicates that a space separates the currency symbol and the positive_sign string, if adjacent.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the cs locale-based PICTURE-editing symbol. Refer to"currency_symbol", "p_cs_precedes", "n_cs_precedes", and "n_sep_by_space".

n_cs_precedes
Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string precedes or follows the value for a negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that the currency symbol follows the monetary quantity.

1
Indicates that the currency symbol precedes the monetary quantity.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the cs locale-based PICTURE-editing symbol. Refer to "currency_symbol", "p_cs_precedes", "p_sep_by_space", and "n_sep_by_space".

n_sep_by_space
Specifies an integer value indicating whether the int_curr_symbol or currency_symbol string is separated by a space from a negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that no space separates the currency symbol from the monetary quantity.

1
Indicates that a space separates the currency symbol from the monetary quantity.

2
Indicates that a space separates the currency symbol and the negative_sign string, if adjacent.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the cs locale-based PICTURE-editing symbol. Refer to "currency_symbol", "p_cs_precedes", "p_sep_by_space", and "n_cs_precedes".

p_sign_posn
Specifies an integer value indicating the positioning of the positive_sign string for a non-negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that parenthesis enclose both the monetary quantity and the int_curr_symbol or currency_symbol string.

1
Indicates that the positive_sign string precedes the quantity and the int_curr_symbol or currency_symbol string.

2
Indicates that the positive_sign string follows the quantity and the int_curr_symbol or currency_symbol string.

3
Indicates that the positive_sign string immediately precedes the int_curr_symbol or currency_symbol string.

4
Indicates that the positive_sign string immediately follows the int_curr_symbol or currency_symbol string.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the + locale-based PICTURE-editing symbol. Refer to "positive_sign", "negative_sign", and "n_sign_posn".

n_sign_posn
Specifies an integer value indicating the positioning of the negative_sign string for a negative formatted monetary quantity. The following integer values are recognized:

0
Indicates that parenthesis enclose both the monetary quantity and the int_curr_symbol or currency_symbol string.

1
Indicates that the negative_sign string precedes the quantity and the int_curr_symbol or currency_symbol string.

2
Indicates that the negative_sign string follows the quantity and the int_curr_symbol or currency_symbol string.

3
Indicates that the negative_sign string immediately precedes the int_curr_symbol or currency_symbol string.

4
Indicates that the negative_sign string immediately follows the int_curr_symbol or currency_symbol string.
Note:
In ILE COBOL, this keyword is used along with several other keywords to format the + locale-based PICTURE-editing symbol. Refer to "positive_sign", "negative_sign", and "p_sign_posn".

Producing Unique Monetary Formats--Example

A unique customized monetary format can be produced by changing the value of a single statement. For example, the following table shows the results of using all combinations of defined values for the p_cs_precedes, p_sep_by_space, and p_sign_posn statements:

Table 10. Results of Various Locale Variable Value Combinations


p_sep_by_space
2 1 0
p_cs_precedes = 1 p_sign_posn = 0 ($1.25) ($ 1.25) ($1.25)
p_sign_posn = 1 + $1.25 +$ 1.25 +$1.25
p_sign_posn = 2 $1.25 + $ 1.25+ $1.25+
p_sign_posn = 3 + $1.25 +$ 1.25 +$1.25
p_sign_posn = 4 $ +1.25 $+ 1.25 $+1.25
p_cs_precedes = 0 p_sign_posn = 0 (1.25 $) (1.25 $) (1.25$)
p_sign_posn = 1 +1.25 $ +1.25 $ +1.25$
p_sign_posn = 2 1.25$ + 1.25 $+ 1.25$+
p_sign_posn = 3 1.25+ $ 1.25 +$ 1.25+$
p_sign_posn = 4 1.25$ + 1.25 $+ 1.25$+

LC_MONETARY--Example

The following is an example of the LC_MONETARY category listed in a locale definition source file:

      LC_MONETARY
      #
      int_curr_symbol    "<U><S><D>"
      currency_symbol    "<dollar-sign>"
      mon_decimal_point  "<period>"
      mon_thousands_sep  "<comma>"
      mon_grouping       3;-1
      positive_sign      "<plus-sign>"
      negative_sign      "<hyphen>"
      int_frac_digits    2
      frac_digits        2
      p_cs_precedes      1
      p_sep_by_space     2
      n_cs_precedes      1
      n_sep_by_space     2
      p_sign_posn        3
      n_sign_posn        3
      #
      END LC_MONETARY


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]