REINDEX Command Example

In the following example, ISEXCLUSIVE( ) verifies that the customer table was opened for exclusive use. The table is not reindexed since the one in the current work area was not opened for exclusive use.

cExclusive = SET('EXCLUSIVE')
SET EXCLUSIVE OFF
SET PATH TO (HOME(2) + 'Data\')
OPEN DATA testdata  && Opens the test databsase
USE Customer     && Not opened exclusively
USE Employee IN 0 EXCLUSIVE    && Opened exclusively in another work area

IF ISEXCLUSIVE( )
 REINDEX  && Can only be done if table opened exclusively
ELSE
  WAIT WINDOW 'The table has to be exclusively opened'
ENDIF

SET EXCLUSIVE &cExclusive