160 pts.
 AS/400:RLU report printing
I want to print a spool file with Page format ( Page no./total number of pages) in header.

Plz share how can i get this in RLU..(ex : 1/10)

 



Software/Hardware used:
ASKED: December 21, 2009  4:47 AM
UPDATED: December 21, 2009  8:16 PM

Answer Wiki:
Page number is simple - check the rlu help Total number harder - requires RPG code that computes number of pages before the first header is printed. Here is discussion. http://itknowledgeexchange.techtarget.com/itanswers/how-to-display-page-1-of-n/ Phil
Last Wiki Answer Submitted:  December 21, 2009  10:56 am  by  philpl1jb   44,220 pts.
All Answer Wiki Contributors:  philpl1jb   44,220 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

As noted, page number is simply a field that you print with the page number in it. An externally-described printerfile written by RPG can have automated page number handling. The RLU manual says that the PAGENBR attribute can be used to specify the printed location.

However, that only covers the current page number. The total number of pages isn’t known until all of the pages are printed. You will either have to calculate somehow the number of pages before you start printing or process the spooled file after you are finished to update every page with the total.

You could use CPYSPLF to a PF and update records that have page numbers. Then CPYF TOFILE(*PRINT) to generate a new spooled file with your updated page numbers. Or you can use the Spooled File APIs to copy the spooled file into user spaces, update the page number in the spaces, and generate a new spooled file from the updated spaces.

Usually, some kind of constant would be placed in the original spooled file to mark where the updates should be done. E.g., you might print “*PN<” to mark the location where a “PageNumber” can be inserted. That gives you something to search for when you process the PF or the spaces. You might create a utility program that you can for any spooled file that you want this done to.

In any case, RLU is only a “Report Layout Utility”. It doesn’t actually do any printerfile processing. The processing is done by your programming.

Tom

 108,360 pts.