RE: File keyed on a date field: the read doesn't actually get anything! What am I doing wrong?

Dan Bale via RPG400-L <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <DM4PR15MB61067D25E5B41E5A0689866E9E84A@DM4PR15MB6106.namprd15.prod.outlook.com>
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'?

- Dan Bale

-----Original Message-----
From: RPG400-L <rpg400-l-bounces-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org> On Behalf Of James H. H. Lampert via RPG400-L
Sent: Wednesday, January 7, 2026 3:27 PM
To: RPG programming on the IBM i / System i <[email protected]>
Cc: James H. H. Lampert <jamesl-6/ELSmrcqeUu8xhjR5IN5AC/[email protected]>
Subject: File keyed on a date field: the read doesn't actually get anything! What am I doing wrong?

In my current project, I've got a file, keyed on a date field:

      R SLSMONTHR
        SMLASTDATE      L
        SMCARRYOVR      L
        SMMONTH        2S
        SMYEAR         4S
        SM_OK          1A
        SM_ID         15S 0
      K SMLASTDATE

And I'm trying to read it:
   D JAN31           S               D
   . . .
   C     JAN31         SETLL     SLSMONTHS
   C                   READP     SLSMONTHS

But running it in the debugger, after the read, there's nothing in any of the file fields. I've tried the PF with its ascending key on SMLASTDATE; I've tried an LF with a descending key on SMLASTDATE. I've tried SETLL and SETGT. None of this changes anything.

--
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. ***
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.