Table Search Commands

tablesONLINE offers you a variety of ways of moving to specific rows or columns in a table. You may use PF keys, commands, or a mixture of the two. Table 128 summarizes the possibilities.

Table 128. Table Search Commands

Function

PF Key

Entered in Command Line

GETCNT

4

Number of the row to be displayed.

FINDFLD

5

Full or partial name of column/field to display

GETKEY

6

Full or partial key of row to display

GETNEXT

GN

GETPREVIOUS

GP

GETFIRST

GF

GETLAST

GL

Depending on whether you are in the Edit/Browse Table screen (where multiple table rows are displayed) or in the Edit/Browse Row screen (where a single table row is displayed), the above commands will appear to have different effects.

Let’s look at these options more closely.

GETCNT

The GETCNT table search command can be given as a line command, or by pressing the <PF4> key. The GETCNT command retrieves and displays the row that is identified by the count specified in the command line. If no count is specified, the next row in the table will be retrieved. An unsigned number represents the absolute table position of the row. A signed number represents the position relative to the current position in the table, negative to indicate up and positive to indicate down

In the Edit/Browse Table screen, this command will move the row to the Edit/Browse Row screen. In the Edit/Browse Row screen, this command will display the new row. For example, if a table has 100 rows and the last row fetched was number 60, then Table 129 shows some examples of the rows that will be returned based on the number inserted in the command line when <PF4> is pressed.

Table 129. Returned Rows

Initial Row

Argument

Resulting Row

60

None

61

60

10

10

60

+10

70

60

-10

50

60

70

70

60

+70

100

60

-70

1

60

150

100

A specified count that is out of bounds beyond the end of the table positions you at the last row in the table, while a specified count that is out of bounds before the beginning of the table positions you at the first row in the table.

FINDFLD

The FINDFLD table search command can be given as a line command, or by pressing the <P5> key. The FINDFLD command locates the first occurrence (relative to the current position in the table) of the particular field requested and displays it as the first field on the screen.

If you have frozen any fields, the found field will be positioned right after the last frozen field. In the Edit/Browse Table screen, FINDFLD will move the specified column into the first position to the right of any frozen columns. In the Edit/Browse Row screen, FINDFLD will move the specified field to the display line below any frozen fields.

Successive uses of FINDFLD will move you through any subsequent fields that match the criteria specified.

GETKEY

The GETKEY table search command can be given as a line command, or by pressing the <PF6> key. Using GETKEY in an Edit/Browse Table screen moves the row matching the specified key into the second position on the screen. In an Edit/Browse Row screen, using GETKEY displays the row with the matching key in the Edit/Browse Row screen.

When using GETKEY, you may enter several keys in the command line, separated by commas, with the whole list enclosed in quotes. tablesONLINE assembles these into a complete key as required by tableBASE. For example, if the key fields are a 20-character last name and a 20-character first name and “SMITH, JOHN” is given on the command line, then

'SMITH               JOHN                '

with the correct number of padding spaces, will be passed to tableBASE.

Partial keys may also be used with GETKEY as a way of positioning within a table rapidly. For example, “SMITH, JO” will likely locate John Smith. If, however, your company has a Jody Smith, this row will be located instead. This operation will probably position close enough to the desired entry that you can scroll through the table from this point to the required entry.

Note:
Using an entry such as “S, JOHN” is unlikely to be effective. It will find the first entry in the table whose key begins with S.

tableBASE has adopted conventions as to where you will be positioned in the event that a key is not found. Your position in the table depends on the table organization. The rules listed in Table 130 apply in cases where a full key is specified but not found, and, when a partial key is specified.

Table 130. Table Rules

Table Organization

Full Key Given But Not Found or Partial Key Given

Sequential, or Descending

Position in the table where the row would be, if it       existed on the table.

Random or User Ordered

End of the table.

Hash

The position where the hashing algorithm calculates the row would be, if it existed on the table.

Both the GETKEY and GETCNT commands, when used in the Edit/Browse Row screen, first call validation routines on the screen data for the current row. If data errors are detected, the current row will remain on the screen and an error message will be displayed. Any errors must be corrected before you can move to another row. If there are no errors in the data for the current row, the next row will be displayed.