FATS - Fast Access Tree System
Table of Contents
List of Commands
"MC" Create Matchcode File

"MC" Create Matchcode File


Command string:

CMND$ = "MC\{FileName}\{Flags}\{FileNo}\{Col1def}[\{Col2def}]"

FileNameFilename, perhaps with an additional path
(e.g. C:/DATA/ARTICLES.FMS or ARTICLES.FMS)
FlagsReserved, not used at the moment
FileNoFile number
Col#defDefinition of data column # (flags, separated by comma).
The content of the corresponding data columns is transferred the commands "MB", "MI" and "MD" later in the order determined by this command.
I#The content of the data column becomes part of search group #. You can combine several columns into a logical search group (e.g. first name, surname).
CThe content of the data column is edited for word overall searching, i.e. a search for "motorca" e.g. finds "motorcar" and "motor caravan"
NNumbers are handled as words, i.e. during a search according to "150", "12150" e.g. is also found.
LThrough this switch, words which are at the beginning of the data column receive higher priority within the result set of a matchcode query, i.e. the data record is set to the beginning of the result set.
K#:#This switch activates the management of a primary key for this matchcode index file. The first value after the "K" is the position of the data column within the key (1 == first part), the second value specifies the length of the data column valid as the key.
S#:#:#The content of the data column becomes part of a sort key and is stored in an external file. The first number behind the "S" specifies the number of the sort key (1-4), the second number the position of the column within the key and the third number the length valid as the sort key.

Purpose:

Define, create and open a Matchcode-Index-File.

Description:

This command creates a matchcode-index file and assigns the file number "FileNo" to it. If a file already exists with the same name it will be deleted.

With this command, the most important query facilities are determined already while creating the matchcode index file. With the search-group flag ("I#"), several logically related data columns can be registered in a common index so that query to this index resp. search group extends automatically over all these columns. A matchcode file manages up to 32 search groups that can be used for joined queries (using the "AND"-operator). It is also possible to register the content of all data columns in only one group. In this case, search group 1 ("I1") must be specified in the definition of every data column.

Example:

Data column Col#defDescription
Customer-IDI1,C,NThe customer number is indexed in the first search group ("I1"). A word overall search is wanted ("C") and numerical constituents of the number should not be treated as numbers ("N"). As a result, "812 3044" are also found in the case of a input of "1230".
SurnameI2The columns "First Name" and "Surname" are indexed in the second search group ("I2").
First NameI2
StreetI3Street, Zip & City become part of the common search group 3 ("I3"), as a result, only one input field for the address is necessary.
ZipI3
CityI3
InformationI4Informations about the customer are indexed in search group 4 ("I4").

The command string of the above example:

CMND$ = "MC\customer.fms\\1\I1,C,N\I2\I2\I3\I3\I3\I4"

After the file was generated with this command, the content of the data columns may be with the command  Build Matchcode (MB) inserted into the matchcode index.

The flag "K#:#" enables the management of a primary key within the matchcode file. FATS normaly only uses the record number during the generation of a result set. In specific situations, if e.g. the physical record number is not known, or does not correspond to the ID specified with the "MB" command, the generation of a primary key becomes necessary. The browser commands then also make in addition to the record- or ID-number this key available via the FATSKEY-variable to the application.
With the use of this flag, FATS generates a supplementary file with the file extension ".FMK" which is used for the sequential storage of the key. A FATS index is managed in addition within the matchcode file. The storage requirement required by the matchcode increases correspondingly.

If you require an alphanumeric sorting of the result set, this can be implemented with the "S#:#:#"-flag. FATS stores the content of the data columns marked with this flag in an external file with the file extension ".FMK" in order to execute a sorting according to a search query by means of this information. However, it is considerably more efficient during use of sequential data resources to carry out sorting the result set within the application, since a double storage of the data columns is avoided by it.

Full path names must be specified using forward slashes (/) instead of Backslashes (\), because FATS normally uses the Backslash character as delimiter.
You may change the delimiters by placing the desired character as the first character of the command string, e.g.. CMND$ = "&MC&C:\ARTICLES.FMS&&1&I1,C&I2". Any character with an Ascii code less then 48 will be accepted.

This command is only supported by the extended version of FATS.

Parameters returned:

ERRORCODE:Errorcode or 0 (no error)
RECNO:Undefined
FATSKEY:Undefined

Example:

Create a file with 3 search groups:

CMND$ = "MC\ARTICLES.FMS\\1\I1\I2\I3"

After the successful generating of the file, you can build up this matchcode index with file number 1 via instruction "Build Matchcode".

 BASIC Example
 Pascal Example
 C Example

See also:

 "MB" Build Matchcode; page 4-52
 "MS" Search in Matchcode; page 4-75


 

© 2008  GCS Software, Udo Gertz