|
Rob, In a nutshell... QSORT is much faster than the SORTA opcode--provided your compare routine (call back) is efficient. The QlgSort and QlgSRTIO APIs may be faster than QSORT but I'm not sure that the extra complexity is what you want. -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx Sent: Tuesday, September 13, 2005 1:49 PM To: rpg400-l@xxxxxxxxxxxx Subject: RE: Sorting a user space Rob, It may be a matter of preference but I would suggest using QSORT. I recently wrote an application with a subfile of customer payment history. Some of the history runs into hundreds of records. The subfile can be sorted on any of about five different columns. I'm not sure if I even figured out how to solve it using an array and a user index would have to be rebuilt for every sort. The way I handled it is when the subfile is loaded I also load each record into a user space. When the user requests a sort a procedure determines which column to sort on and calls QSORT. There is an additional procedure to handle the actual high, low, equal logic for QSORT. The entries are then read from the user space back into the subfile. Very fast and simple. If you are only sorting on one value the array approach would work just fine. I'm now a believer in using QSORT when there could be varying sort criteria. Rick -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of rob@xxxxxxxxx Sent: Tuesday, September 13, 2005 1:34 PM To: RPG programming on the AS400 / iSeries Subject: RE: Sorting a user space I don't see how that would be any easier, or more effective. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.
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 copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.