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



Could you just ignore the records in the sequence file that don't have a
sequence number?

I envisage reading the file one time in sequence number order, omitting
records with no sequence number, and building an array in your program.
Then process the array (for the number of elements you noted when
building it), take the value and see if it is your input parm.

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jack Prucha
Sent: Friday, January 31, 2014 1:51 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Sorting Array via values from a file

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

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.