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

Brian Parkins <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
To reaffirm Raul's advice, you could have tweaked your program slightly 
to READ into a Data Structure as follows:

      FSLSMONTHS IF   E           K DISK

      D APR25           S               D   INZ(D'2017-04-25')
      D JAN31           S               D   INZ(D'2017-01-31')
      D FEB04           S               D   INZ(D'2017-02-04')
      D FEB05           S               D   INZ(D'2017-02-05')
      D EOFIND          S               N

      D SLSMONTHSDS     DS                  LIKEREC(SLSMONTHR)

      C                   SETON     LR
      C     JAN31         SETGT     SLSMONTHS
      C                   READ      SLSMONTHS     SLSMONTHSDS
      C                   EVAL      EOFIND = %EOF(SLSMONTHS)
      C     FEB04         SETGT     SLSMONTHS
      C                   READ      SLSMONTHS     SLSMONTHSDS
      C                   EVAL      EOFIND = %EOF(SLSMONTHS)
      C     FEB05         SETGT     SLSMONTHS
      C                   READ      SLSMONTHS     SLSMONTHSDS
      C                   EVAL      EOFIND = %EOF(SLSMONTHS)
      C     APR25         SETGT     SLSMONTHS
      C                   READ      SLSMONTHS     SLSMONTHSDS
      C                   EVAL      EOFIND = %EOF(SLSMONTHS)
      C                   RETURN

- then you would have been able to track all of the data in debug. Just 
a thought for the future.

Brian.

On 07/01/2026 22:31, James H. H. Lampert via RPG400-L wrote:
> On 1/7/26 2:04 PM, Raul Alberto Jager Weiler wrote:
>> Do you use the field from the file?
>> RPG does not load the fields if there are not used.
>
> THAT WAS IT!!!!
>
> Scatter-gather wasn't happening on any of the fields because I wasn't 
> referencing them (yet).
>
> Thanks. I knew that, but I'd forgotten it. Maybe it's time for me to 
> (as George Washington so famously put it) "retire to the back-country, 
> and live in a wigwam."
>
> -- 
> JHHL

-- 
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: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] 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.