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



I never use endless loops, except for the example of screen processing
I posted earlier. In that case, and only in that case, it just makes
the code 'cleaner' imo.

the loop ends when the user asks it to (one of three different ways:
F3, F12 or successful data entry and update.) The rest of the time,
there are several points where the user asks the program to do
something and it returns to the screen (F4 prompt, enter to update,
but errors were found).

yes, they kinda look like gotos, but the structure is still there.
Iterate the loop or leave it, based on 5 different and unrelated
conditions.

It's better than coding the loop like this:

dow *inkd or (not errors and not *inkc and not *inkl)

Just thinking about how to write the above gave me a sharp pain just
behind my eyeball. no thanks.

On Fri, Jan 9, 2009 at 2:27 PM, Bryce Martin <BMartin@xxxxxxxxxxxx> wrote:
I still agree with the sentiment that writing an endless loop isn't as
maintainable. You are now doing 2 logic checks instead of 1. You have to
do the check of whether 1=1 and then check if you are at the end of file.
I know that you will never see the differenece when running a program but
think of all the cpu cycles that are being wasted in the course of time by
code written this way. If you have a popular ERP system that is made up
of thousands of programs and everytime a file is read through you have
these extra logic steps you can quickly see how many cpu cycles will be
wasted by your package if you have thousands of customers. Everyday, all
day, this stuff goes on. The numbers quickly become larger than what we
can count on our fingers and toes.

Maybe I'm too much of a purist, but I really don't like the current
programming mentality that, just because the machines are bigger now the
code doesn't need to be written as efficiently because no one will really
notice. Its that kind of attitude that gives us things like Windows
Vista. Its pervasive, like it or not, and it eventually does show up
somewhere.


Thanks
Bryce Martin
Programmer/Analyst I
Ext. 4777



"Wintermute, Sharon" <Sharon.Wintermute@xxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
01/09/2009 02:07 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: Good places to use "The Cycle" in today's RPG was->Re:
FW:Niftiest thing(s) you have done in RPG ILE or /FREE






Just have to chime in here.

One of my professors "dinged" us for primary reads. His reason? If you
have a do loop check it then. His style was

Dow 1= 1
Read
If %EOf
Leave
Endif
Process
Enddo

I still remember the ruler on my hands.

Sharon Wintermute

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christen, Duane J.
Sent: Friday, January 09, 2009 12:59 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Good places to use "The Cycle" in today's RPG was->Re:
FW:Niftiest thing(s) you have done in RPG ILE or /FREE

Your both wrong. :-)

Read file;

DoW Not %Eof(file);
// process data
Read file;
EndDo;



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Crosby
Sent: Friday, January 09, 2009 12:39 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Good places to use "The Cycle" in today's RPG
was->Re: FW: Niftiest thing(s) you have done in RPG ILE or /FREE

I do it the way you don't.

dow '1';
read file;
if eof;
leave;
endif;
processdata;
enddo;

That's MY opinion and I'm sticking to it. <g>

--
Jeff Crosby
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the
opinion of my company. Unless I say so.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On
Behalf Of GUY_HENZA@xxxxxxxxxxxxxx
Sent: Friday, January 09, 2009 1:07 PM
To: RPG programming on the IBM i / System i
Subject: Re: Good places to use "The Cycle" in today's RPG
was->Re: FW:
Niftiest thing(s) you have done in RPG ILE or /FREE

Wow, just back from lunch and so many posts. I consider ITER and
LEAVE
to
be backwards from the way I think. I condition on what I
want to do
not
on
what I don't want to do.

dou eof;
read file;
if not eof;
processdata;
endif;
enddo;

This makes more sense to me than;

dou eof;
read file;
if eof;
leave;
endif;
processdata;
enddo;

That's my opinion and I'm sticking with it.

Regards,

Guy

Inactive hide details for "James Perkins"
<jrperkinsjr@xxxxxxxxx>"James
Perkins" <jrperkinsjr@xxxxxxxxx>

"James Perkins" To "RPG
programming on
the
<jrperkinsjr@xxxxxxxxx> IBM i /
System i"
Sent by:
<rpg400-l@xxxxxxxxxxxx>
rpg400-l-bounces@xxxxxxxxxxxx cc
Subject Re:
Good places to use
01/09/2009 11:36 AM "The
Cycle" in today's
RPG was->Re: FW:
Niftiest
+---------------------------+
thing(s) you have done
in
| Please respond to | RPG ILE or /FREE
| RPG programming on the |
| IBM i / System i |
| <rpg400-l@xxxxxxxxxxxx> |
+---------------------------+

If you don't use ITER or LEAVE do you just have a giant IF
statement,
with
loads of nested IF's? I really can't see how you could
right a program
that
uses logic any other way, but then again just because I
can't think if
doesn't mean there is not a way.

James R. Perkins
--


--------------------------------------------------------------
------------
-----
The information contained in and transmitted with this
e-mail may be
privileged, proprietary, confidential and protected from
disclosure. No
privilege is hereby intended to be waived. This e-mail
is intended only
for the person to whom it is addressed. If you are not
the intended
recipient/addressee, any use of the e-mail and/or its contents,
including,
but not limited to, dissemination, distribution or
copying is strictly
prohibited and may be unlawful, and you must not take
any action in
reliance on it. If you receive this e-mail in error,
please immediately
notify the sender and delete the original message and
any copies of it
from your computer system. We deny any liability for
damages resulting
from the use of this e-mail by the unintended recipient,
including the
recipient in error.


--
This is the RPG programming on the IBM i / System i
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change
list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________


NOTICE: This electronic mail transmission may contain confidential
information and is intended only for the person(s) named. Any use,
copying, or disclosure by any other person is strictly prohibited. If
you have received this transmission in error, please notify the sender
via e-mail.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--- This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us and destroy this message immediately. ---
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.