PAGE X OF X

190 pts.
Tags:
RPG
RPG ILE
RPGLE
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)

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Gilly400
    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,730 pointsBadges:
    report
  • ReshmaG
    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
    455 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following