FILTER Examples
Example 1 - Simple filtering
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The first FILTER statement limits the data retrieved from the ISAM file to records containing a company name of "Sunbelt" and and ID value of 10. The second FILTER statement limits the ISAM file to records that have a company name containing the string "bel".
Example 2 - Using 'SKIPKEYS=nnn' keyword option
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE;S$CMDLIN //Clears all filtering! |
|
|
|
|
In this example, every other record is skipped.
Example 3 - Using '$SKIPKEYS$[nnn]' string name operator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE;S$CMDLIN //Clears all filtering! |
In this example, every other record is skipped.
Example 4 - Using 'SKIPKEYS=nnn' keyword option
|
. Read IFILE KEY to position in ISI file key tree. | ||
|
. Set SKIPKEYS keyword to skip 20 keys for every READKS. | ||
|
. After first READKS, clear the skip count to read | ||
|
. every record after the first 20 keys have been skipped. | ||
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE, "", SKIPKEYS=20 // Set to skip 20 ISI keys |
|
|
|
|
|
. | ||
|
. Read IFILE KEY to position in ISI file key tree. | ||
|
. Set SKIPKEYS keyword to skip 20 keys for every READKS. | ||
|
. After first READKS, clear the skip count to read | ||
|
. every record after the first 20 keys have been skipped. | ||
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
|
. After the first 20 keys have been, the skip count is cleared | ||
|
. to allow every ISI key to be accessed. | ||
|
| ||
|
|
|
IFILE,"", SKIPKEYS=0 // Explicitly clear skip count |
|
|
|
|
|
|
|
|
Example 5 - Using '$SKIPKEYS$[nnn]' string name operator
|
. Read IFILE KEY to position in ISI file key tree. | ||
|
. Set $SKIPKEYS$ to skip 20 keys for every READKS. | ||
|
. After first READKS, clear the skip count to read | ||
|
. every record after the first 20 keys have been skipped. | ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE, "$SKIPKEYS$[20]" // Set to skip 20 ISI keys |
|
|
|
|
|
| ||
|
. This READKS skips 20 ISI keys and returns the record for | ||
|
. the 21 key. An OVER can be returned if skip count is larger | ||
|
. than the number of keys the remain in the ISI tree. | ||
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
|
. After the first 20 keys have been, the skip count is cleared | ||
|
. to allow every ISI key to be accessed. | ||
|
| ||
|
|
|
IFILE,"$SKIPKEYS$[0]" // Explicitly clear skip count |
|
|
|
|
|
|
|
|
Example 6 - Using 'SKIPONCE=nnn' keyword option
|
. Set SKIPONCE keyword to skip count 1 key (First key!) | ||
|
. Read IFILE by KEY using a skip count. | ||
|
. This example checks for a duplicate key in a single read operation. | ||
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE, "", SKIPONCE=1 // Set to skip 1st key! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example 7 - Using '$SKIPKEYS$[nnn]' string name operator
|
. Set SKIPONCE keyword to skip count 1 key (First key!) | ||
|
. Read IFILE by KEY using a skip count. | ||
|
. This example checks for a duplicate key in a single read operation. | ||
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IFILE, "$SKIPONCE$[1]" // Set to skip 1st key! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![]() |