Bruce Johnston Feb 5, '04:
Starting in 4.1 you can use the new Query Event Point, Establish PCF Range, to boost performance where OR conditions are on leading portions of a key field. In the following example, a memory file, MCUST, contains customer master record keys of interest obtained using a prior scolling input...
...
*
* Customer of interest were supplied in an earlier input.
*
BEG READ DAR MCUST HOLD 0 KEY IS MCUST CUSTOMER NO
BEG AT DAR TRANSACT IN DAR MCUST CUSTOMER NO
END AT DAR TRANSACT IN DAR MCUST CUSTOMER NO
BEG READ DAR TRANSACT HOLD 0 KEY IS TRANSACT KEY
GOSUB --- PROCESS QUERY RECORD
END READ DAR TRANSACT
END READ DAR MCUST
...
This is effectively an OR condition for each value of MCUST CUSTOMER NO. You could have additional OR conditions on other key fields by simply cloning the above sequence and then modifying it. I have verified Steve's assertion that you can't end up with the same record selected twice.
Note that the presence of ANY code in this series even something as innocuous as a simple TRAP or comment line will disable the Fast Query which might otherwise occur on design/runtime criteria normally specified though additional selection criteria are honoured. The records acted upon by --- PROCESS QUERY RECORD are simply the only candidates considered for the selection criteria.
|