SET INDEX

SET INDEX

<cOrderBagName list> specifies order bags to be emptied into the order list of the current work area.

ADDITIVE adds order bags to an existing order list.

Description

By default, SET INDEX, without the ADDITIVE clause, clears the currently active order list, and then constructs a new order list from the orders in the specified order bags in the current work area. When several order bags are opened, the first order in the first order bag becomes the controlling order (has focus). The record pointer is initially positioned at the first logical identity in this order.

If an order list exists when you SET INDEX … ADDITIVE, the orders in the new order bag are added to the end of the order list. The previous controlling order continues to be the controlling order.

If no order list exists when you SET INDEX … ADDITIVE, the first order in the first order bag in <cOrderBagName list> becomes the controlling order.

During database processing, all open orders are updated whenever a key value is appended or changed, unless the order was created using a scoping condition and the key value does not match. To change the controlling order without issuing another SET INDEX command, use SET ORDER or ORDSETFOCUS(). To add orders without closing the currently open orders, use the ADDITIVE clause.

Examples

. This example opens a database and its associated indexes:
USE Sales NEW
SET INDEX TO Sales, Sales1, Sales2
. This example opens an index without closing any indexes that
are already open:
SET INDEX TO Sales3 ADDITIVE