× 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.



This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
>From my experience, the first file in a two-file join should have the
smaller amount of records in it if possible.

The first KEYFLD _MUST_ be from the first file in the OPNQRYF.  When you
switch SELCOPY to the first file, add a new KEYFLD from SELCOPY to the front
of the KEYFLD list.

Do you have a QRYSLT command in the OPNQRYF?  That can make a difference
too.

Run this interactively.  Does it read thru every record in the file?  (Does
it count 20,000, 40,000, etc?)  If yes, it is creating an access path.

In your opinion, should it create an new access path?  If no, keep changing
things to force it to use an access path that already exists.

I think you had the right idea with puting SELCOPY in front.  Try changing
OPNSCOPE from the default to *JOB.  Sometimes that does the trick.

Also, instead of reading the result of OPNQRYF with RPG, try using
CPYFRMQRYF instead.  This will copy to a PF so you can see if the OPNQRYF is
behaving properly.  This isolates the problem to the OPNQRYF and removes any
problems caused by the RPG pgm.

Let us know if any of these ideas help!



-----Original Message-----
From: Richard B Baird [mailto:rbaird@esourceconsulting.com]
Sent: Monday, February 04, 2002 1:55 PM
To: midrange-l@midrange.com
Subject: opnqryf question - opnid, joins, overides, etc.



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

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.