| abbreviated version 2727
Background: Has a file TOTO.DAT defined by form TOTO, with the key
field TOTO_KEY.
(MY NOTE: TOTO was originally used in the note 2727, it has nothing to
do with previous replies!)
The following gives a keyed search:
FOR TOTO WITH TOTO_KEY EQS "a key value" DO something
The following gives a sequential search:
FOR TOTO WITH TOTO_KEY GTS "lower value" AND TOTO_KEY LTS "uppdr"
DO something.
2727.1
You must use BEGINNING, EQS or ENS.
Try this:
FOR FIRST TOTO WITH TOTO_KEY = "lower" DO save_the_key
Then use GET TOTO.%NEXT[saved_key]
2727.2
Question: How to do keyed access on secondary keys?
2727.3
You have to supply the secondary keys's name in the FDL file. If
it is in quotes supply the quotes.
Note: ANAL/RMS/FDL adds quotes. You should use TPU, EDT to remove
them if you do not wish to.
2727.4
A discussion on how in BEV 2.1 the quotes are not required, if you
use uppercase characters in the DSR as well as in the FDL-Editor.
|
| More on this from my notebook: Jeff Nester @KXO
Background: has an indexed file with 8 keys and duplicates everywhere.
The following does a keyed search:
SELECT FOR WHOIS_MAP:UC_LNAME WITH .US_LNAME = LATS_NAME AND
.FIRST_NAME = FIRST_NAME DO DISPLAY STUFF/STYLE=CHOICE
When he adds just one more field on the search it become sequential.
SELECT FOR WHOIS_MAP:UC_LNAME WITH .US_LNAME = LATS_NAME AND
.FIRST_NAME = FIRST_NAME AND USER_ID = USER_ID
DO DISPLAY STUFF/STYLE=CHOICE
Things to check: To open a file with multiple keys you must
specify the file and FDL file in the entry form. A reminder
on using the name as it appears in the FDL for the keyed
field.
The above re_inforced previous discussions on a blank field and/or
input for a field not supplied by the user.
More explanation: If your RSE uses Boolean expressions that require
the evaluation of that field with the RSE, and you leave it blank --
espically if your RSE uses the "=" or "BEGINNING" -- ALL-IN-1 *must*
do a sequential search of the entire file. To put it another way:
it is doing a keyed search - with a blank field all records match,
thus it does a sequential search.
F
More information from Brad, SSM developement: A boolean "begining with"
does keyed access if the filed is not blank. Use an argument form to
get all the fields then build your FOR.
An alternative is to use something like this:
get #op = "="
.IF arg_field2 ENS "" THEN GET #op = "ENS"
GET OA$FUNCTION = 'FOR dsr:kor WITH .kor = arg_field1 AND -
.dsr_field2 ' #op ' arg_field2 DO mumble'
|