Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
TRANSLATE z/OS TSO/E REXX Reference SA32-0972-00 |
|
>>-TRANSLATE(string---------------------------------------------> >--+----------------------------------------+--)--------------->< '-,-+--------+-+-----------------------+-' '-tableo-' '-,-+--------+-+------+-' '-tablei-' '-,pad-' returns string with each character translated to another character or unchanged. You can also use this function to reorder the characters in string. The output table is tableo and the input translation table is tablei. TRANSLATE searches tablei for each character in string. If the character is found, then the corresponding character in tableo is used in the result string; if there are duplicates in tablei, the first (leftmost) occurrence is used. If the character is not found, the original character in string is used. The result string is always the same length as string. The tables can be of any length. If you specify neither translation table and omit pad, string is simply translated to uppercase (that is, lowercase a–z to uppercase A–Z), but, if you include pad, the language processor translates the entire string to pad characters. tablei defaults to XRANGE('00'x,'FF'x), and tableo defaults to the null string and is padded with pad or truncated as necessary. The default pad is a blank. Here are some examples:
The last example shows how to use the TRANSLATE function to reorder the characters in a string. In the example, the last character of any four-character string specified as the second argument would be moved to the beginning of the string. |
Copyright IBM Corporation 1990, 2014
|