|
You could use just a single sort procedure and just include the code to cover any of your sorts.
Track what is sorted using global fields and then use those fields in the procedure.
This partial sample code shows a way to track the sorted fields in an array and then use the array of sorted fields in the Sort Procedure used by QSORT.
https://code.midrange.com/6c2f6fdf33.html
The sorting code is mostly complete.
The screen related code is mostly there for general concept.
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Booth Martin
Sent: Friday, December 13, 2019 11:06 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Learning qsort
1. State-up, City-up
2. State-up, City-down
3. State-down, City-up
4. State-down, City-down
5. City-up, State-up
6. City-up,State-down
7. City-down, State-up
8. City-down, State-down
State-up, City-up != City-up,State-up
Here is the practice exercise: A two-column subfile; State & City. Click either heading and sort by that column. Clicking a column heading a second time reverses the sort. Maintain the current sorting order for the non-clicked column. This is the same behavior that we see and are used to in our e-mail folders.
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 [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.