[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-------+##################################################################
#+-| INDEX |-----------------------------------------------------+############
#| +-------+ The INDEX command creates an index file for the |############
#| current alias from a key derived from <Index-alias> |############
#+---------------------------------------------------------------+############
##############################################################################
##############################################################################
#+--| Syntax |-----------------------------------------------------+##########
#| ![<Alias>] INDEX [<C-exp> ALIAS] <Index-alias> [UNIQUE] |##########
#+-----------------------------------------------------------------+##########
##############################################################################
##############################################################################
########+---| Description |-------------------------------------------+#######
########| <C-exp> ALIAS specifies the index file to be created. If |#######
########| this file is not specified, then "<C-exp>.fdx" is used as |#######
########| the filename. |#######
########| ----------------------------------------------------------- |#######
########| UNIQUE |#######
########| |#######
########| Indicates that if two or more fields share a key value, the |#######
########| key with the lowest record number will be inserted into the |#######
########| index file. Once the index file has been created and |#######
########| additional keys are processed, the index file will contain |#######
########| the record with the lowest record number if two or more |#######
########| records have an equal key value. |#######
########| ----------------------------------------------------------- |#######
########| <Index-alias> |#######
########| |#######
########| Identifies the index alias to be associated with the index |#######
########| file. The index alias contains the key expression for the |#######
########| index file. When an index file is opened or created, the |#######
########| index alias expression is used to generate the key. When |#######
########| the index file is created, all filters, relations or open |#######
########| index files associated with the database are suspended or |#######
########| closed. The ORDER is set to 1. FORCE encodes an implicit |#######
########| GOTO TOP after the INDEX command to position the record |#######
########| pointer to the first logical record. |#######
########+-------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Index a file based upon the last name. |#########
#########| |#########
#########| DBFDEF name |#########
#########| CHAR(20) first |#########
#########| CHAR(20) last |#########
#########| ENDDEF |#########
#########| |#########
#########| INDEXDEF |#########
#########| CHAR(20) indexname name->last |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| USE "name.dbf" ALIAS name |#########
#########| INDEX "name.fdx" ALIAS indexname |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * If the alias name has been initialized in a |#########
#########| * previous SET ALIAS <alias name> TO <C-exp> |#########
#########| * you do not have to specify the index file |#########
#########| * in the INDEX command. |#########
#########| |#########
#########| SET ALIAS parts_index TO "c:\data\parts.fdx" |#########
#########| INDEX parts_index |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * If two keys are identical, the UNIQUE flag |#########
#########| * indicates the key with the lowest record |#########
#########| * number is to be placed in the database. |#########
#########| |#########
#########| INDEXDEF |#########
#########| LONG bike_id d->bikes |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| SET ALIAS bike_id TO "useless.dat" |#########
#########| INDEX bike_id UNIQUE && Index file has only |#########
#########| && unique records. |#########
#########| {...} |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 4 |-------------------------------------------+#########
#########| * Use the SET INDEX TO command to order the index |#########
#########| * files. |#########
#########| |#########
#########| INDEXDEF |#########
#########| INT i_one j->a + j->b |#########
#########| INT i_two j->b + j->c |#########
#########| INT i_three->c + j->d |#########
#########| ENDDEF |#########
#########| |#########
#########| {...} |#########
#########| |#########
#########| INDEX i_one |#########
#########| INDEX i_two |#########
#########| INDEX i_three |#########
#########| SET INDEX TO i_one, i_two, i_three |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
CLOSE
GOTO BOTTOM
SET INDEX TO
USE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson