CCSTOCCS_TRANS_TABLE_ALT

This procedure returns a coded character set to coded character set translate table. This procedure offers an alternative to the ALGOL translate table.

Example

This example gets the Latin1EBCDIC coded character set to Latin1ISO coded character set translate table. The variable EXPAND is set to CS_EXPAND_HEXV. Therefore, an index into TTABLE_ARY represents the hexadecimal code value of a source character, and the character at that index in the array is the destination character. The MultiLingual System Administration, Operations, and Programming Guide can be used to determine that the coded character set number for Latin1EBCDIC is 12 and the Latin1ISO is 13. These numbers can also be retrieved by calling VALIDATE_NAME_RETURN_NUM with the coded character set names.

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/ALT.");
  EBCDIC ARRAY TTABLE_ARY[0:255];
  INTEGER CCSNUMFROM
        ,CCSNUMTO
        ,RESULT;

  CCSNUMFROM := 12;
  CCSNUMTO := 13;
  RESULT := CCSTOCCS_TRANS_TABLE_ALT(CCSNUMFROM,CCSNUMTO,CS_EXPAND_HEXV,
            TTABLE_ARY);
  WRITE(OUT,<"RESULT = ",J4>,RESULT);
  CLOSE(OUT,LOCK);
  END.

Output

RESULT = 1

In this call, the parameters have the following meanings:

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

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

CS_EXPAND_HEXV is an integer that represents the value of the translate table form. This integer is one of two values:

Type Value

Value Name

Description

0

CS_EXPAND_HEXV

Do not expand

1

CS_EXPAND_HEXTOEBCDICV

Expand

TTABLE_ARY is an EBCDIC array returned from the procedure. TTABLE_ARY contains a translate table in one of two forms, depending on whether CS_EXPAND_HEXV or CS_EXPAND_HEXTOEBCDICV has been chosen. For either choice, the arrays are character oriented. If CS_EXPAND_HEXV is chosen, then the return array is 256 characters. The index into the array 0 through 255 represents the hex code of a source character, and the character at that index in the array is the destination character.

For example, in a standard EBCDIC to ASCII translate table, the 0 through 255 index represents the EBCDIC characters, while the ASCII codes are stored in the array at the proper index.

If CS_EXPAND_HEXTOEBCDICV is chosen, then the return array still represents 256 characters, but it is represented by 512 bytes. The destination characters are expanded from hex to their representation in EBCDIC.

For example, if 00, 01, 02 in the FROM set translates to 04, 6F, 83 in the TO set, then the first six array elements in the TTABLE_ARY will be F0F4 F6C6 F8F3.

The recommended array size is 256 characters if CS_EXPAND_HEXV is chosen. If CS_EXPAND_HEXTOEBCDICV is chosen, the recommended array size is 512.

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. Values returned by this procedure include:

CS_ARRAY_TOO_SMALLV (3001)

CS_DATA_NOT_FOUNDV (4002)

CS_BAD_ARRAY_DESCRIPTIONV (3000)

CS_DATAOKV (1)

CS_BAD_DATA_LENV (3002)

CS_FAULTV (1001)

CS_BAD_TYPE_CODEV (3006)

CS_FILE_ACCESS_ERRORV (1000)

CS_COMPLEX_TRAN_REQV (4004)

CS_SOFTERRV (1002)