165 pts.
 PAGE X OF X
If for example, I have a 5 page report, does anyone know how to make the report read page 1 of 5, page 2 of 5, etc without first having to print the report to see how many pages there are? (I am using RPGLE)

Software/Hardware used:
ASKED: November 14, 2007  7:06 PM
UPDATED: May 19, 2008  11:25 AM

Answer Wiki:
Bad news here - there is no way to tell. Some items on an order might take one detailed line, other 15 (for comments) Recommend writing it as Page 1 of xx, Page 2 of xx then use cpysplf to copy to a 132 character database file. update the rows by replacine the xx with the highest page number and writing all rows out again. You cannot do the copies while the file(s) are open. Either a second program or usropn files are necessary. Good luck Phil
Last Wiki Answer Submitted:  November 19, 2007  9:15 pm  by  philpl1jb   44,190 pts.
All Answer Wiki Contributors:  philpl1jb   44,190 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi,

If you know how many lines you have available to print on on a page and you know how many lines of data you’re going to print, then you can calculate how many pages you have to print in total.

For example you can print 10 order lines on a page, you have 127 order lines to print, then you have 13 pages, so you could print 1 of 13, through to 13 of 13.

Depending on your database and software, you could use SQL to first do a count of the records you have available to print (within your selected range).

Hope this helps,

Martin Gilbert.

 23,625 pts.

 

Hi
There is aome API which is to do this activity.
If U need Some Logic then we can have like:
First create the Spool file with a counter variable to hav the Total number of pages in the Program.Then Copy it to a flat file using Cpysplf then Using SQL u can Replace the Text YY in the file( XX of YY) with the final value of the Counter variable.then again overide the File to the Spool file using OVRPRTF

Thanx
Reshma

 445 pts.