CNV_SYMBOLS

This procedure returns a list of numeric and monetary symbols defined for a specified convention.

SYMLEN_ARY and SYM_ARY are parallel arrays. Each entry in SYMLEN_ARY specifies the length of the symbol (in characters) in the corresponding entry in SYM_ARY. If an entry in SYMLEN_ARY is 0 (zero), it indicates that the symbol is not defined and the corresponding entry in SYM_ARY is filled with blanks. If an entry in SYMLEN_ARY is not 0 (zero), but the corresponding entry in SYM_ARY is all blanks, then the number of blanks specified by the SYMLEN_ARY entry constitutes the symbol.

The monetary and numeric symbols defined in the monetary and numeric templates for a convention are returned in fixed-length fields in SYM_ARY. Each field is 12 bytes long, except where noted. The following table shows the symbols that are returned in SYM_ARY and the offset of the field in which the symbol is returned for the monetary symbols:

Monetary Symbol

Offset in Bytes

International currency notation

0

National currency symbol

12

Thousands separator

24

Decimal symbol

36

Positive sign

48

Negative sign

60

Left enclosure

72

Right enclosure

84

The following table shows the symbols that are returned and the offset of the field in which the symbol is returned for the numeric symbols:

Numeric Symbol

Offset in Bytes

Thousands separator

96

Decimal symbol

108

Positive sign

120

Negative sign

132

Left enclosure

144

Right enclosure

156

Monetary grouping

168

Numeric grouping

192

The monetary and numeric groupings each occupy two adjacent fields (24 bytes) in SYM_ARY. The monetary and numeric groupings, when present, are character strings consisting of unsigned integers separated by commas. The integers specify the number of digits in each group. They appear exactly as they are declared in the monetary and numeric templates, including embedded commas.

The following table shows the offset in bytes of the fields in the record SYMLEN_ARRAY, which contain the symbol lengths for the monetary and numeric symbols:

Offset

Contains Length of

0

International currency notation

1

National currency symbol

2

Monetary thousands separator

3

Monetary decimal symbol

4

Monetary positive symbol

5

Monetary negative symbol

6

Monetary left enclosure symbol

7

Monetary right enclosure symbol

8

Numeric thousands separator

9

Numeric decimal symbol

10

Numeric positive symbol

11

Numeric negative symbol

12

Numeric left enclosure symbol

13

Numeric right enclosure symbol

14

Monetary grouping

15

Numeric grouping

Example

This example obtains monetary and numeric symbols, monetary and numeric grouping specifications, and the international currency notation defined for the Norway convention.

BEGIN

 $ INCLUDE INTL="*SYMBOL/INTL/ALGOL/PROPERTIES." 10000000 - 49999999

  FILE OUT(KIND=DISK,UNITS=CHARACTERS,MYUSE=IO,FILETYPE=0,NEWFILE,
           MAXRECSIZE=80,TITLE="OUT/ALGOL/CNVSYMBOLS.");
  DEFINE MAX_NAME_LEN        = 17#;    % Maximum length of convention
                                       % name
  ARRAY LINEOUT[0:14];
  EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], SYM_ARY[0:215];
  INTEGER ARRAY SYMLEN_ARY[0:16];
  INTEGER RESULT, TOTAL;

  REPLACE CNV_NAME BY "NORWAY";
  RESULT := CNV_SYMBOLS(CNV_NAME, TOTAL, SYMLEN_ARY, SYM_ARY);
  WRITE(OUT,<"RESULT = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
    BEGIN
    REPLACE LINEOUT BY " " FOR 80;
    WRITE(OUT,80,LINEOUT);
    WRITE(OUT,<"Field Meaning                     Symbols Length   ",
              "Convention Symbols">);
    WRITE(OUT,<"-------------                     --------------   ",
              "------------------">);
    WRITE(OUT,<"International Currency Notation:  ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[0],SYM_ARY[0]);
    WRITE(OUT,<"National Currency Symbol:         ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[1],SYM_ARY[1*12]);
    WRITE(OUT,<"Monetary Thousands Separator:     ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[2],SYM_ARY[2*12]);
    WRITE(OUT,<"Monetary Decimal Symbol:          ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[3],SYM_ARY[3*12]);
    WRITE(OUT,<"Monetary Positive Symbol:         ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[4],SYM_ARY[4*12]);
    WRITE(OUT,<"Monetary Negative Symbol:         ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[5],SYM_ARY[5*12]);
    WRITE(OUT,<"Monetary Left Enclosure Symbol:   ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[6],SYM_ARY[6*12]);
    WRITE(OUT,<"Monetary Right Enclosure Symbol:  ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[7],SYM_ARY[7*12]);
    WRITE(OUT,<"Numeric Thousands Separator:      ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[8],SYM_ARY[8*12]);
    WRITE(OUT,<"Numeric Decimal Symbol:           ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[9],SYM_ARY[9*12]);
    WRITE(OUT,<"Numeric Positive Symbol:          ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[10],SYM_ARY[10*12]);
    WRITE(OUT,<"Numeric Negative Symbol:          ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[11],SYM_ARY[11*12]);
    WRITE(OUT,<"Numeric Left Enclosure Symbol:    ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[12],SYM_ARY[12*12]);
    WRITE(OUT,<"Numeric Right Enclosure Symbol:   ",J4,"             ",
              "   ",C12>,SYMLEN_ARY[13],SYM_ARY[13*12]);
    WRITE(OUT,<"Monetary Grouping Specification:  ",J4,"             ",
              "   ",C24>,SYMLEN_ARY[14],SYM_ARY[14*12]);
    WRITE(OUT,<"Numeric Grouping Specification:   ",J4,"             ",
              "   ",C24>,SYMLEN_ARY[15],SYM_ARY[16*12]);
  END;
  CLOSE(OUT,LOCK);
END.

Output

RESULT = 1

Field Meaning                     Symbols Length   Convention Symbols
-------------                     --------------   ------------------
International Currency Notation:  3                NKR
National Currency Symbol:         3                KR.
Monetary Thousands Separator:     1
Monetary Decimal Symbol:          1                ,
Monetary Positive Symbol:         0
Monetary Negative Symbol:         1                -
Monetary Left Enclosure Symbol:   0
Monetary Right Enclosure Symbol:  0
Numeric Thousands Separator:      1
Numeric Decimal Symbol:           1                ,
Numeric Positive Symbol:          0
Numeric Negative Symbol:          1                -
Numeric Left Enclosure Symbol:    0
Numeric Right Enclosure Symbol:   0
Monetary Grouping Specification:   1                3
Numeric Grouping Specification:    1                3

In this call, the parameters have the following meanings:

CNV_NAME is an EBCDIC array passed to the procedure. It contains the name of the convention to be used to retrieve the monetary and numeric symbols. If this parameter contains all blanks or zeros, the procedure uses the hierarchy to determine the convention to be used. Refer to the MultiLingual System Administration, Operations, and Programming Guide for the list of convention names and the explanation of the hierarchy.

TOTAL is an integer returned by the procedure. It contains the total number of symbols returned.

SYMLEN_ARY is an integer returned by the procedure. It contains the lengths of all symbols being returned in SYMBOLS.

SYM_ARY is an EBCDIC array returned by the procedure. Each element of the array contains blanks or a symbol defined in the monetary and numeric template for the specified convention. The corresponding entry in SYMLEN_ARY contains the length of each symbol.

RESULT is an integer returned by the procedure. It indicates whether or not an error occurred during the execution of the procedure. An explanation of the error result values and messages can be found at the end of this section. The values returned by this procedure include:

CS_ARRAY_TOO_SMALLV (3001)

CS_DATAOKV (1)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_FAULTV (1001)

CS_BAD_DATA_LENV (3002)

CS_INCOMPLETE_DATAV (2004)

CS_CONVENTION_NOT_FOUNDV (2002)

CS_SOFTERRV (1002)