A FOR clause causes a command to act on each record that meets the specified logical condition. FOR clauses have the following syntax:
FOR lExpr
The following example stores low balance
in the alert
field of all records that contain less than 500 in the total
field.
REPLACE ALL alert WITH
"low balance
"FOR total < 500
The following table lists commands in which you can use a FOR clause.
Commands That Use FOR Clauses | ||
APPEND FROM ARRAY | COUNT | LOCATE |
APPEND FROM | DEFINE PAD | RECALL |
AVERAGE | DELETE | REPLACE FROM ARRAY |
BLANK | DISPLAY | REPLACE |
BROWSE | EXPORT | REPORT |
CALCULATE | FOR( ) | SCAN...ENDSCAN |
CHANGE | INDEX | SORT |
COPY TO ARRAY | LABEL | SUM |
COPY TO | LIST |
Using the FOR clause can speed operation of single-table commands. For more information about performance enhancement, see Chapter 15, Optimizing Applications, in the Programmer's Guide.