In the example above, a table definition and the name of the primary and tag tables are required parameters for each call to TBINDX. The table definition consists of several fields, some of which you have to specialize before calling TBINDX, while TBINDX will enter information in other fields.
The following fields comprise TBINDX-DEF:
- NO-OF-ROWS (fullword binary)
Number of valid rows in the primary table (Maximum 2,147,483,648)
This field is maintained by TBINDX. As rows are inserted by TBINDX, it increments this count.
ROW-SIZE (fullword binary)
Specify the number of bytes in each row of the primary table
KEY-SIZE (fullword binary)
Specify the number of bytes in the key (Maximum 256).
KEY-LOCATION (fullword binary)
Specify the number of bytes to left of the key in a row.
MAX-ROWS (fullword binary)
Specify the maximum number of rows which can fit into the primary table (Maximum 2,147,483,648).
TAG-SUBSCRIPT (fullword binary)
This is the current position in the tag table. It is set by the programmer before the call or by TBINDX as a result of a call.
After a search, whether by means of an S, U, or F command, TAG-SUBSCRIPT will be set by TBINDX. If the search resulted in a found condition, TAG-SUBSCRIPT will be equal to the subscript in the tag table of the subscript of the row in the primary table. If the row was not found, TAG-SUBSCRIPT will point to the location in the tag table where the Index to the row in the primary table should be inserted.
In addition, if the row is in the table, (as a result of a successful search or a successful insert) PRIMARY-SUBSCRIPT will be equal to the subscript of the found row in the primary table.
TABLE-ORG (1 byte)
Specify S, D, H, R, or U
S = Sequential ascending
D = Descending sequential
H = Hash
R = Random
U = User controlled
FOUND-CODE (1 byte)
Code returned after Search. Y = found, N = not found
Code returned after Put direct. Y = successful, N = failed
OVERFLOW-CODE (1 byte)
Returned after Insert. Y = overflow, N = no overflow
ACTION (1 byte)
Function to be performed.
S, I, D, E, U, R, P, Q, T, V, F, G, H, or A.
SEARCH METHOD (1 byte)
Specify search method: S, Q, B, C, or H.
S = Sequential
Q = Queued Sequential
B = Binary
C = Bounded Binary
H = Hash
- WORK-FIELD (3 bytes) Default=LOW-VALUES
PRIMARY-SUBSCRIPT (fullword binary)
This is the position in the Data (or primary) table. Set by the programmer before the call or by TBINDX as a result of the call.
A work area of 220 bytes is required by TBINDX. It must be defined as either Field 14 or as Fields 15a-c, as shown below.
Either Field 14:
WORK-AREA (220 bytes) Default=LOW-VALUES
Required except when TABLE-ORG = ‘H’
(See Warnings and restrictions.)
Or one of Fields 15a, 15b & 15c (areas required only when TABLE-ORG = ‘H’):
TAG-TABLE-MAX (fullword binary)
Maximum number of rows which can fit into the Tag Table
WORK-AREA-1 (fullword binary) VALUE +0
This field must be reset to 0 if any changes occur to TAG-TABLE-MAX or TABLE-ORG.
- WORK-AREA-2 (212 bytes.)