We use cookies to ensure that we give you the best user experience on our website. If you want to find out more about the cookies we use, you can access to our Privacy Policy here. By continuing your visit to our website, we'll assume you consent to our use of cookies.



Technical Information

Application Development Manual | Searching data files

Searching data files


Find data in a data file.


Detailed Description

The SEARCH function returns the record number for the first record in the specified data file for which the specified field matches the specified search string.

Fieldvalue specifies the field variable (specified by FIELD statement) of the target field.
Recordstart specifies the record at which to start. If this parameter is omitted, the BHT starts at record #1, the beginning of the file.

If there are no matches, the function returns 0.


Search the following data file for 4901234567890 in the BARDATA$ field

private result%
private SNO$
private QTY$
private BARDATA$
open "TESTDATA.DAT" as #1                          ' open data file
field #1, 3 as SNO$, 5 as QTY$, 13 as BARDATA$     ' define fields
result% = search(#1, BARDATA$, "4901234567890", 1) ' search
print result%                                      ' displays 3
close #1

Contact us


If you have not registered

The services on this member site are available only for registered customers.

New member reg.