TBL
Table Function
This string function returns the results of a translation of another string using a translation table in the same format as the TABLE directive.
Syntax
Section titled “Syntax”TBL ( string-value, table-string [,ERR=line-ref|,ERC=error-code])
TBL ( string-value, TBL= line-ref [,ERR=line-ref|,ERC=error-code])string-value- is any valid string
table-string- is a sequence of bytes. The first byte is a mask, expressed as two hexadecimal digits, that is used as one byte in the logical AND operation with the string-value bytes. This byte is followed by the table, expressed as multiple, two-hexadecimal digits that are used to specify the output for each input byte sequence position after the AND function with the first byte mask. See the description of the TABLE directive for a complete explanation of the operation of this function.
line-ref- for TBL=, specifies the program line number or label containing a TABLE directive that defines the table-string to use for this function. For ERR=, specifies the program line number or label to branch to if an error is produced by this function.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”This function is generally available starting with release level 8.1.
Input/output commands have the ability to convert characters in data records using the TBL= I/O option which points to a TABLE directive. The TBL function provides that same capability when dealing with a string variable rather than a data record.
Refer to the description of TABLE directive for a complete discussion of the operations performed on string-value.
Examples
Section titled “Examples”LET START$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"LET TABLE_STRING$ = $0F 30 31 32 33 34 35 36 37$LET CONVERTED_STRING$ = TBL ( START$, TABLE_STRING$ )results with CONVERTED_STRING$ containing $31 32 33 34 35 36 37 08 09 0A 0B 0C 0D 0E 0F 30 31 32 33 34 35 36 37 08 09 0A$ (spacing is for clarity only).
01000 LET START$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"01010 LET CONVERTED_STRING$ = TBL ( START$, TBL=02000 )02000 TABLE 0F3031323334353637yields the same results as the first example.
See also
Section titled “See also”TABLE directive
From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF