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



Thanks to everyone who replied thus far.

Paul, I tried using the first routine you have written.  When I compile,
I get an RNF0394 error on the "DoW %found(kdsdata);" statement.

The kdsdata is the subfile record within my dmdpegd display file.  When
I put in the %found(dmdpegd), it compiles fine, but when I run the
program and print, it starts at the last record when it chains, and not
the first.

I would have thought that if I set RRN=1 then it would start at the
first record and read forward.  Is this not correct?

Thanks!

Brian.

-----Original Message-----
From: Paul Morgan [mailto:pmorgan@xxxxxxxxxxxxxx] 
Sent: Monday, October 03, 2005 1:27 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Printing from a Subfile

Brian,

1) Use %found instead of %eof.
2) Your loop is broken.  The %found test on the DoW will be tested
before
the subfile has ever been read.  You can either fix it by using DoU and
then
inserting an If %found statement right after the chain in the loop or by
performing a chain just before the DoW loop and moving the chain inside
the
loop to the bottom of the loop.

Your code would look like:

Write Heading;
Rrn=1;
Chain Rrn Kdsdata;
DoW %Found( Kdsdata );
   If Prtoverflow;
     Write Heading;
     Prtoverflow = *Off;
   Endif;
   Write detail;
   Rrn = Rrn + 1;
   Chain Rrn Kdsdata;
EndDo;
Write Footer;

or:

Write Heading
Rrn=1;
DoU %Found( Kdsdata );
   Chain Rrn Kdsdata;
   If %found( Kdsdatafilename );
      If Prtoverflow;
        Write heading;
        Prtoverflow = *Off;
      Endif;
      Write detail;
      Rrn = Rrn + 1;
   EndIf;
EndDo;
Write Footer;

Paul


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.