XLATE—Translate to and from ASCII (BSAM and QSAM)

The XLATE macro is used to convert the data in an area in virtual storage from ASCII code to EBCDIC code or from EBCDIC code to ASCII code.

Refer to z/OS DFSMS Using Data Sets, for the ASCII to EBCDIC and EBCDIC to ASCII conversion codes. When converting EBCDIC code to ASCII code, all EBCDIC code not having an ASCII equivalent is converted to X'1A'. When converting ASCII code to EBCDIC code, all ASCII code not having an EBCDIC equivalent is converted to X'3F'. Bit 0 is always set to 0 during EBCDIC to ASCII conversion and is expected to be 0 during ASCII to EBCDIC conversion.

The XLATE macro may be issued in 24- or 31-bit addressing mode. When issued in 31-bit addressing mode, all addresses must be valid 31-bit addresses.

The format of the XLATE macro is:

area address—RX-Type Address, symbol, decimal digit, absexp,
(2-12), or (1)
specifies the address of the area to be converted. If issued in 31-bit addressing mode, this area may reside above or below the 16MB line.
length—symbol, decimal digit, absexp, (2-12), or (0)
specifies the number of bytes to be converted.
TO={A|E}
specifies the type of conversion that is requested. If this parameter is omitted, E is assumed. You can specify:
A
specifies conversion from EBCDIC code to ASCII code.
E
specifies conversion from ASCII code to EBCDIC code.
The return codes are shown in Table 1.
Table 1. XLATE Return Codes
Return Code Meaning
0 (X'00') Success
4 (X'04') Zero or negative number of bytes to translate
8 (X'08') Invalid data address