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



Hi Rick

Does that work?  The loop will never be executed because 1 will never be
equal to -1 and a DOW tests the condition at the start of the loop.  DOU, on
the other hand would execute the loop until told to leave.

Personally I tend to use either of the following depending on how my mood
takes me:

     D True            s               n   Inz(*On) 
     D False           s               n   Inz(*Off)
                                                    
     C                   DoW       True             
     C                   If        Condition = Met  
     C                   Leave                      
     C                   EndIf                      
     C                   EndDo                      
                                                    
     C                   DoU       True = False     
     C                   If        Condition = Met  
     C                   Leave                      
     C                   EndIf                      
     C                   EndDo                      

IN some ways I think the second example is better because it makes you look
twice at the line and take note that it's a DOU and not a DOW.

Jonathan


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: 10 January 2007 16:45
To: rpg400-l@xxxxxxxxxxxx
Subject: How would you code an infinite RPG loop - Was 1 <> 1 is true???


 I'm curious.  I use a loop similar to the one below to place the
program into a wait state until a condition is met.  In this case,
entries have been remove from a data queue so it's save to add another
one.  It prevents the program from overflowing the data queue.  It is
prefaced with several lines of comments explaining why the loop is
there.

        DoW 1 = -1
                If data queue is not full
                        leave
                EndIf
        EndDo

If this isn't the way one should do this kind of thing, how should it be
done?

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ron Power
Sent: Wednesday, January 10, 2007 9:29 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: 1 <> 1 is true???

Ok...  let me explain.
I'm running a test on emailing pdf's.  That section of code
deletes the spool file after it's sent.  I don't want the
spool file deleted because for now I want to manually do
stuff to it.  Once I'm done, I'm removing the if statement. 
I don't want to comment out the section of code cause I don't
want the date to change on the code line because it's not
really changed.  I would never ever stick a line of code in
like that if it was going to production.

:)

Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
709-576-8132
rpower@xxxxxxxxxx
http://www.stjohns.ca/
______________________________________________________________
_____________
Success is going from failure to failure without a loss of
enthusiasm. - Sir Winston Churchill

Privileged and Confidential.  This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information.  If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail.  You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.


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.