|
Hello All, Thanks for all your responses. I have gone through quite a few articles by most of the high profile authors which included options of using User Space & QSORT. This application does not require such 'heavy' programming which is why I decided to go with the simplest - SORTA. I have used the suggestion by Jon only in a different way - not sure if it is the right way but it seems to work. The numeric fields are basically document numbers & will never be signed. D wItmDtlDS DS Inz D wItmDtl Dim(250) D wwbcd 3a Overlay(wItmDtl) D wwccd 2a Overlay(wItmDtl:*NEXT) D wjtce 1a Overlay(wItmDtl:*NEXT) D walnb 6s 0 Overlay(wItmDtl:*NEXT) D wbdnb 3s 0 Overlay(wItmDtl:*NEXT) D waonb 4s 0 Overlay(wItmDtl:*NEXT) D watnb 3s 0 Overlay(wItmDtl:*NEXT) D wgncd 4a Overlay(wItmDtl:*NEXT) D wexpc 4s 2 Overlay(wItmDtl:*NEXT) D wpvat 1a Overlay(wItmDtl:*NEXT) D wSortFld 22a Overlay(wItmDtl) Thanks again. Ewart This e-mail is confidential and it is intended only for the addressees. Any review, dissemination, distribution, or copying of this message by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message from your system. The sender does not accept liability for any errors or omissions in the contents of this message which may arise as a result of the e-mail transmission. "Jon Paris" <Jon.Paris@xxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 02/15/2007 08:54 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To <rpg400-l@xxxxxxxxxxxx> cc Subject RE: Sorting an array on multiple keys using SORTA
I would like to sort the following array on the first 7 fields i.e.
from WWBCD through WATNNB. Is it possible using SORTA ??? Yes - it should be work with a group field. The following example verifies so it should compile etc. but I have no time to test it. If you have this kind of requirement on an regular basis I would take the time to learn qsort if I were you. There are limits to what groups fields can do with Sorta. This is what it should look like: D wItmDtlDS DS Inz D wItmDtl Dim(250) D first7 Overlay(wItmDtl) D wwbcd 3a Overlay(first7) D wwccd 2a Overlay(first7:*NEXT) D wjtce 1a Overlay(first7:*NEXT) D walnb 6s 0 Overlay(first7:*NEXT) D wbdnb 3s 0 Overlay(first7:*NEXT) D waonb 4s 0 Overlay(first7:*NEXT) D watnb 3s 0 Overlay(first7:*NEXT) D wgncd 4a Overlay(wItmDtl:*NEXT) D wexpc 4s 2 Overlay(wItmDtl:*NEXT) D wpvat 1a Overlay(wItmDtl:*NEXT) /Free sorta first7; // Sort first seven fields sorta waonb; // Just sort one within the group of 7 (Canadian reference!) Jon Paris Partner400 www.Partner400.com -- 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.