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



IIRC, you pass qsort the address of the beginning of the list and the length
of a list element.  The following has a straight forward description of the
algorithm:

http://linux.wku.edu/~lamonml/algor/sort/quick.html

I know it wasn't obvious to me when I took Data Structures in school.  For a
couple of years I had it memorized in Pascal, but it's long gone now.

> -----Original Message-----
> From: Fisher, Don [mailto:Dfisher@roomstoreeast.com]
> Sent: Tuesday, November 12, 2002 11:33 AM
> To: 'rpg400-l@midrange.com'
> Subject: RE: Sorting a Multi-occurrence data structure
>
>
> Yes, I know, but how does QSORT determine which occurrences
> are passed to
> the RPG procedure for comparison?  Does it make any
> assumptions as to the
> position of the sort field?
>
> For example, say I have a data structure containing four
> fields with values
> as follows that I wish to sort by the third field:
> B 1 DD 5
> A 1 AA 6
> D 2 BB 4
> C 3 CC 2
>
> If I use QSORT, it will presumably send the first two
> occurrences back for
> comparison and my procedure will indicate occurrence one
> should come after
> occurrence two.  Would it then present the third occurrence
> for comparison
> with the first two?
>
> I would think so, but I'm not sure based on what I've read.
>
> Donald R. Fisher, III
> Project Manager
> The Roomstore Furniture Company
> (804) 784-7600 extension 2124
> DFisher@roomstoreeast.com
>
> <clip>
> You provide the procedure that qsort uses to compare elements
> in order to
> sort the list.  The procedure you provide can use any element
> in doing the
> comparison.
> <clip>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
NOTICE:
All e-mail sent to or from this e-mail address will be received or otherwise
recorded by The Sharper Image corporate e-mail system and is subject to
archival, monitoring, review by and/or disclosure to Sharper Image security
and other management. This message is intended only for the use of the
addressee and may contain information that is privileged and confidential.
The contents of this message may contain personal views which are not the
views of The Sharper Image. If you are not the intended recipient,
dissemination of this communication is prohibited.


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.