SEARCH [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
SEARCH
The SEARCH statement starts the database retrieval process for HP
Business BASIC/XL's Database Sort Feature. Functions, built-in as well
as user-defined, can be used in the search condition. When the SEARCH
statement is executed, the data sets contained in the thread list are
accessed in the order and hierarchy specified by the THREAD IS statement.
The data retrieved from each data set are unpacked into the local
variables as defined in the respective IN DATASET statement. For each
type of data sets from the thread list, the search condition is
evaluated. If the search condition is true, the record pointers to the
data set records that have been read are written out to the workfile;
otherwise, they are ignored and the next data set record is searched.
The workfile is a file created and used by the program to store the
record number of the data set items that satisfy the search condition.
You can access this file.
If no search condition is needed, the keyword ALL can be used and all
records are retrieved.
When the SEARCH statement is executed, the workfile can be empty or
nonempty. If the workfile is empty, all data records in the data sets,
mentioned in the threadlist, are searched. If, however, the workfile is
nonempty searching is done only on the records whose pointers are
contained in the workfile. The pointers to those records whose data fail
the search condition are dropped from the workfile.
Syntax
{search_condition}
SEARCH USING line_id; {ALL }
Parameters
line_id Line label on line number that identifies the line on
which a THREAD IS statement is defined.
search_ Any logical expression.
condition
Examples
The following shows the use of the SEARCH statement.
400 SEARCH USING 300; ALL
410 SEARCH USING Thread_list; TRIM$(Name$)="HP" AND Price > 0
MPE/iX 5.0 Documentation