Select the controlling order
SET ORDER TO [<nOrder> | [TAG <cOrderName>]
TAG is an optional clause that provides compatibility with RDDs that
access multiple-order order bags. You must use this keyword anytime you
<cOrderName> is the name of an order, a logical arrangement of a
database according to a keyed pair. This order will become the
controlling order in the order list. If you specify <cOrderName>, you
must use the keyword TAG.
Note: This differs from dBASE and FoxPro where TAG is totally
<nOrder> is the number of the target order in the order list. You
may represent the order as an integer or as a character string enclosed
IN <xcOrderBagName> is the name of a disk file containing one or
more orders. You may specify <xcOrderBagName> as the file name with or
without the path name or appropriate extension. If you do not include
the extension as part of <xcOrderBagName>, Clipper uses the default
extension of the current RDD.
When you SET ORDER TO a new controlling order (index), all orders are
properly updated when you either append or edit records. This is true
even if you SET ORDER TO 0. After a change of controlling order, the
record pointer still points to the same record.
SET ORDER TO 0 restores the database access to natural order, but leaves
all orders open. SET ORDER TO with no arguments closes all orders and
empties the order list
Though you may use <cOrderName> or <nOrder> to specify the target order,
<nOrder> is only provided for compatibility with earlier versions of
Clipper. Using <cOrderName> is a surer way of accessing the correct
order in the order list.
If you supply <xcOrderBagName>, only the orders belonging to
<xcOrderBagName> in the order list are searched. Usually you need not
specify <xcOrderBagName> if you use unique order names throughout an
To determine which order is the controlling order use the ORDSETFOCUS()
In RDDs that support production or structural indices (e.g., DBFCDX),
if you specify a tag but do not specify an order bag, the tag is created
and added to the index. If no production or structural index exists, it
will be created and the tag will be added to it. When using RDDs that
support multiple order bags, you must explicitly SET ORDER (or
ORDSETFOCUS()) to the desired controlling order. If you do not specify
a controlling order, the data file will be viewed in natural order.
SET ORDER can open orders in a network environment instead of the INDEX
clause of the USE command. Generally, specify USE, and then test to
determine whether the USE succeeded. If it did succeed, open the
associated orders with SET ORDER. See the example below.
USE Customer NEW
IF (! NETERR())
SET ORDER TO Customer
SET ORDER TO "CuAcct" // CuAcct is an Order in Customer
Files Library is CLIPPER.LIB.
See Also: INDEX INDEXORD() SEEK SET INDEX USE