Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

TRANSLATE

Example

TRANSLATE returns a character string of the same length as x.

Read syntax diagramSkip visual syntax diagram>>-TRANSLATE(x,y-+----+-)--------------------------------------><
                 '-,z-'
 
x
Character expression to be searched for possible translation of its characters.
y
Character expression containing the translation values of characters.
z
Character expression containing the characters that are to be translated. If z is omitted, it defaults to collate().

TRANSLATE operates on each character of x as follows:

If a character in x is found in z, the character in y that corresponds to that in z is copied to the result; otherwise, the character in x is copied directly to the result. If z contains duplicates, the leftmost occurrence is used.

y is padded with blanks, or truncated, on the right to match the length of z.

Any arithmetic or bit arguments are converted to character.

TRANSLATE does not support GRAPHIC or WIDECHAR data.

TRANSLATE will perform best when the second and third arguments are either literals, named constants declared with the VALUE attribute, or restricted expressions.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)