For C programs LIBMAKE can generate declarations for "extract" files, which can be used to present views of the database. An example of using these functions is given in the extract_open() documentation. One of the chief reasons for using the extract file routines is that they can use a sophisticated sort facility that is capable of sorting millions of records using highly effcient algorithms.
To declare records for an extract file, use the
#extract
directive:
#extract
fieldname_1
,
fieldname_2
,
…
fieldname_n
;
where
fieldname_x
is the name of a database field, for example region_code or
name.
You can also specify a fieldname that does not appeaer on the database. In this
case you need to specify the datatype of the field as well, using a datatype
letter (as used in MAKEDB), the number of occurrences (which defaults to 1),
and, for character fields, the length. For example local_address:C:4:30
would result in the extract record containing a field char
local_address[4][30], and local_number:I would declare short local_number.
To define the sort order for the extract file, use the
#sorton
directive:
#sorton
fieldname_1
,
fieldname_2
,
…
fieldname_m
;
where each
fieldname_x
is one of the fieldnames given in the
#extract
directive.