User-defined conversion tables

If you specify SRVERCP=USR or USRD in a DFHCNV TYPE=ENTRY macro, you must provide user-defined conversion tables. The standard conversion program (DFHCCNV) uses these tables, and they are made available to the user-replaceable conversion program, DFHUCNV.

Place your user-defined conversion tables in the DFHCNV macro source, anywhere after the DFHCNV TYPE=INITIAL macro.
Tip: For source readability, the best place is probably after the DFHCNV TYPE=FINAL macro.

SRVERCP=USR

You must provide two character conversion tables, labelled ASTOEB and EBTOAS.

Each table must be 256 bytes long. ASTOEB is used for ASCII to EBCDIC conversion and EBTOAS is used for EBCDIC to ASCII conversion. The hexadecimal value of a character byte is used as an offset in the conversion table to obtain the converted value of the character. Figure 1 illustrates this process.

Figure 1. Structure of SBCS conversion tables
The picture shows two conversion tables, labeled ASTOEB and EBTOAS. The tables are numbered X'0 to X'F along both axes, giving 256 possible values for each table.In the example, the ASCII character X'47 converts to the EBCDIC character X'A3 and the EBCDIC character X'BC converts to the ASCII character X'23. (X'4 along the vertical axis and X'7 along the horizontal axis of the ASTOEB table gives the EBCDIC value X'A3. X'B along the vertical axis and X'C along the horizontal axis of the EBTOAS table gives the ASCII value X'23.)

SRVERCP=USRD

You must provide DBCS character conversion tables labelled DBASTOEB and DBEBTOAS, in the DFHCNV source. These must be after the DFHCNV TYPE=INITIAL macro, but otherwise anywhere in the source. Each table must be a list of 256 four-byte pointers and 256 pairs of 256-byte translate tables. The first byte of a DBCS character is used as an index to the list of pointers. Using the first byte of the DBCS character as a hexadecimal offset in the list, the pointer found is the address of a pair of 256-byte translate tables. The second byte of the DBCS character is used as an offset in each of the two 256-byte translate tables to obtain the first and second bytes of the converted DBCS character. Figure 2 illustrates this process.

You must also provide an SBCS conversion table as specified previously under USR.
Figure 2. Structure of DEBUTS conversion tables
The picture shows part of a DBCS character conversion table labelled DBASTOEB. Ii consists of a list of 256 4-byte pointers, labelled X'00 to X'3FC, and a pair of 256-byte translate tables. In the example, the double-byte ASCII character X'6AE9 converts to the EBCDIC character X'CC22. The value at offset X'6A in the pointer list is the address of this pair of translate tables. At offset X'E9 in these tables, the byte values are X'CC and X'22.