ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

DataStructure SORT on two different fields.....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DataStructure SORT on two different fields.....

    So I have a Data structure array. I can sort on one field using the SORTA command with %subarr. Can I add another field WITHOUT combining the two fields together in a one field sort? To basically sorting on two fields or three etc..... Again without combining into one field. If I can in SQL do you have an example?

    Example:
    Code:
    Sorta %SubArr(NOTMODA(*).NOTORDER:1:RRN);
    NOTORDER is a field inside the DS "array"...

  • #2
    To do the sort in RPG, you will have to use the qsort() API. Here's an article by Jon Paris on how to use it: http://www.itjungle.com/2012/01/25/fhg012512-story02/

    Here's an RFE that you can vote for. It is requesting the ability to provide a compare procedure for SORTA. http://www.ibm.com/developerworks/rf...e&CR_ID=115361.

    Comment

    Working...
    X