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







Hi All,

     In one of my jobs, I will be processing data from a physical file say
File1. File1 has 3 members. I will select data from the 2 out of 3 members.
Also I have a select criteria (select where File1.field1 = xxxx) to process
the records.

     At present I've created a Logical file over the two members of the PF
with the Select criteria specified in DDS of the LF. This LF I am using in
my RPG. But the job processes 1.3 million records from both the members.
This job runs in batch.

     Our people are suggesting to replace the LF with a OPNQRYF in a driver
CL. So after discussing the pros and cons, I have 2 alternate ways :

Method1
Create a duplicate of File1 in QTEMP using CRTDUPOBJ   without copying the
data so that only the format will be created in QTEMP. Then build OPNQRYF
with the first member with the QRYSLT (selection criteria) with KEYFLD(key
of File1). Then using CPYFRMQRYF, copy the data from this OPNQRYF to
QTEMP/File1 with *ADD option. Close File1.

Do the same for second member also. At the end the QTEMP/File1 contains all
the records satisfying the selection criteria and the data is from the 2
members because we specified *ADD in CPYFRMQRYF.

Then call the RPG.

Method2
 Do a OPNQRYF on File1 with first member and QRYSLT(selection criteria)
KEYFLD( key of File1). Then call the RPG. Dont do SETON  LR in the RPG.
Instead give RETURN. Close File1.

Next do OPNQRYF on File1 with second member and QRYSLT(selection criteria)
KEYFLD(key of File1). Then call RPG. Then close File1.

I have the following questions :

Q1: How does it help in improving the performance of the job if we replace
the LF with OPNQRYFs. At present the job takes 4 hours to complete. Our
main concern is to reduce the job run time. So in this case, improving the
performance means reducing the total job run time.

Q2: Out of the above two methods, which one is reliable, fast?

Q3: In the first method, after OPNQRYF, I am doing CPYFRMQRYF. Certainly it
takes time to copy the records to QTEMP/File1. Also this has to be done for
two members. So the system takes some time to copy the data to QTEMP/File1.
If I dont use this OPNQRYF & CPYFRMQRYF then I can save this copy data
time. Then why shoudl I go for this method when I am having an external
logical file? I am interested to know the advantages and disadvantages of
using the external logical file and a OPNQRYF that is built by Method1.

Q4 : I feel the Method2 is reliable, fast and easy when compared to Method1
and logical files. But I am not sure of any overheads of calling the RPG
twice with different sets of data. Please note that I am not doing SETON
LR so the files will still be opened even after first call to RPG is
finished. I am interested in knowing the advantages of this method.

Can anybody explain me the advantages and disadvantages of these methods
and which one I shoudl prefer? Thanx in advance for any help.

Regards,
Venu


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.