× 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: Sorting an OVERLAY array.
  • From: Joel Fritz <JFritz@xxxxxxxxxxxxxxxx>
  • Date: Thu, 29 Mar 2001 07:48:57 -0800

I see two possible questions here:

1--Sort by compound key
You need a sub field that overlays your two sort keys.  You can then sort
that array with SORTA.  Actually using the entire array as your sort key
would give you the same result because of the order of the key fields in
your example.


2--Two sorts
You can use SORTA to sort by TXSEQ or by TXLIN.

In either case the entire array will be sorted exactly the way you want.
This is one of the nicest features of array overlays.  You'll need to use
the ascend or descend keywords on the D specs.    

> -----Original Message-----
> From: Bartell, Aaron L. (TC) [mailto:ALBartell@taylorcorp.com]
> Sent: Thursday, March 29, 2001 6:50 AM
> To: 'RPG400-L@midrange.com'
> Subject: Sorting an OVERLAY array.
> 
> 
> Here is an array that I need sorted first by TXSEQ and then 
> by TXLIN.  How
> would I go about doing that?
> 
> D                 DS                              INZ
> 
> D TXData                       126    DIM(TXSize)
> 
> D  TXSEQ                         4S 0 OVERLAY(TXData)     
> Detail Line Number
> 
> D  TXLIN                         4S 0 OVERLAY(TXData:5)   
> Text Seq Number
> 
> D  TXTXT                       100    OVERLAY(TXData:9)   Text
> 
> D  TXFONT                        5    OVERLAY(TXData:109) Font Id
> 
> D  TXINK                        10    OVERLAY(TXData:114) Ink Color
> 
> D  TXPNT                         3    OVERLAY(TXData:124) 
> Point Size     
> 
> I am basically wondering if there is an opcode that will sort 
> an array for
> me.  If not I suppose I will have to sort them myself.
> 
> Any help is greatly appreciated,
> 
> Aaron Bartell    
> +---
> | 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
> +---
> 
+---
| 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 ...


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.