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



Bob cozzi wrote:

Is this a "what's wrong with this picture" problem? Sorry, couldn't resist. <g>

To answer your question: SortA does not and probably will never sort data
structures.
The new %SORT() built-in function will sort data structure arrays, however
that won't be out until (at least) V5.3. The cool thing about %SORT() is
that IBM may be able to include the data structure subfield sort
capabilities, and I'm hoping they will, so you could do something like this:
  %sort(myDS : 'A' : NumElems : 'QTYORD')

Where myDS is the data structure array or array name; 'A' is either 'A' or
'D' for Ascending or Descending; NumElems is the max number of elements to
sort, and 'QTYORD' represents the data structure subfield name that will be
used to sort the data structure. ...

Bob: You're dreaming. There's no %SORT() built-in function in V5R3.


What V5R3 *will* have is a minor enhancement to opcode SORTA, which will allow a fully-qualified name as the Extended-Factor-2 argument. (Currently, only an old-style Factor-2 argument is allowed.) Thus, you can sort array subfields of nested qualified data structures. For example:

SORTA DS(I).SUBF(J).ARRAY;

In addition, you will also be able to sort partial arrays using the new %SUBARR() built-in. For example, to sort just the first 10 elements of an array, you could code:

SORTA %SUBARR(ARRAY:1:10);

(Bob, you'll be happy to hear that these will work in fixed-form calcs, as well as free-form! ;-) )

I agree 110% that there's a need for SORTA (and also %LOOKUP) to handle array data structures. But first we have to decide on a syntax for specifying which subfield to use as the sort key. It may happen eventually, but not for V5R3.

Cheers! Hans



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.