In most cases you will open a table directly — you know and specify the name of the table you want to open. In some cases you might want to open a table indirectly — you do not know the name of the table you want to open but can determine it programmatically.
A typical example of the latter occurs when a different table may be opened depending on current conditions. For example, you may open one table for typical customers and one or more different tables for atypical customers. If so, you would store the table names of each table (typical and atypical customers) in a separate table, the primary table. Then, depending on conditions, you would direct tableBASE to open the appropriate table by having it find the name of the indirect table by looking for a key in the primary table.
You do this in two steps. First, you define the current conditions (a search argument) using the SI command. You then set a flag in the command area and open the table. tableBASE will apply the search argument to the table of table names (the primary table) to find a matching row, which names the actual table to be opened and then open the correct table. tableBASE assumes that the search argument begins in position nine of each row of the primary table.
To be specific, move the value I into the INDIRECT-OPEN field of xxxx-COMMAND-AREA—an Indirect open will be performed on the next OR or OW command issued. The TABLE field of xxxx-COMMAND-AREA is set to the primary table name by the application before the call to open.
After returning from a successful Open Indirect, the TABLE field of xxxx-COMMAND-AREA contains the indirect (secondary) table name and the xxxx-COMMAND-AREA is ready for retrieval or updating commands to be issued against this indirect table. The value of I set by the application in the INDIRECT-OPEN field is not retained, rather it is reset to low-values so any subsequent operation may be performed with the same xxxx-COMMAND-AREA.
For more information concerning Open Indirect, see Set Indirect (SI), and the example Access a table indirectly.