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



There are a lot of pro's and con's to various solutions to this problem. 
And each of them have their place.  Much depends on the size of the file, 
and several other selections.  Choices include:
OPNQRYF
SQL
OPNQRYF
FMTDTA
RGZPFM
and various logical files, to name a few
Shooting from the hip, I would run a few SQL statements that would meet 
your criteria.  And test them while running in debug to see which indexes, 
(or logical files) to build.  Then future performance should be 
acceptable.  Building these access paths will help speed up processing in 
OPNQRYF, SQL, RGZPFM and might even allow you to use traditional I/O in 
RPG.

Rob Berendt
-- 
"They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety." 
Benjamin Franklin 





fkany@xxxxxxxxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
09/17/2003 05:14 PM
Please respond to RPG programming on the AS400 / iSeries
 
        To:     RPG400-L@xxxxxxxxxxxx
        cc: 
        Fax to: 
        Subject:        More Efficient Processing ideas...



Currently my program below reads every single record in the file to see if 
it matches certain criteria before processing a record.  There are 
millions
of records in this file and it takes the program forever to complete.  The 
criteria for checking each record depends on whatever the user enters.  So
far there's
about 5 or 6 criteria it must meet.  1 happens to be a date range, another 
is customer number, billing numbers, etc...  I don't want to create any
logicals since
the criteria can change, but I'd like to have the subprocedure read a file 
that's already sorted.

Would executing an OPNQRYF statement via QCMDEXC before executing the 
subprocedure be the best route?  SQL? other ideas?

     P FILE_PRCS        B
      *
      /FREE

           // Read FB File
           SETLL *LOVAL FILE_A;
           DOU %EOF(FILE_A);
           READ FILE_A;

                // End of File
                IF %EOF(FILE_A);
                LEAVE;
                ENDIF;

                // Validate Record
                IF BLAH BLAH = BLAH BLAH etc...;
                PROCESS_RECORD();
      ELSE;
      ITER;
      ENDIF;

            ENDDO;

      /END-FREE
      *
     P FILE_PRCS        E

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.