
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.
Содержание BHT-BASIC 100 SERIES
Страница 1: ......
Страница 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Страница 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Страница 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Страница 192: ...Chapter 14 Statement Reference 184 Example OPEN master Dat AS 1 FIELD 1 20 AS bar 10 AS ky CLFILE 1 CLOSE 1...
Страница 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...
Страница 349: ...341 Run time errors Error code Meaning 05h Parameter out of the range checktype is out of the range...
Страница 383: ...375 Run time errors Reference Error code Meaning 05h Parameter out of the range Functions LEFT LEN and RIGHT...