CNV_CURRENCYEDIT_DOUBLE

This procedure converts a double-precision integer that represents a currency value to a formatted monetary string. The string contains the currency value with formatting symbols included. The formatting performed by the procedure is done according to the convention specified. The MultiLingual System Administration, Operations, and Programming Guide describes all the conventions and the type of currency formatting associated with each convention.

The procedure might be used to print a report with the numeric and currency formats for the Costa Rican convention (for example, CRC 89.99) or for the Norway convention (for example, NKR 89.99).

Example

The following example converts a double-precision integer and edits monetary symbols from convention Denmark into an EBCDIC string:

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/CUREDITDOUB.");
   DEFINE MAX_NAME_LEN = 17#;  % Maximum length of convention name
   EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1],
   CE_ARY[0:29];
   INTEGER CE_LEN, RESULT, PRECISION;
   DOUBLE AMT;

   AMT := 1234567  0;
   PRECISION := 2;
   REPLACE CNV_NAME BY "DENMARK";
   RESULT := CNV_CURRENCYEDIT_DOUBLE
              (AMT, PRECISION, CNV_NAME, CE_LEN, CE_ARY);
   WRITE(OUT,<"RESULT = ",J4>,RESULT);
   IF RESULT EQL CS_DATAOKV THEN
      WRITE(OUT,<"CE_ARY = ",C30>,CE_ARY);
   CLOSE(OUT,LOCK);
END.

Output

RESULT = 1
CE_ARY = Kr.12.345,67

In this call, the parameters have the following meanings:

AMT is a double-precision integer passed to the procedure. This integer contains the value of the currency.

CNV_NAME is an EBCDIC array passed to the procedure. This array contains the name of the convention to be used to format the currency value. 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 an explanation of the hierarchy.

CE_LEN is an integer returned by the procedure. This integer contains the number of characters in CE_ARY.

CE_ARY is an EBCDIC array returned by the procedure. This array contains the formatted value.

PRECISION is an integer passed to the procedure. This integer specifies the number of digits in AMT to be placed after the decimal symbol.

RESULT is an integer returned by the procedure. This integer indicates whether 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_BAD_ARRAY_DESCRIPTIONV (3000)

CS_CONVENTION_NOT_FOUNDV (2002)

CS_BAD_AMTV (3009)

CS_DATAOKV (1)

CS_BAD_DATA_LENV (3002)

CS_FAULTV (1001)

CS_BAD_PRECISIONV (3038)

CS_SOFTERRV (1002)