VSNTRANSTABLE

This procedure returns a translation table for a designated ccsversion. The type of translation table requested depends on the task to be performed.

Translation tables can be used to perform the following tasks:

  • Translate lowercase letters to uppercase letters.

  • Translate uppercase letters to lowercase letters.

  • Translate any digits 0 through 9 to any alternative digits (that is, one-to-one mapping of 0 through 9 to another representation for those digits).

  • Translate alternative digits to 0 through 9.

  • Determine the escapement direction for each character.

The translation table from VSNTRANSTABLE can be retained in working memory. This translation table can then be used with the REPLACE syntax. This improves performance over a call to VSNTRANS_TEXT. This process can improve performance of an application program that performs a high volume of translations. Because the table is stored in working memory, it does not have to be retrieved each time it is to be used.

Example

This example gets the uppercase to lowercase translate table for the CanadaEBCDIC ccsversion. The translate table is returned in the TTABLE_ARY. The MultiLingual System Administration, Operations, and Programming Guide can be used to determine that the ccsversion number for CanadaEBCDIC is 74. This number can also be retrieved by calling VALIDATE_NAME_RETURN_NUM with the name CanadaEBCDIC.

BEGIN

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

  FILE OUT(KIND=DISK,UNITS=CHARACTERS,FILEUSE=IO,FILETYPE=0,NEWFILE,
           MAXRECSIZE=80,TITLE="OUT/ALGOL/VSNTRANS_TABLE.");
  ARRAY TTABLE_ARY[0:63];
  INTEGER VSN_NUM
        ,RESULT;

  VSN_NUM := 74;
  RESULT := VSNTRANSTABLE(VSN_NUM, CS_UPTOLOWCASEV, TTABLE_ARY);
  WRITE(OUT,<"RESULT = ",J4>, RESULT);
  CLOSE(OUT,LOCK);
END.

Output

RESULT = 1

In this call, the parameters have the following meanings:

VSN_NUM is an integer passed to the procedure. It designates the number of the ccsversion from which the translation table is to be retrieved.

CS_UPTOLOWCASEV represents an integer that requests the translation of uppercase characters to lowercase. It is one of five options:

Parameter Value

Value Name

Translation Task

5

CS_NUMTOALTDIGV

Numeric characters to alternative digits

6

CS_ALTDIGTONUMV

Alternative digits to numeric characters

7

CS_LOWTOUPCASEV

Lowercase characters to uppercase characters

8

CS_UPTOLOWCASEV

Uppercase characters to lowercase characters

9

CS_ESCMENTPERCHARV

Escapement direction for each character

A ccsversion is not required to have a definition for each of these tables. Some of the tables are optional. Options 5, 6, 7, and 8 are not required. A result of CS_DATA_NOT_FOUNDV (4002) might be returned if the table has not been defined for the ccsversion.

TTABLE_ARY is an array returned from the procedure. It contains the translate table. The size of this array must be at least 64 words.

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_FAULTV (1001)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_FILE_ACCESS_ERRORV (1000)

CS_BAD_TYPE_CODEV (3006)

CS_NO_NUM_FOUNDV (3003)

CS_DATAOKV (1)

CS_SOFTERRV (1002)

CS_DATA_NOT_FOUNDV (4002)