TRANTAB Procedure

REPLACE Statement

Replaces characters in a translation table with the specified values, starting at the specified position.
Alias: REP
Tip: To save edits, you must issue the SAVE statement.


REPLACE position value-1<…value-n>;

Required Arguments

specifies the position in a translation table where the replacement is to begin. The editable positions in a translation table begin at position decimal 0 and end at decimal 255. To specify the position, you can do either of the following:
  • Use a decimal or hexadecimal value to specify an actual location. If you specify a decimal value, for example, 20, PROC TRANTAB locates position 20 in the table, which is byte 21. If you specify a hexadecimal value, for example, '14'x, PROC TRANTAB locates the decimal position that is equivalent to the specified hexadecimal value, which in this case is position 20 (or byte 21) in the table.
  • Use a quoted character. PROC TRANTAB locates the quoted character in the table (that is, the quoted character's hexadecimal value) and uses that character's position as the starting position. For example, if you specify the following REPLACE statement, the statement replaces the first occurrence of the hexadecimal value for "a" and the next two hexadecimal values with the hexadecimal equivalent of "ABC": replace 'a' 'ABC';
    This action is useful when you want to locate alphabetic and numerical characters but you do not know their actual location. If the quoted character is not found, PROC TRANTAB displays an error message and ignores the statement.
    To edit positions 256 through 511 (table two), follow this procedure:
    1. Issue the SWAP statement.
    2. Issue the appropriate REPLACE statement.
    3. Issue the SWAP statement again to reposition the table.
value-1 <…value-n>
is one or more decimal, hexadecimal, or character constants that give the actual value to be put into the table, starting at position. You can also use a mixture of the types of values. That is, you can specify a decimal, a hexadecimal, and a character value in one REPLACE statement. Editing by Specifying a Decimal Value for Starting Position shows a mixture of all three types of values in the REPLACE statement.