DCTRAN: Translating A Single-Byte or Double-Byte Character to Another

How to:

The DCTRAN function translates a single-byte or double-byte character within a character string to another character based on its decimal value. To use DCTRAN, you need to know the decimal equivalent of the characters in internal machine representation.

The DCTRAN function can translate single-byte to double-byte characters and double-byte to single-byte characters, as well as single-byte to single-byte characters and double-byte to double-byte characters.

Syntax: How to Translate a Single-Byte or Double-Byte Character to Another

DCTRAN(length, source_string, indecimal, outdecimal, output)

where:

length

Double

Is the number of characters in source_string.

source_string

Alphanumeric

Is the character string to be translated.

indecimal

Double

Is the ASCII or EBCDIC decimal value of the character to be translated.

outdecimal

Double

Is the ASCII or EBCDIC decimal value of the character to be used as a substitute for indecimal.

output

Alphanumeric

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks (').

Example: Using DCTRAN to Translate Double-Byte Characters

In the following: