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


  • Subject: Re: Second time updation of record within the same loop.
  • From: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Fri, 16 Jun 2000 08:07:45 -0700

Little confused here...  One thing that jumps right out at me, though,
is that you are going to be changing one record you don't want to.

Your logic...

DoU  LR
Read Record setting on LR at end
If outside range turn on LR
Update the record
EndDo

Consider, the first record you are hitting that is outside the range,
it is also going to get updated!  When you do the check for range,
if the record is outside the range you either need a very large if
statement around the rest of the block, or you need to exit from
your do loop somehow.  Myself, I use the ifstatement.

DoU LR
Read Record setting on LR at end
If outside range
    turn on LR
else
   Update the record
EndIf
EndDo

Now, other than that, I don't see any flaws in the program logic,
or maybe I'm just missing it.  How is your loop getting executed
again?  With a Do and Read, it will read thorugh each record once,
unless you are doing a SetLL or something.

Please explain a little more to me, thanks.

Regards,

Jim Langston


Dileep Mahi wrote:

> My code follows the following logic
>
> DOU end of file.
> Read the file.
> If record is valid.
> Search for matching record in some other file.
> If search is successful, update records in file.
> EndDo
>
> My Problem is, after EOF, the same loop is getting executed again from the
> start but only with the updated records and obviously the records are
> getting updated for the second time again. This goes on and on and my
> program never ends.
>
> In this program,
>     LR indicator is used to test the end of file in following fashion
> 1.            *INLR    DOUEQ    *ON
> 2.            'UB'        READEFILENAME            LR
> 3. NLR    COLDAT    IFGE    BRDATE
> 4.                        SETON                              LR
> 5.                        END
> .................
> ..................
> N.                        UPDATFILENAME
> ...................
> X.                       END
>
> While running the loop for second(or subsequent) time, if the condition in
> line 3 is satisfied, the LR indicator is set to *ON and control is coming
> out of the loop. Then other statements are being processed and the program
> is ending.
>
> I want this loop to end after processing the last record of the file. Any
> suggestion in resolving this problem are worth a zillion appreciations...
>
> Thanks in advance
> Dileep Mahi

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.