SSELECT

Top  Previous  Next

 

The SSELECT statement creates a select list containing all record keys from a file sorted into left justified ascending order.

 

 

Format

 

SSELECT file.var {TO list.no} {ON ERROR statement(s)}

 

where

 

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

 

list.nois the select list number of the list to be created. If omitted, select list zero is used.

 

statement(s)are statement(s) to be executed if a fatal error occurs.

 

 

A list of record keys in the file open as file.var is created and stored as an active select list list.no replacing any previously active list. If there are no records in the file, an empty list is created. Keys will be stored in left justified ascending order. The @SELECTED variable is set to the number of records selected.

 

The optional ON ERROR clause is executed in the event of a fatal error. This covers such situations as disk hardware errors and faults in the internal structure of the file.  The STATUS() function will return a value relating to the cause of the error. If no ON ERROR clause is present, a fatal error will result in an abort.

 

Except where the ON ERROR clause is taken, the STATUS() function will return zero.

 

 

 

Use of a Dynamic Array instead of a File Variable

 

For compatibility with Pick style environments, QM also supports a variation on SSELECT where the file.var is replaced by a dynamic array in which each field becomes an entry in the target select list.

 

 

 

Example

 

SSELECT STAFF TO 7

 

This statement creates a sorted list of the records on the file with file variable STAFF and saves it as active select list 7.