SEARCH
|
Syntax: |
SEARCH(<Name of Index File>, <Kind
of Search>, <Look For>, <Number of Data Records>,
<Case-sensitive>, <Count Only>, <Filename>, <Separator>,
<AND or OR> [,<Random
File> [,<From>, <To>]])
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
Meaning: |
Executes a full-text search in an Index File. SEARCH executes a full text search in the
whole Index File. The data records are searched for <Kind of Search>. <Kind of Search> specifies whether all found
or not found data records are returned. If <Look For> is found and
<Kind of Search> is not 0 or <Look For> is not found and <Kind
of Search> is 0, the complete data record is written into the sequential
file <Filename> in the format RECORD$(<INDEXDATEI>).
Thus with <Kind of Search> = 0 the complementary set is returned, that
are all data records which do not contain <Look For>. If <Random File> = 0 or if the
parameter <Random File> is missing, a sequential file is created in
which the data records are separated from each other by a line feed EBUS_LINEFEED$. If <Random File> = 0 <> 0, a
random file is created, in which the found data records are saved without
line separation. This file type is useful if
the data records contain line feeds (e.g. in text data). If <Number of Data Records> <> 0,
then <Number of Data Records> defines the maximum number of data
records to be found. Once this number is reached the search is terminated. If <Case-sensitive> <> 0, small
and capital letters are distinguished in the search, otherwise not. If <Count Only> <> 0, the found
data records are only counted but not written into the file <Filename>.
<Filename> has no meaning then. <Filename> contains the name of the
file into which the found data records are to be written. If <Filename>
= "", a temporary file is created automatically. The name of this
file is in the variable <Filename> after the SEARCH function has been
called. If <Separator> <> "",
the search proceeds on the assumption that <Look For> contains several
character strings that are to be found. The 1st character of
<Separator> defines the character that separates these strings. <AND
or OR> specifies whether all character strings must be existent or only
one. If <AND or OR> = 1, all character strings must be existent (AND -
operation). If <AND or OR> <> 1, only one of the characters
strings must be existent (OR - operation). . If <Separator> = "", <AND
or OR> does not have any meaning. <From> and <To> define the area
in the data record that is to be searched. If <From> = 0 or <To>
< <From> or if the
parameters <From> and <To> are missing, the whole data
records is searched. SEARCH returns as result the number of found
data records. In the case of an error SEARCH returns the result –1 and the
variables OK and OK2 contain the error code. |
||||||||||||||||||||||||
|
Parameter: |
|
||||||||||||||||||||||||
|
Sample: |
/* Find all data
records which contain Mr FILE$ =
"HELP.DAT" H% = SEARCH(CUSTOMER,1,"Mr",0,0,0,FILE$,"",0) ERRORMES = STR$(H%)
+ " Data records found" /* Find all data
records which do not contain Mr H% = SEARCH(CUSTOMER,0,"Mr",0,0,0,FILE$,"",0) /* Find all data
records which contain Mr and Mrs H% = SEARCH(CUSTOMER,1,"Mr;Mrs",0,0,0,FILE$,";",1) /* Find all data
records which contain Mr or Mrs H% = SEARCH(CUSTOMER,1,"Mr;Mrs",0,0,0,FILE$,";",0) /* Find all data
records which do not contain Mr and
Mrs H% = SEARCH(CUSTOMER,0,"Mr;Mrs",0,0,0,FILE$,";",1) /* Find all data
records which contain neither Mr nor
Mrs H% = SEARCH(CUSTOMER,0,"Mr;Mrs",0,0,0,FILE$,";",0) |
||||||||||||||||||||||||
|
See also: |
|