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



As far as I can see, the code in the answer does not add the values together.

I would do something like this ...

D Specs
DS
zarray 6 dim(4) ascend
acc 3 overlay(zarray)
sum$ 3 overlay(zarray: *next)

C specs
sorta acc;
for x = 1 to 3;
y = *zeros;
z = x + 1;
y = %lookup(acc(x): acc: z);
if y > *zeros;
sum$(x) += sum$(y);
sum$(y) = *zeros;
acc(y) = *blanks;
endif;
endfor;

Regards,
John McKay
www.mckaysoftware.ie
www.rpglanguage.com


----- Original Message ----- From: "David FOXWELL" <David.FOXWELL@xxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, November 14, 2008 8:15 AM
Subject: SORTA


Hi,

Just curious about this question at

http://itknowledgeexchange.techtarget.com/itanswers/sorting-arrays-using-alternate-properties/?track=NL-177&ad=673287&asrc=EM_NLN_5020407&uid=5715235


One wants to get from
acc sum($)
c08 100
c02 200
c01 256
c08 300

To
acc sum($)
c01 256
c02 200
c08 400


I didn't see how the values of c08 were added together. Did I miss something? Is it easily possible (without reading and looping)?




P Pensez à l'environnement avant d'imprimer ce message


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.