× 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: Cycle or Non-cycle ?
  • From: "Joep Beckeringh" <joepb@xxxxxx>
  • Date: Mon, 5 Apr 1999 23:17:54 +0200

Well, normally the cycle would read a record from the primary file (or
secondary, but let's assume just one primary file) and then execute detail
calculations (your C-specs).  If I remember correctly, in the absence of a
primary file, these calculations will be executed over and over again, until
the last record indicator (LR) is set on (or the program returns through
RETURN).  Mostly in programs where there is no primary file, the programmer
will take care of the looping himself, but the way you code it, you
effectively use a full procedural file as a primary one.  Every cycle, you
read a record (and leave the pointer there) and print something.  When you
read the last record you don't print DETAIL (so your report is always one
record short), but print TOTAL and set on LR.  The fact that you don't print
DETAIL for the last record is a nice illustration of the opinion of some
(including me) that it is wiser to use the cycle whenever it is appropriate,
instead of coding the logic yourself.

Joep Beckeringh


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  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.