Previous: karvfy Up: ../karrtn.html Next: bibliography
SUBROUTINE KARXLT (TEXT,LOCTXT,LENTXT, # OLD,LOCOLD, NEW,LOCNEW, LEN) Given a string defined by TEXT,LOCTXT,LENTXT, translate characters according to the characters stored in each of the packed strings defined by OLD,LOCOLD,LEN and NEW,LOCNEW,LEN. Each character occurring in OLD(*) has a corresponding character in NEW(*). For example, the statement CALL KARXLT (TEXT,1,LENTXT, 2H<>,1, 2H(),1, 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 3HBAB and NEW(*) contains 3HXYZ, 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. If any of LOCTXT, LENTXT, LOCOLD, LOCNEW, or LEN is less than 1, return occurs immediately with no modification of TEXT(*).