Translate with Table and DBCS Skip (XLATWTDS)


Op Code (Hex) Operand 1 Operand 2 Operand 3
1077 Target Length Table
Operand 1: Character variable scalar.

Operand 2: Binary(4) scalar.

Operand 3: Character scalar.

Bound program access

Built-in number for XLATWTDS is 148. XLATWTDS ( target : address length : address of unsigned binary(4) table : address )

Description

The simple (single byte) characters in the target are translated under control of the translate table, for the length defined by operand 2. The extended (double byte) character portions of the target are bypassed and not translated. The operation begins with the leftmost character of operand 1 and proceeds character-by-character, left-to-right, skipping over any Double byte character (DBCS) data portions.

The target, operand 1, should have double byte character data surrounded by a shift out control character (SO = hex 0E) and a shift in control character (SI= hex 0F). Once a SO character is encountered, the translating of single byte characters halts. The operation will then proceed double byte character-by-double byte character until a SI character is encountered. This shift in character is then used to restart the translating of single byte characters.

The length operand, operand 2, is the number of bytes and must contain a value between 1 and 32,767. For length values outside this range a scalar value invalid  (hex 3203) exception is signaled.

Single byte characters are translated as follows:

The following example shows the step-by-step results of this translate operation. The translate table for this example has the following hex value: C3D406C5D504C1C2C4C5C6C7C8C9C1C6

Hex 05040ED2D2E1E10F03 - Initial target value

Hex 04040ED2D2E1E10F03 - After the 1st character is translated

Hex 04D50ED2D2E1E10F03 - After the 2nd character is translated

Hex 04D50ED2D2E1E10F03 - SO character encountered, skip the DBCS portion

Hex 04D50ED2D2E1E10F03 - Resume translating after SI control character

Hex 04D50ED2D2E1E10FC5 - Translate 9th character

Hex 04D50ED2D2E1E10FC5 - Final target value

The translate table, operand 3, is assumed to be 256 bytes long. If the table is less than 256 characters long, and a target character specifies an offset beyond the end of the table, the resultant characters are obtained from byte locations in the space following translate table. If that portion of the space is not currently allocated, a space addressing violation  (hex 0601) exception is signaled.

This operation only translates the target string and does not validate the double byte portions of the target. For example, if a DBCS portion of the target string is preceded by the Shift Out control character, but missing the closing Shift In character, then an invalid extended character data  (hex 0C12) exception will NOT be signaled. However, the Copy Extended Characters Left-Adjusted With Pad (CPYECLAP) instruction can be used to validate extended character data, if necessary.

Authorization Required

Lock Enforcement

Exceptions

06 Addressing

08 Argument/Parameter

10 Damage Encountered

1C Machine-Dependent

20 Machine Support

22 Object Access

24 Pointer Specification

2E Resource Control Limit

32 Scalar Specification

36 Space Management

44 Protection Violation