CNV_TEMPLATE

This procedure returns the requested type of formatting template retrieved from the convention that is specified in CNV_NAME.

This procedure might be used to improve the performance of programs. By retrieving and storing a template to be used in many places, the performance of a program can be improved by eliminating the calls to the CENTRALSUPPORT library.

Example

The following retrieves a monetary editing template from the convention Turkey. The template is returned in TMP_ARY.

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/CNVTEMPLATE.");
  DEFINE MAX_NAME_LEN        = 17#;    % Maximum length of convention
                                       % name
  EBCDIC ARRAY CNV_NAME[0:MAX_NAME_LEN - 1], TMP_ARY[0:47];
  INTEGER TMP_LEN, RESULT;

  REPLACE CNV_NAME BY "TURKEY";
  RESULT := CNV_TEMPLATE(CS_MONETARY_TEMPV, CNV_NAME, TMP_LEN, TMP_ARY);
  WRITE(OUT,<"RESULT  = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
    WRITE(OUT,<"TMP_ARY = ",C48>,TMP_ARY);
  CLOSE(OUT,LOCK);
END.

Output

RESULT  = 1
TMP_ARY =!T[.:0,3]D[,]#N[-]C[T]!

In this call, the parameters have the following meanings:

CS_MONETARY_TEMPV represents an integer that requests the type of template to be returned. It is one of seven options:

Value

Value Name

Template to be Retrieved

0

CS_LONGDATE_TEMPV

Long date

1

CS_SHORTDATE_TEMPV

Short date

2

CS_NUMDATE_TEMPV

Numeric date

3

CS_LONGTIME_TEMPV

Long time

4

CS_NUMTIME_TEMPV

Numeric time

5

CS_MONETARY_TEMPV

Monetary

6

CS_NUMERIC_TEMPV

Numeric

CNV_NAME is an EBCDIC array passed to the procedure that contains the name of the convention that is specified. 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.

TMP_LEN is an integer returned from the procedure that contains the number of characters in TMP_ARY.

TMP_ARY is an EBCDIC array returned by the procedure that contains the requested template.

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_CONVENTION_NOT_FOUNDV (2002)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_DATAOKV (1)

CS_BAD_DATA_LENV (3002)

CS_FAULTV (1001)

CS_BAD_TYPE_CODEV (3006)

CS_SOFTERRV (1002)