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



<snip>
I want to access a file by descending key & would you believe I have never
done that before via READ* variants?
I have got a logical of the records in descending sequence & I am not sure
if
my logic would be same pattern
ie. *LOVAL SETLL file then READ loop ("forwards" through the records)
or if I should *HIVAL SETHH at begeinning because I'm going to be reading
backwards.

Reason for this is I want to flag the oldest entries for deletion & I
thought
I would start at the beginning of the point I want to keep.
<end snip>

You do use the normal SETLL/READ instructions in the normal way.  I can't
see why you need to consider *LOVAL, *HIVAL, as you say you want to start
purge old records going back from a certain date.  As this date is
(conceptually) in the middle of the file, then you wouldn't hit it with
*LOVAL or *HIVAL, no matter which direction you were reading the file.
Instead, you would SETLL with a key immediately before the first date to
keep, and then start READing.  The records will be presented to you in
descending date order on each READ (or READE).


I would however suggest you consider this question.

"If I'm having a problem with properly conceptualising this, might not the
poor guy who has to maintain this in the future have the same problem?"

My rule-of thumb is that, when choosing between alternative programming
techniques, I choose the one that's most easily understood and maintained.
While the code is no more difficult to write than "normal" processing of
reading forward from the start, it tends to go against the experience most
of us have in writing and reading code.  As such, it is more likely to be
misinterpreted at some later stage.  Unless there is some specific need to
read in descending order, I would suggest that you start at the start, and
read in "normal" ascending fashion to the point you are interested in.
That way, this will be more readily understood by yourself and/or
successors at some future time when the program may need reviewing.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.