[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+------+###################################################################
#+-| SEEK |------------------------------------------------------------+######
#| +------+ The SEEK command searches the controlling index of a |######
#| database file for the first record matching the expression |######
#+---------------------------------------------------------------------+######
##############################################################################
##############################################################################
#+--| Syntax |--------------------+###########################################
#| [<Alias>] SEEK <?-exp> |###########################################
#+--------------------------------+###########################################
##############################################################################
##############################################################################
#######+---| Description |-------------------------------------------+########
#######| If SEEK does not find the matching record, then EOF equals |########
#######| TRUE. Character searches respect the status of the SET |########
#######| EXACT flag. |########
#######| ----------------------------------------------------------- |########
#######| The data type of the SEEK expression and the <Index-alias> |########
#######| expression must match. For character data, the size of the |########
#######| data must match. |########
#######| ----------------------------------------------------------- |########
#######| If the system variable __soft_seek is TRUE, then the record |########
#######| pointer is positioned at the first record that fails the |########
#######| seek rather than at the end of the file. __soft_seek is |########
#######| defined in the data.hdr header file. |########
#######+-------------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * SEEK customer id. |#########
#########| |#########
#########| INPUT "Customer id: " TO cust_name |#########
#########| !customer SEEK id |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * See if two keys exist in different databases |#########
#########| |#########
#########| !records SEEK "Tom Wiesner" |#########
#########| f_rec = found() |#########
#########| |#########
#########| !tapes SEEK "Tom Wiesner" |#########
#########| f_tapes = found() |#########
#########| |#########
#########| !cds SEEK "Tom Wiesner" |#########
#########| |#########
#########| IF found() .AND. f_rec .AND. f_tapes |#########
#########| |#########
#########| {...} |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Use the __soft_seek variable to position the |#########
#########| * record pointer at the record that failed the |#########
#########| * seek, not EOF. |#########
#########| |#########
#########| #include data.hdr |#########
#########| PROCEDURE seek_value |#########
#########| PARAMETERS CONST CHAR seek_char, ALIAS seek_alias, ; |#########
#########| VALUE LOGICAL soft_seek_ok |#########
#########| |#########
#########| __soft_seek = soft_seek_ok |#########
#########| !seek_alias SEEK seek_char |#########
#########| IF found() |#########
#########| {...} |#########
#########| ENDIF |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
LOCATE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson