× 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: RPG Indicators
  • From: Bill Graziano <Bill.Graziano@xxxxxxxx>
  • Date: Mon, 17 Apr 2000 07:36:06 -0400

Rich, 
        This is the way I learned and prefer it to me coded.  I always like
to test for a specific condition and then execute (i.e. Do While something)
instead of excuting and then testing for a condition (i.e Do Until something
[may] exist in any case, continuing doing and checking, doing and
checking...). 

I have encountered is the inability to use ITER when the I have a priming
read outside of the loop. It the cases where I want to use ITER, I modify
the loop to contain the read statement immediately after the DOW.

Bill Graziano
Programmer
Brambles Equipment Services, Inc.


-----Original Message-----
From: Rich Duzenbury [mailto:rduz@westernmidrange.com]
Sent: Sunday, April 16, 2000 12:06 AM
To: RPG400-L@midrange.com
Subject: RE: RPG Indicators


OH BOY.

I don't know why I'm responding to this one.  I think it's a religion
thing...but here's my .02 anyway.

I am a 'true believer' of doing the priming read, using the do-while loop,
and then reading just before the enddo.

Why do I think it's better?  The main reason is that there is one less
logical test inside the loop.  EOF is checked once and only once in each
iteration.  Also, the loop is never entered if there are no records.  I
can't think of any case where I've wanted to enter a loop via DOU in the
case where there aren't any records.

In my opinion, it's RPG that is forcing this issue on us.  If RPG were to
have the ability to do the read and test on the same line, we'd all use DOW,
I think with little question.  In C-ish languages, we would write it thusly:

while (readfile('OURFILE')==TRUE)
  {
  ... do our processing...
  }

or perhaps
while (readfile('OURFILE'))
  {
  ... do our processing...
  }

Of course, the downside is that if you need to modify the read statement,
you have to do it twice.  The other rule of thumb I try to stick to is to
have read loops no longer than can comfortably be seen on one SEU screen.
If I have more processing than can be done 'between the reads', I typically
move it into a subroutine.

<donning my flameproof gear>

Regards,
Rich


-----Original Message-----
From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
Behalf Of Peter Dow
Sent: Saturday, April 15, 2000 9:43 PM
To: RPG400-L@midrange.com
Subject: Re: RPG Indicators


I agree Dan. This has the added advantage that using ITER makes sense,
although it also has the disadvantage that you have to repeat the condition.
If there are more conditions than just eof, it could be modified something
like this:

      c     Key           Setll     FileName
      c                   DoU       %EoF( FileName )
      c     Key           ReadE     FileName
      c                   If        %EoF( FileName ) or
      c                             (a = b and c = d) or
      c                             e = f
      c                   leave
      c                   EndIf
       ***   do stuff
      c                   EndDo


Peter Dow
Dow Software Services, Inc.
909 425-0194 voice
909 425-0196 fax

----- Original Message -----
From: Bale, Dan <DBale@lear.com>
To: <RPG400-L@midrange.com>
Sent: Friday, April 14, 2000 12:07 PM
Subject: RE: RPG Indicators


> My preference is to just have one file input operation for the loop, i.e.:
>
>      c     Key           Setll     FileName
>      c                   DoU       %EoF( FileName )
>      c     Key           ReadE     FileName
>      c                   If        not %EoF( FileName )
>       ***   do stuff
>      c                   EndIf
>      c                   EndDo
>
> This has always worked for me.
>
> - Dan Bale

me: martin.mccallion@ukonline.co.uk
> +---
> | 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
> +---


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.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
+---
+---
| 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 ...


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.