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



I am not sure I understand the problem; this solution solves what I understand to be the problem.

Would it be reasonable to load your array in this manner: chain each parm to the sequence file. if %found and the sequence number is <> 0, use the sequence number for the the sort element in the array. Otherwise (Seq# 0 or match not found) make the sort element 999 (or 99?). Then there is no need for maintenance people to have to remember to put in the 999, it is built-in. Once built, sort the array by the sorting sequence.


On 1/31/2014 12:50 PM, Jack Prucha wrote:
I'm looking for ideas and can't think of anything straightforward. I've been tasked with sorting an input parameter (50 element char array) to a rpgle program. We're on 7.1. They are to be sorted based on a sort order in a file keyed by the individual element value. The array could have only one or two elements - the rest blank or all of them filled. Not all the elements are in the file, they can be sorted after the important elements in any order. There's only a few that are order dependent.

So an array like this:

ABC CAR DOG CAT THS THT MOR LES ... ... ... ...

With a sequence file (has many other fields and records not used by this process) like this:
DOG 1
CAT 2
CAR 5
XYZ 6
ABC 0
THT 0
ZZZ 0

Should be processed like this (order after CAR is not important):

DOG CAT CAR THS THT MOR LES ABC

Putting 999 into sortkey of the unimportant elements is a maintenance issue - someone someday will leave it zero and it will sort to the front. Reverse order sorting and setting DOG as 999 is possibility tho easily confusing at first. I'd like to KISS but it has to be reasonably efficient as the program is called constantly from a java web process so someone is waiting on the other end of the enter key.

Any suggestions?

TIA
Jack

This email, including any documents, files, or previous email messages attached to it, has been sent from an email account of College Foundation Inc., (CFI) and may contain confidential, proprietary, or legally privileged information belonging to CFI. If you are not the intended recipient, any dissemination, distribution, or copying of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender by email and destroy the original email and any attachments.


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.