SETLEFT, SETRIGHT

SETLEFT, SETRIGHT

Top  Previous  Next

 

The SETLEFT and SETRIGHT statements set the scanning position of an alternate key index at the extreme left or right of the data.

 

 

Format

 

SETLEFT index.name FROM file.var

SETRIGHT index.name FROM file.var

 

where

 

index.nameis the name of the alternate key index to be processed.

 

file.varis the file variable associated with an open file.

 

 

The SETLEFT and SETRIGHT statements are used with SELECTLEFT and SELECTRIGHT to set the scan position to the first or last entry in an alternate key index.

 

 

The STATUS() function returns zero if the operation is successful, non-zero if it fails because the index does not exist.

 

 

Examples

 

SETLEFT 'POSTCODE' FROM CLIENTS.FILE

LOOP

  SELECTRIGHT 'POSTCODE' FROM CLIENT.FILE SETTING POSTCODE

UNTIL POSTCODE[1,1] >= 'N'

  CRT POSTCODE

REPEAT

 

This program displays a list of all postcodes commencing with a letter in the first half of the alphabet.

 

 

See also:

SELECTINDEX, SELECTLEFT, SELECTRIGHT