FATS - Fast Access Tree System
Table of Contents
List of Commands
"G" Search Generic

"G" Search Generic


Command string:

CMND$ = "G\{KeyNo}\{FileNo}\{KeyString}"

KeyNoKey number
FileNo File number
KeyString Key value

Purpose:

Gets the record number and key value of the first occurence of the left-justified partial key.

Description:

This command serves like the command  Search (S) the search for a data record over the indicated key value, but no full information of the key is necessary here.
FATS looks up for the first key, which begins with the characters specified over "KeyString".

With the commands  Search Next (N) and  Search Next After (A) you can determine the following data records, but you have to compare the value of "KeyString" with the returned key value each time.

If FATS finds the requested key, it returns the key value in the FATSKEY variable and a errorcode of 0. Otherwise, it returns a nonzero status in the ERRORCODE variable indicating why it cannot find the key:

12There is no key which starts with the characters specified over "KeyString",FATS returns the record number of the adjacent smaller key
13The specified key was not found because it is smaller than all keys in the index file. FATS returns the first key in the file.
15The specified key was not found because it is greater than all keys in the index file. FATS returns the last key in the file.
16There wasn’t inserted any keys into the index file.

Parameters returned:

ERRORCODE:Errorcode or 0 (no error)
RECNO:Record number
FATSKEY:Key value (or KEYADR=address of key)

Example:

CMND$ = "G\1\1\"+KEYSTRING$

 BASIC Example

See also:

 "S" Search; page 4-77


 

© 2008  GCS Software, Udo Gertz