The source code at toast.net differs a bit from your OP. Just looking at that page, I would expect all those SETGT/READs to read a record and %EOF should be off. Is that not the case?

Where are you setting your debug breakpoints when checking the value of SMLASTDATE? Maybe insert a DUMP(A) after every EVAL?

Can you answer Charles' question?

- Dan Bale

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of James H. H. Lampert via RPG400-L
Sent: Wednesday, January 7, 2026 3:55 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: James H. H. Lampert <jamesl@xxxxxxxxxxxxxxxxx>
Subject: Re: File keyed on a date field: the read doesn't actually get anything! What am I doing wrong?

On 1/7/26 12:38 PM, Dan Bale via RPG400-L wrote:
Per your update, JAN31 = D'2017-01-31'

Stupid question, but are there any records with a SMLASTDATE date earlier than D'2017-01-31'?

Not a stupid question at all. (My high school woodshop teacher was fond of saying that the only dumb question is the one that doesn't get asked.)

The first record in the PF (which is the last one in the descending LF) is keyed D'2017-02-04.' The last record in the PF (which is the first in the LF) is keyed 2028-12-30.

And my four test key fields have INZ clauses of

INZ(D'2017-04-25')
INZ(D'2017-01-31')
INZ(D'2017-02-04')
INZ(D'2017-02-05')

on their D-specs.

If I were using the descending logical, JAN31 should have retrieved nothing at all, but the other three should have retrieved *something.*

I get the same results whether the key (theoretically) should get a hit or not, whether it's the ascending PF or the descenging LF, whether I use a SETGT or a SETLL, and whether I use a READ or a READP. SMLASTDATE always comes up D'0001-01-01'.

--
JHHL

*** CONFIDENTIALITY NOTICE: The information contained in this communication may be confidential, and is intended only for the use of the recipients named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. ***

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