× 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 have seen a lot of discussion regarding the merit of dou and dow. I dont want 
to start that discussion again but i want to share with you someting i saw when 
i was in university. There i studied the LISP language. I do not recommand this 
 language but it had an original way to treat looping.

Basicaly, a loop process is made up of the folowing:

{Loop initialisation processing}
{loop begin}
{Before loop test processing}
{loop test}
{After loop test processing}
{loop end}

With this kind of construct, a DOW is when {Before loop test processing} is 
empty and DOU is when {After loop test processing} is empty. This gives us also 
the possibility to define loop where some processing is done before and after 
the test.

In RPG, it could look like this

C      CLEAR            x         {loop init}
C  Key SETLL   File                 "     "

C      DOL                       (new op code Do  Loop) {loop begin}

C      READ    File         55    {before loop test proc.}

C      DOTST    *in55 = *off     (new op code Loop test) {loop test}

C      EVAL    x = x + 1          {after loop test proc.}

C      ENDDO                      {loop end}

As you can see, this construct can replace both DOW and DOU. You can avoid the 
repetion of code (read before the loop and before the enddo in a dow).

I know that we will never see this on the AS/400 but I wanted to show that 
there is (in my mind) a better way.

Denis Robitaille
Cascades inc.
Tel: 819-363-5187
DRobitaille@cascades.com

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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-Ups:

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.