× 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 find the best way to remember this is to visualize the records in keyed
order and then consider SETLL as equivalent to "position just before key
value" and SETGT as "position just after key value".

So for example, if I have key values A, B, and C, if they are in ascending
order then B comes after A and before C; if they are in descending order,
then B comes after C and before A.

It may be helpful to set up a test file & run some simple tests. I think
you'll find:

If the key value exists in the file:
Ascending keys:
SETLL and READ will retrieve the record with that key value
SETGT and READ will retrieve the next record (unless it's the highest key
value in the file, in which case READ with no error will retrieve that key)
Descending keys:
SETLL and READ will retrieve the record with that key value
SETGT and READ will retrieve the next record (unless it's the lowest key
value in the file, in which case READ with no error will retrieve that key)

If the key value does not exist in the file:
Ascending keys:
SETLL and READ will retrieve the record with the next highest key value
(nb: if it's higher than the highest key, no record is read)
SETGT and READ will retrieve the record with the next highest key value
(nb: if it's higher than the highest key, no record is read)
Descending keys:
SETLL and READ will retrieve the record with the next lowest key value
(nb: if it's lower than the lowest key, no record is read)
SETGT and READ will retrieve the record with the next lowest key value
(nb: if it's lower than the lowest key, no record is read)


Admittedly, this can be a little confusing, but I think the usefulness of
these actions makes the effort worthwhile. . . .


rpg400-l@midrange.com writes:
><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>



Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA  01376
413-863-4357 x444
mnaughton@juddwire.com



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.