|
The answer to this predicament is to formulate the print lines to a physical file. With the 1st field representing a carraige (spelling?) control, and the second field being the actual print line. The "1st pass" will be to read/interrogate the data and formulate the print lines TO THE PHYSICAL FILE, populating the first field accordingly, keeping a count of the TOTAL number of pages being printing, but populating the page number of the report WITHIN the physical file as "page 1 of" .... "page 2 of" etc. The "2nd pass" is to read the phycial file, printing to a print file using the first field of the physical file as per a carraige (spelling?) control. Wherever "page x of " appears from the physical file, plug in the total number of pages in the appropriate positions, prior to printing. This method interrogates the data ONCE, and works in COBOL, RPG, UNIX on whatever platform you would wish to consider. >>> "Leland, David" <dleland@Harter.com> 09/07 10:49 AM >>> The problem with the 2 pass solution is that, depending on the application, you may not be able to guarantee that the data hasn't changed between the running of the first and second passes. So, how can you guarantee that the number of pages to be printed will be the same. Sure it's a simple solution, but will it be correct? Dave -----Original Message----- From: jt [mailto:jt@ee.net] Sent: Thursday, September 07, 2000 9:29 AM To: RPG400-L@midrange.com Subject: RE: page n of x John Hall, I had created a test RPGIV to see how well John Carr's two-pass approach would work. I also had attempted to use an external indicator to suppress printing on the first pass (I used QSYSPRT). But as you said, it didn't work in RPGIV (returned total pages of zero when indicator was off). As far as overriding to NULL device, you can override to an OUTQ that is not attached to a writer, and then delete the printout from the first pass. I sure don't understand the benefit of using an API, just to get the total pages to print. It took me longer to write these posts, than it did to code the test programs. And the 2-pass solution _worked the first time_. Can you say that of the API approach? Maybe I'm missing something. jt -----Original Message----- From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On Behalf Of John Hall Sent: Thursday, September 07, 2000 8:48 AM To: RPG400-L@midrange.com Subject: Re: page n of x You can also use an external indicator on the printer file to suppress output on the first pass. This will not work in all situations. Results will vary depending on RPG version and printer file type but if you handle page breaks within the program you can call the program with the external indicator off, return the total page count, then call the program with the indicator on. I think RPGIII will a program described printer file will handle the overflow correctly regardless of the external indicator but I couldn't get RPGIV with an external printer file to update the INFDS with the external indicator off. Another possibility might be to override the file to a NULL device - anybody know how to do this ? John Hall +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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 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.