Chapter 15. Function Reference
378
Syntax:
SEARCH([#]filenumber,fieldvariable,searchdata
[,startrecord])
Parameter:
filenumber
A numeric expression which returns a value from 1 to 16.
fieldvariable
A non-array string variable.
searchdata
A string expression.
startrecord
A numeric expression which returns a value from 1 to 32767.
Description:
SEARCH
searches a target field specified by
fieldvariable
in a data file spec-
ified by
filenumber
for data specified by
searchdata
, starting from a record
specified by
startrecord
, and then returns the record number where the search
data is found.
•
fieldvariable
is a string variable defined by a
FIELD
statement.
•
searchdata
is the data you are looking for.
•
startrecord
is a record number where the search is to begin in a data file.
The search ends when all of the written records have been searched.
If you omit
startrecord
option, the search begins at the first record (record
#1) of the data file.
• If the search data is not found,
SEARCH
returns the value 0.
• A convenient use for
SEARCH
is, for example, to search for a particular product
name, unit price, or stock quantity in a product master file by specifying a bar
code data to
searchdata
.
• Since the search begins at a record specified by
startrecord
in a data file
and finishes at the last record, sorting records in the data file in the order of fre-
quency of use before execution of this function will increase the searching speed.
SEARCH
File I/O function
SEARCH
Searches a specified data file for specified data, and then returns the record
number where the search data is found.
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...