× 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: "Dileep Mahi" <dileep.mahi@xxxxxxxxx>
  • Date: Mon, 19 Jun 2000 09:18:23 +0530

Dan,

You are right. In fact your guess "maybe even updating a key value in the
record, causing it to "appear" again later in the access path?" is
absolutely correct and I am very thankful for valuable hint which helped me
in resolving my problem.

Thanks once again
Dileep Mahi


----- Original Message -----
From: Bale, Dan <DBale@lear.com>
To: <RPG400-L@midrange.com>
Sent: Friday, June 16, 2000 8:36 PM
Subject: RE: Second time updation of record within the same loop.


> Hoo-boy!  Hey guys, without getting into the religious war of DOU vs. DOW
in
> this situation, let's just help Dileep, OK?
>
> Dileep,
>
> In your choice of using DOU, you will have to code a "*INLR   IFNE *ON" -
> "ENDIF" group.  The IF statement normally would go right after your READx,
> and the ENDIF would go right before your ENDDO.  In your case, though,
since
> you have another condition that can set LR on, you would place the *INLR
IF
> right after that test.  As follows:
>
>      C           *INLR     DOUEQ*ON
>      C           'UB'      READEFILENAME                 LR
>      C  NLR      COLDAT    IFGE BRDATE
>      C                     SETON                     LR
>      C                     ENDIF
>      C           *INLR     IFNE *ON
>       *****
>      C                     UPDATFILENAME
>      C                     ENDIF
>      C                     ENDDO
>
> Not directly related to your question, but I would strongly recommend that
> you *not* use the plain END opcode; instead use the ENDIF, ENDDO, ENDSL.
> Makes the code a little bit more readable.
>
> Don't know why you've got an endless loop on your pseudocode (I presume
this
> is a different problem than the actual code you presented?).  If you've
> really got an endless loop, then your DOU either is testing the wrong
thing
> or the values that you're testing in the DOU are not changing in the
manner
> you expect them to.  Another possibility - in this loop, are you adding
> records to the same file you're testing for EOF?  Or maybe even updating a
> key value in the record, causing it to "appear" again later in the access
> path?
>
> hth,
> - Dan Bale
>
>
> > -----Original Message-----
> > From: Dileep Mahi [SMTP:dileep.mahi@wipro.com]
> > Sent: Friday, June 16, 2000 5:11 AM
> > To: RPG400-L@midrange.com
> > Subject: Second time updation of record within the same loop.
> >
> > 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
> > +---
> +---
> | 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
> +---
>

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