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

"James H. H. Lampert via RPG400-L" <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
On 1/7/26 1:40 PM, Dan Bale via RPG400-L wrote:

> Can you answer Charles' question?

I did. "First" and "last" are by key, so no, there's nothing keyed 
before D'2017-02-04'.

> 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 this being a test program for a bizarre problem, the source code is 
constantly being changed. For example, I just now tried adding an H-spec 
with an explicit DATFMT(*ISO). No change in behavior.

Now THIS is somewhat interesting. I took your suggestion and added 
DUMP(A) statements. Here's what I got:

For the first READ (after SETGT on JAN31), it shows (taking out the hex):

Key Value:
  *2017-02-04                      *

Input Buffer:
  *2017-02-042017-02-05022017Y00000*
  *0000000001                      *

but still (squeezing out spaces and hex):
   SM_ID      PACKED(15,0) 000000000000000.
   SM_OK      CHAR(1)      ' '
   SMCARRYOVR DATE(10)     '0001-01-01'
   SMLASTDATE DATE(10)     '0001-01-01'
   SMMONTH    PACKED(2,0)  00.
   SMYEAR     PACKED(4,0)  0000.

The dump after the second READ (with SETGT on FEB04), and the third read 
(with SETGT on FEB05), it gets:

Key Value:
  *2017-03-04                      *

Input Buffer:
  *2017-03-042017-03-05032017Y00000*
  *0000000002                      *

But the fields are still as before.

And the last READ (with SETGT on APR25), it gets:

Key Value:
  *2017-05-06                      *

Input Buffer:
  *2017-05-062017-05-07052017Y00000*
  *0000000004                      *


So it's reading the records, and given that it's currently doing SETGTs, 
it's getting the right records, but for some reason, scatter-gather 
isn't working!

--
JHHL
(Over 30 years and I've never put a DUMP statement into a program. 
Didn't even notice it was available.)
-- 
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.