|
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. Today you can use the information in this article (follow the link below) to sort the data structure: http://www.mcpressonline.com/mc?1@xxxxxxxxxxxxxxxx@.6ae875db While the article focuses on subfile sorting, it is actually just a technique for sorting data structure (be it an OCCURS or DIM data structure). The article explains the ins and outs of using QSORT with data structures. Bob Cozzi Cozzi Consulting www.rpgiv.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of keblake@xxxxxxxxxxxxxxxxxxx Sent: Monday, December 08, 2003 5:20 PM To: rpg400-l@xxxxxxxxxxxx Subject: SORTA and Data Structure Arrays I have an array defined as follows: D Order1 DS Dim(99) D Qualified D DtlItem 12A Inz('999999999999') D DtlOrdQty 5S 0 Inz(99999) After loading the Array I try to sort the array: C SortA Order1 and I recieve the following compilation error: RNF5159: Factor 2 operand must be an array name for specified operation. I have a feeling I am missing something obvious here. Would someone be kind enough point it out to me? thanks, Kevin E. Blake Highlights For Children I.S. Sr. Staff Specialist 614-487-2706 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.