IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Display total page number in report print-out


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
wicked1925

New User


Joined: 12 Mar 2007
Posts: 15
Location: Philippines

PostPosted: Mon Mar 19, 2007 2:52 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Mar 19, 2007 3:15 pm
Reply with quote

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
View user's profile Send private message
wicked1925

New User


Joined: 12 Mar 2007
Posts: 15
Location: Philippines

PostPosted: Mon Mar 19, 2007 3:27 pm
Reply with quote

>>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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Mar 19, 2007 4:41 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Mar 19, 2007 7:42 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top