× 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: DOW & DOU
  • From: "James W. Kilgore" <qappdsn@xxxxxxx>
  • Date: Thu, 07 May 1998 16:47:37 -0700
  • Organization: Progressive Data Systems, Inc.



Denis Robitaille wrote:

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

You just couldn't let it be, could you? <g>

>
>
> 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}
>

How about:
c               SETOF                 55
C      KLST     SETLL FILE
C      *IN55    DOWEQ *OFF  (OR DOUEQ *ON)
C               READ FILE             55
C 55            LEAVE
C           (Other stuff)
C               ENDDO

I too. learned the primed DOW loop method.  Since LEAVE was introduced, this 
only has one read.

In the real word, we don't mainline SETLL or READ operations, they are in a 
/COPY subroutine member.  Our shop standard is to use indicator 90 for all 
failed CHAIN/READ operations and we have variables for "beyond next line" 
conditioning e.g. the two letter field name prefix for the customer
master is "CM" so within the routine that performs the SETLL we also initialize 
fields CMANY, CMHIT and CMDONE to blanks.  The READ routine uses all three, the 
CHAIN routine uses the CMHIT variable.  (Originally we made all disk access 
into /COPY routines so they could be replaced with SQL if we
wanted to)

So in our case the above example would be:

C            EXSR CMSET
C     CMDONE DOWNE 'Y'
C            EXSR CMREAD
C 90         LEAVE
C        (other stuff)
C            ENDDO

We could get rid of the left hand indicator by doing a IF, but being the lazy 
type that we are we prey to the compiler gods for a X IFNE Y LEAVE construct 
some day <G>

On bended knee, tossing my 2 cents in.


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

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.