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



<sigh> <asbestos suit on> I think I'm gonna regret this, however, Juan, you
should know that your original code was close.  I tend to respectfully
disagree with the "two reads in a loop" camp, as Jim provided in his code.
I am definitely in the "one read in a loop" camp.  The only changes I would
have made to your original code:

 C     KlistB        SetLL     IN057P2
 C                   DOW       Not %EOF(IN057P2)
 C     KlistB        ReadE     IN057P2
 C                   If        %EOF(IN057P2)
 C                   Leave
 C                   EndIf
 C  ... do your stuff
 C                   EndDo

would have been to use a DoU %EOF(IN057P2) in place of the DOW, and use If
Not %EOF(IN057P2) in place of the If %EOF(IN057P2) & Leave.  Here's how I
would normally code what I believe you are trying to accomplish:

 C     KlistB        SetLL     IN057P2
 C                   DOU       %EOF(IN057P2)
 C     KlistB        ReadE     IN057P2
 C                   If        Not %EOF(IN057P2)
 C  ... do your stuff
 C                   EndIf                  >If Not %EOF(IN057P2)
 C                   EndDo                  >DOU %EOF(IN057P2)

In this case, you do not need to prime your %EOF because you are not testing
it until the EndDo, after you've attempted a ReadE (note the DOUntil vs.
DOWhile).  I *personally* find this much easier to read & maintain than the
READ before the loop and at the bottom of the loop technique.  Additionally,
if you wanted to perform data selection on your read input, you've already
got your If statement, i.e.:

 C                   If        Not %EOF(IN057P2)
 C                              and INRcvDate = TodaysDate

HTH

<keeping the asbestos suit on>

- Dan Bale
(I am *NOT* "Dale"
http://archive.midrange.com/midrange-l/200105/msg00281.html )
SAMSA, Inc.
989-790-0507
DBale@SAMSA.com <mailto:DBale@SAMSA.com>
  Quiquid latine dictum sit altum viditur.
  (Whatever is said in Latin seems profound.)

-----Original Message-----
From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
Behalf Of Jim Langston
Sent: Thursday, June 06, 2002 3:40 PM
To: 'rpg400-l@midrange.com'
Subject: RE: Resetting %EOF


You are not "priming" your loop.

The way I would code this same thing would be:

 C     KlistB        SetLL     IN057P2
 C     KlistB        ReadE     IN057P2
 C                   DOW       Not %EOF(IN057P2)
     --- Process record here ---
 C     KlistB        ReadE     IN057P2
 C                   EndDo

So you need 2 read statements.  One *before* you enter your DOW loop to
"prime" the
indicator, the second just before the enddo to read the next record.

You also don't need the If %EOF... leave statement.  Adding an extra read,
and moving a read is a good trade off for getting rid of a leave statement,
IMO.

You can also change your DOW to a DOU, but then you would need your leave
statement.

Regards,

Jim Langston

-----Original Message-----
From: Juan Robledo [mailto:Juan_Robledo@irco.com]

here is  a some of the code


 C     KlistB        SetLL     IN057P2

 C                        DOW       Not %EOF(IN057P2)
 C     KlistB        ReadE     IN057P2
 C                        If        %EOF(IN057P2)
 C                              Leave
 C                       EndIf


Juan Robledo
Programmer Analyst



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.