<<

Contents

Search

>>

 

GET_FIRST_RECORD

 

 

Function

 

 

Syntax:

GET_FIRST_RECORD(<Name of Index File>[,<Look For>, <Case-sensitive>, <Separator>, <AND or OR>, <Ranges>])

 

<Name of Index File>

= <INDEX FILE>

<Look For>

= <STRING-EXPRESSION>

<Case-sensitive>

= <NUM-EXPRESSION>

<Separator>

= <STRING-EXPRESSION>

<AND or OR>

= <NUM-EXPRESSION>

<Ranges>

= <STRING-EXPRESSION>

 

Meaning:

Reads the first physical data record of an Ebus Index File.

 

If <Look For> is specified, GET_FIRST_RECORD and GET_NEXT_RECORD will return only data records which contain <Look For>.

 

If <Case-sensitive> <> 0, small and capital letters are distinguished in the search, otherwise not.

 

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.

 

<Ranges> specifies the ranges within the data record to look for <Look for>. A range is defined by:

 

<Start position> , <End position>

 

<Start position> and <End position> define the position in the data record beginning from 1. Several ranges have to be separated by ";".

 

GET_FIRST_RECORD and GET_NEXT_RECORD do not read the data records of an index file by a key, but in the order in which the records are physically stored in the data file.

 

The functions GET_FIRST_RECORD und GET_NEXT_RECORD be used in order to read all data records of an Index File with many data records faster than with START and READ-NEXT. GET_FIRST_RECORD and GET_NEXT_RECORD are up to four times as quick as START and READ-NEXT.

 

Note: ON INDEXERROR MACRO and ON READ(<INDEXDATEI>) MACRO are not executed with this function.

 

GET_FIRST_RECORD returns the following results:

 

Result

Meaning

 1

No error

-1

Index File contains no data records.

-2

<Name of Index File> is an JDBC Index File.

 

Parameter:

Name of Index File

Name of Index File

 

Look for

Search string

 

Case-sensitive

<> 0: small and capital letters are distinguished

0: No differentiation between small and capital letters

 

Separator

Separator for several search strings

 

AND oder OR

Operation type with several search strings:

1 = AND

otherwise = OR

 

Ranges

Specifies the ranges within the data record to look for <Look for>.

 

Sample:

H% = GET_FIRST_RECORD(CUSTOMER)

WHILE H% = 1

DO H% = GET_NEXT_RECORD(CUSTOMER)

...

ENDDO

 

/* Seach Smith in CUSTOMER.FIRSTNAME$ and CUSTOMER.LASTNAME$

POS1% = GET_FIELDPOS("CUSTOMER","FIRSTNAME$")

L1%   = GET_FIELDLENGTH("CUSTOMER","FIRSTNAME$")

POS2% = GET_FIELDPOS("CUSTOMER","LASTNAME$")

L2%   = GET_FIELDLENGTH("CUSTOMER","LASTNAME$")

RANGES$ = STRN$(POS1%) + "," + STRN$(POS1% + L1% - 1) + ";"

          STRN$(POS2%) + "," + STRN$(POS2% + L2% - 1)

H% = GET_FIRST_RECORD(CUSTOMER,"Smith",0,"",0,RANGES$)

WHILE H% = 1

DO H% = GET_NEXT_RECORD(CUSTOMER)

...

ENDDO

 

See also:

GET_NEXT_RECORD

START

READ-NEXT

SEARCH