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



I like to use SQL now. With proper setup, it can be (arguably) faster than doing a straight read. Especially in instances like this.

fkany@xxxxxxxxxxxxxxxxxx wrote:

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.


.





--


-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Wills
mike AT koldark DOT net
http://www.koldark.net

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT/B d- s++:+ a-- C++ UL P+ L+ W++ N K- w PS PE- Y+ PGP- t+ 5 X R+ tv+ b+ DI+ 
D+ G e+ h--- r+++ y?
------END GEEK CODE BLOCK------
RPG+ SV- JAVA DB2+ OS400+ UG-- MI
------END RPG GEEK CODE BLOCK------




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.