This procedure translates data specified in one coded character set to another coded character set by using a translation table. Characters are translated using a one-to-one mapping between two character sets.
For example, a program might translate text from the LATIN1EBCDIC coded character set to the LATIN1ISO coded character set. Refer to the MultiLingual System Administration, Operations, and Programming Guide for a list of the coded character set numbers that are available as inputs to this procedure.
Although there are many character set numbers, there is not a mapping table between every combination of coded character sets. The procedure returns an error indicating the data was not found if you pass two valid coded character set numbers for a table that does not exist. See the MultiLingual System Administration, Operations, and Programming Guide for the mapping tables available as input to this procedure.
Example
This example takes a string encoded in the Latin1EBCDIC coded character set and translates it to the Latin1ISO coded character set. The MultiLingual System Administration, Operations, and Programming Guide can be used to determine that the coded character set number for Latin1EBCDIC is 12 and for 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
DEFINE SOURCE_START = 0 #
,DEST_START = 0 #
,TRANS_LEN = SIZE(SOURCE) #;
FILE OUT(KIND=DISK,UNITS=CHARACTERS,FILEUSE=IO,FILETYPE=0,NEWFILE,
MAXRECSIZE=80,TITLE="OUT/ALGOL/CCSTOCCS_T_TEXT.");
EBCDIC ARRAY SOURCE[0:6]
,DEST[0:6];
INTEGER CCSNUMFROM
,CCSNUMTO
,RESULT;
CCSNUMFROM := 12; %Latin1EBCDIC
CCSNUMTO := 13; %Latin1ISO
REPLACE SOURCE[0] BY "pauelo" FOR TRANS_LEN;
RESULT := CCSTOCCS_TRANS_TEXT(CCSNUMFROM, CCSNUMTO, SOURCE,
SOURCE_START, DEST, DEST_START, TRANS_LEN);
WRITE(OUT,<"RESULT = ",J4>, RESULT);
IF RESULT EQL CS_DATAOKV THEN
WRITE(OUT, <"DEST = ",A7>, DEST);
CLOSE(OUT,LOCK);
END.Output
RESULT = 1 DEST = pañuelo
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. The coded character sets and their numbers are described in the MultiLingual System Administration, Operations, and Programming Guide.
CCSNUMTO is an integer passed to the procedure. This integer contains the number of the coded character set that you are translating to. The coded character sets and their numbers are described in the MultiLingual System Administration, Operations, and Programming Guide.
SOURCE is an EBCDIC array containing the text to translate.
SOURCE_START is an integer that specifies the offset (0 relative) where the translation starts.
DEST is an EBCDIC array in which the translated text is returned.
DEST_START is an integer that specifies the offset (0 relative) where the output text is stored.
TRANS_LEN is an integer that specifies the number of characters in SOURCE to translate, beginning at SOURCE_START.
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_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) |

