CCSTOCCS_TRANS_TABLE

This procedure returns a translation table used to translate data appearing in one designated coded character set to another designated coded character set. The result is a one-to-one mapping of the characters.

When an application program performs a high volume of translations, this procedure can be used in combination with the TRANS_TEXT_USING_TTABLE procedure instead of calling the CCSTOCCS_TRANS_TEXT procedure. The translation table from CCSTOCCS_TRANS_TABLE can be retained in working memory. The translation table is then passed as a parameter to TRANS_TEXT_USING_TTABLE. 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 reads input from a text file. The data in this input file is in an international coded character set, but that coded character set is unknown until the EXTMODE of the file is interrogated. The EXTMODE contains the coded character set number of the file. For this example, assume the data in the input file is encoded in Latin1EBCDIC, with a coded character set number of 12. The data is translated from the Latin1EBCDIC coded character set to the Latin1ISO coded character set and then displayed to the terminal (remote file). The MultiLingual System Administration, Operations, and Programming Guide can be used to determine that the coded character set number for Latin1ISO is 13. This number can also be retrieved by calling VALIDATE_NAME_RETURN_NUM with the name Latin1ISO.

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/CCSTOCCS_T_TABLE.");
  FILE INFILE(TITLE="ALGOL/CCSTOCCS_T_TABLE/INFILE.",FILEUSE=IN,
              DEPENDENTSPECS=TRUE);
  ARRAY TTABLE_ARY[0:63]
      ,REC[0:14]
      ,TRANSREC[0:14];

  INTEGER CCSNUMFROM
        ,CCSNUMTO
        ,RESULT;

  OPEN(INFILE);
  CCSNUMFROM:= INFILE.EXTMODE;   %capture the ccs number
  CCSNUMTO:= 13;                 %Latin1ISO
  RESULT:=  CCSTOCCS_TRANS_TABLE(CCSNUMFROM, CCSNUMTO, TTABLE_ARY);
  WRITE(OUT,<"RESULT = ",J4>,RESULT);
  IF RESULT EQL CS_DATAOKV THEN
       BEGIN
       WHILE NOT READ(INFILE, 15, REC) DO
           BEGIN
           REPLACE POINTER(TRANSREC) BY POINTER(REC) FOR 90 WITH
             TTABLE_ARY[0];
           WRITE(OUT, 15, TRANSREC);
           END;
       END
  ELSE
       WRITE(OUT,<"ERROR IN CREATING TRANSLATE TABLE">);
  CLOSE(OUT,LOCK);
END.

Output

RESULT = 1

In this call, the parameters have the following meanings:

CCSNUMFROM is an integer passed to the procedure. This integer contains the number of the coded character set that you are translating from.

CCSNUMTO is an integer passed to the procedure. This integer contains the number of the coded character set that you are translating to.

TTABLE_ARY is a 64-word ALGOL translate table array in which the translate table is returned. For more information, see TRANSLATETABLE Declaration.

RESULT is an integer returned by the procedure. This integer 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. 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_FILE_ACCESS_ERRORV (1000)

CS_COMPLEX_TRAN_REQV (4004)

CS_SOFTERRV (1002)

CS_DATA_NOT_FOUNDV (4002)