[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|              SCAN               |
+---------------------------------+
SCAN [NOOPTIMIZE]
        [<scope>] [FOR <expL1>]
        [WHILE <expL2>]
                [<statements>]
        [LOOP]
        [EXIT]
ENDSCAN

-----------------------------------
Moves through a database and conditionally executes commands.
-----------------------------------

SCAN moves through a database file and performs the <statements> for
each record that meets the specified conditions.  Similar to DO WHILE,
SCAN automatically advances the record pointer to the next record and
then tests for the specified conditions.

Comments can be placed after ENDSCAN on the same line - the comments are
ignored during program compilation and execution.

<scope>
        You can include a <scope> of records to scan.  Only the records that
fall within the range of records specified by the scope are scanned.

        The default scope for SCAN is all records.

FOR <expL1>
        If FOR <expL1> is included, the statements are executed for all records
within the <scope> for which <expL1> is true.  Including FOR lets you
filter out undesired records.

        Rushmore will optimize a SCAN FOR query if <expL1> is an optimizable
expression.  For best performance, use an optimizable expression in the
FOR clause.

WHILE <expL2>
        If WHILE <expL2> is included, the statements will be executed for as
long as <expL2> remains true.

<statements>
        FoxPro commands to be executed.

LOOP
        LOOP may be placed anywhere between SCAN and ENDSCAN.  LOOP returns
control directly back to SCAN.

EXIT
        EXIT transfers control outside of the SCAN ... ENDSCAN loop.  The first
command immediately after ENDSCAN is then executed.

NOOPTIMIZE
        To disable Rushmore optimization of SCAN, include NOOPTIMIZE.  For
further information on NOOPTIMIZE, see SET OPTIMIZE in this help
facility or the Rushmore discussion in the FoxPro Developer's Guide.

-----------------------------------

See Also:  DO CASE, DO WHILE, FOR ... ENDFOR

-----------------------------------

See Also: DO CASE DO WHILE FOR ... ENDFOR
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson