Accessing data

You specify the variable names that define table columns when the table is created. Specify each variable as either a KEY field or a NAME (non-key) field. You can specify one or more columns (variable names) as keys for accessing the table. For the table shown in Table 1, EMPSER might be defined as the key variable. Or EMPSER and LNAME might both be defined as keys, in which case, a row would be found only if EMPSER and LNAME both match the current values of those variables. A table can also be accessed by one or more argument variables that need not be key variables. You can define the variables that constitute the search argument dynamically by using the TBSARG and TBSCAN services.

In addition, a table can be accessed by use of the current row pointer (CRP). The table can be scanned by moving the CRP forward or backward. A row can be retrieved each time the CRP is moved. When a table is opened, the CRP is automatically positioned at TOP, ahead of the first row. Table services, such as TBTOP, TBBOTTOM, and TBSKIP are available for positioning the CRP.

When a row is retrieved from a table, the contents of the row are stored in the corresponding dialog variables. When a row is updated or added, the contents of the dialog variables are saved in that row.

When a row is stored, a list of extension variables can be specified by name. These extension variables, and their values, are added to the row. Thus, variables that were not specified when the table was created can be stored in the row. A list of extension variable names for a row can be obtained when the row is read. If the list of extension variables is not specified again when the row is rewritten, the extensions are deleted.

ISPF Table Services treat blank data and NULL (zero-length) data as equal. For example, these VDEFINES are executed:
"ISPLINK('VDEFINE ','(V1)',VAL1,'CHAR ',L8,' NOBSCAN ')"
"ISPLINK('VDEFINE ','(V2)',VAL2,'CHAR ',L8)"

If L8 = 8, VAL1 = 'ABCD    ' and VAL2 = 'ABCD    ', V1 will have a length of 8 and a value of 'ABCD    ', and V2 will have a length of 4 and a value of 'ABCD'. To ISPF, V1 and V2 will be equal because before ISPF compares two values, it pads the shorter value with blanks so that the lengths are equal.

If the same VDEFINES are done with VAL1 = '        ' and VAL2 = '        ', V1 will have a length of 8 and a value of '        ' (8 blanks), and V2 will have a length of 0 (NULL value). To ISPF, V1 is EQUAL to V2, because ISPF will pad V2 with 8 blanks before doing the comparison to V1.