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


  • Subject: Re: sort a data structure
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Wed, 10 Jan 2001 16:59:50 -0600 (CST)


You can call the qsort() function from the ILE C runtime, which should be
able to do this...

You could also do it with the QLGSORT API.

You could also write your own sort routine.  But this seems kinda silly,
given the other options available.

Depending on how your data structure is set up, you might even be able
to use SORTA to sort it. 

Here's an example from IBM's "ILE RPG/400 Reference"  manual:

      * In this example, the base array has the values aa44 bb33 cc22 dd11 
      * so the overlaid array ARRO has the values 44 33 22 11. 
     D                 DS 
     D ARR                            4    DIM(4) ASCEND 
     D ARRO                           2    OVERLAY(ARR:3) 
     D 

      * After the SORTA operation, the base array has the values 
      * dd11 cc22 bb33 aa44 
     C 
     C                   SORTA     ARRO 



On Wed, 10 Jan 2001, Quazy wrote:

> I have one field that is broken down into three fields with a data 
> structure, I want to sort them by the second field in the data structure.
> 
> Any suggestions?
> 

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.