× 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 Jeff,

The problem I am having is that the Compare routine is accessing more than just the number of entries defined in the IM variable.


I suspect (but can't test it at the moment) that the LIKE on your parameter definition is reproducing the entire MODS, rather than just one occurence of it. (It haas to be SOMETHING like that, since all that's passed to you is a pointer -- how much data you access past that pointer is dependent on your code, not the QSORT API!)

Is there a reason you can't use LIKEDS? That would make your compare() routine much simpler. LIKEDS was introduced in V5R1 (the same release as free format) so it should be available to you.

It'd should also make your code run a ton faster since your compare routine currently copies the data structure each time it's called, which I'm sure is the slowest thing happening in the whole sorting process!

     P Compare         B
     D Compare         PI            10i 0
     D   E1                                likeds(Account_Recap)
     D   E2                                likeds(Account_Recap)
      /free
          select;
          when (E1.Year*100)+E1.Month < (E2.Year*100)+E2.Month;
               return -1;
          when (E1.Year*100)+E1.Month > (E2.Year*100)+E2.Month;
               return 1;
          other;
               return 0;
          endsl;
      /end-free
     P                 E


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.