Previous: chrvfy Up: ../chrrtn.html First: introduction


 (Translate Characters)

 Given  a  character  string  defined  by  "TEXT(*),LENTXT",   translate
 characters according to  the replacements in  the strings  "OLD,LENSUB"
 and "NEW,LENSUB".  If either  LENTXT or LENSUB is  less than 1,  return
 occurs immediately with no action taken.

 Each character occurring  in OLD(*)  has a  corresponding character  in
 NEW(*).  For example, the statement

       CALL CHRXLT (TEXT,LENTXT, '<>', '()', 2)

 will result in each occurrence of  < in TEXT(*) being translated to  (,
 and each > to ).

 The characters in OLD(*)  should be unique. In  case they are not,  the
 translation MUST be according  to the last  occurrence of a  duplicated
 character.  That  is,  if OLD(*)  contains  'BAB' and  NEW(*)  contains
 'XYZ', then A's in the substring will be translated to Y's, and B's  to
 Z's.  This restriction  facilitates implementation  of the  translation
 with an internal lookup table  constructed from the standard  character
 set with changes according to substitutions of OLD characters with  NEW
 characters performed in order from left to right.