TABLE Verb - Data Translation Table

Syntax

TABLE hexstring

Description

The TABLE verb provides a data translation table. The table is used by the TBL() function and the TBL= option invoked during input and output. See the READ and WRITE verbs for additional information. hexstring is any hex constant without the enclosing dollar signs and must be at least one byte long. See String Constants in User's Reference Guide for additional information. TABLE is commonly used to convert ASCII to EBCDIC and vice versa.

PRO/5 uses the first byte of the TABLE as a mask byte when performing the translation. The remainder of the TABLE is used for byte substitution. Each byte of data to be translated goes through the following:

  • The byte is logically ANDed with the mask byte of the table creating a value from 0 to 255.

  • The created value is used as an offset into the substitution part of the TABLE. The character at that offset becomes the translated value.

  • If the offset specified by the value is beyond the end of the TABLE, the offset itself becomes the translated value.

During program execution, PRO/5 skips TABLE statements. TABLE is not permitted in console mode and may not be part of a compound statement, but it may have a line label: for example,

0100 TABLE: TABLE 7F

This TABLE converts all data to low-order ASCII because ANDing any byte with $7F$ produces an offset value between 0 and 127. Because the offset is beyond the end of the table, the translated value is a character between $00$ and $7F$.

Example

The following table may be used to translate from EBCDIC characters to the equivalent ASCII characters.

1000 REM EBCDIC to ASCII conversion (ISO 8859/1)
1010 TABLE FF 00 01 02 03 9C 09 86 7F 97 8D 8E 0B 0C 0D
1010:0E 0F 10 11 12 13 9D 85 08 87 18 19 92 8F 1C 1D 1E
1010:1F 80 81 82 83 84 0A 17 1B 88 89 8A 8B 8C 05 06 07
1010:90 91 16 93 94 95 96 04 98 99 9A 9B 14 15 9E 1A 20
1010:A0 E2 E4 E0 E1 E3 E5 E7 F1 A2 2E 3C 28 2B 7C 26 E9
1010:EA EB E8 ED EE EF EC DF 21 24 2A 29 3B 5E 2D 2F C2
1010:C4 C0 C1 C3 C5 C7 D1 A6 2C 25 5F 3E 3F F8 C9 CA CB
1010:C8 CD CE CF CC 60 3A 23 40 27 3D 22 D8 61 62 63 64
1010:65 66 67 68 69 AB BB F0 FD FE B1 B0 6A 6B 6C 6D 6E
1010:6F 70 71 72 AA BA E6 B8 C6 A4 B5 7E 73 74 75 76 77
1010:78 79 7A A1 BF D0 5B DE AE AC A3 A5 B7 A9 A7 B6 BC
1010:BD BE DD A8 AF 5D B4 D7 7B 41 42 43 44 45 46 47 48
1010:49 AD F4 F6 F2 F3 F5 7D 4A 4B 4C 4D 4E 4F 50 51 52
1010:B9 FB FC F9 FA FF 5C F7 53 54 55 56 57 58 59 5A B2
1010:D4 D6 D2 D3 D5 30 31 32 33 34 35 36 37 38 39 B3 DB
1010:DC D9 DA 9F

See Also

Verbs - Alphabetical Listing