View previous topic :: View next topic
|
Author |
Message |
wicked1925
New User
Joined: 12 Mar 2007 Posts: 15 Location: Philippines
|
|
|
|
hi guys...
i'm making a report print-out and i want it to have the page number and total number of page printed on every page pf the report, something like:
page 9 of 99
the page number is quite easy but the total number of pages (bold part) is a total mind bugging one. is there a way or function that can predict the total pages that will be printed in the print lines? btw i'm using cobol 85. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
One way would be to count your input and divide by the number of detail lines per page.
Another way would be to write the report to a temp file and while reading it back to print plug the total page count. |
|
Back to top |
|
|
wicked1925
New User
Joined: 12 Mar 2007 Posts: 15 Location: Philippines
|
|
|
|
>>One way would be to count your input and divide by the number of detail lines per page.
can you make a detailed explanation for this? i'm using data inputs from a DB2 table and i want the page number part to be printed on the 50th line in each page.
>>Another way would be to write the report to a temp file and while reading it back to print plug the total page count.
are you pertaining on the JCL part on this one?
thanks for reply...i really appreciated what you have said. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Find out how many rows will be in your report and how many rows will fit on a page and divide one into the other to calculate how many pages will be needed to complete the report.
Why would you think JCL, this is a COBOL forum.
Instead of outputing the report to a printer, output it to a temp dataset. When the report is all finished, you know how many pages it took.
Close the temp file,
open it for input,
open the print file for output, read temp file record,
if this is "the 50th line in each page" move the total page number,
write the temp file input record out to the print file,
repeat until eof on the temp file. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
As you write the temp file, the program will keep track of how many pages it read. As each page is printed, the page number is printed on the page.
When reading the temp file back in, look for the "PAGE NO nn OF" and place the total page count after the OF.
If you look for the "page line", you won't need to count lines which is more difficult if the report is complex.
Good luck |
|
Back to top |
|
|
|