× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



hey all,

I've got a question.  given the following code:

OVRDBF     FILE(FILE1) TOFILE(MYLIB/FILE1) SHARE(*YES)
OVRDBF     FILE(SELCOPY) TOFILE(QTEMP/SELCOPY) SHARE(*YES)

OPNQRYF    FILE((MYLIB/FILE1) (QTEMP/SELCOPY)) +
             FORMAT(MYLIB/FILE1 *ONLY) +
             KEYFLD((*MAPFLD/F1FLD1) (*MAPFLD/F1FLD2)) +
             JFLD((*MAPFLD/F1FLD1 *MAPFLD/F2FLD1 *EQ)  +
                  (*MAPFLD/F1FLD2 *MAPFLD/F2FLD2 *EQ)) +
             MAPFLD((F1FLD1    'FILE1/FLD1    ')  +
                    (F1FLD2    'FILE1/FLD2    ')  +
                    (F2FLD1    'SELCOPY/FLD1  ')  +
                    (F2FLD2    'SELCOPY/FLD2  '))  +
             OPNID(FILE1)

I'm trying to select certain records from FILE1 (over 1M records) by
joining it to SELCOPY (only a reletive few) - outputing to the format of
FILE1, so my RPG program can read it.  the override works nicely to let the
RPG see the results of the query.  The query runs fine but is VERY slow.

Long story, but I don't have an existing access path to locate the records
from file 1 using setll/reade, and I'm not allowed to build logicals over
these files.  I do not have SQL (other than query manager) available.

Now, finally, to my real problem:

I tried reversing the order of the files in the join:

OPNQRYF    FILE((QTEMP/SELCOPY) (MYLIB/FILE1) ) + ....

thinking that because it had only a few records it might build the access
path more efficiently and run faster.

the query still runs, and it appears that it builds the access path more
quickly than the other way around.  but now I've lost the opnqryf/rpg
connection.  the rpg is reading the the whole of FILE1, not the subsetted
records from the opnqryf, even though the override is still in place, and
i've named my OPNID the same.

any ideas?  Thanks,

Rick



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.