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



Well, think about it... how is your program going to know how many pages there
are in total?  Say, perhaps, you are reading through a file a line at a time, 
when you print
out the first record, how is your program to know how many records there are?  
And then
there is the matter of how many lines you are printing on each page, how many 
are taken up
by the header and footer, etc...

If you do need to know the total number of pages you are going to have to 
determine this
before hand.  In the case given it should be a simple matter of determining how 
many records
in the file (not counting deleted records) from an API, and dividing that by 
the number of records
you are printing on each page.  I have done this kind of thing before.

You will have to calculate this in your program before you print the first 
record, however (you could
print it at the bottom of the page, but same difference).

As long as you know at line 1 how many detail lines you will be printing, you 
can calculate the total
number of pages.  If you don't know the total number of pages before you start, 
there is no way to
calculate it.  It would be possible to cycle through all your 
input/records/whatever first without printing
out anything, then when you determine how many pages it will be cycle through 
them again and actually
print them out (this is what Microsoft Word does to determine total number of 
pages.  See the repagenate
function).

Regards,

Jim Langston

James David Rich wrote:

> I need to put 'page n of x' on a printout.  I know I can easily use a dds
> keyword to get the current page.  Is there something that tells my program
> how many pages there are?  Maybe a dds keyword like PAGE?
>
> James Rich
> james@dansfoods.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 thread ...

Follow-Ups:
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.