Re: PAGE x OF y
Posted in 1997
Have your report print a "stub" for the number of pages (e.g. %%NUMPAGES%%). print "Page ", pageno using "####", " of %%NUMPAGES%%" Then run the report to a file (e.g. report.out) Then run a utility that counts the number of %%NUMPAGES%% in the output file and replaces every occurrence with it. Here's an awk script that can do it: awk ' BEGIN { while ( ( getline <FILENAME ) > 0 ) if ( $0 ~ /%%NUMPAGES%%/ ) numPages++ fmtNumPages = sprintf("%4d",numPages) # change the formatting as required } { gsub(/%%NUMPAGES%%/,fmtNumPages) print } ' report.out Catalin Catalin Badea Senior Technical Architect Tecsys Inc. cat@tecsys.com www.tecsys.com include "disclaimer.4gh" Lenny Vovk <lvovk@opsny.csfb.com> wrote in article <5ajnc0$7hj@amstel.fir.fbc.com>... > > I have a requirement from my users to include in > the header of the report my 4gl program produces > the following: > > PAGE x OF y > > Obviously, it is very easy to include current page > number, my problem is how to calculate total number > of pages in my report. Any help would be greatly > appreciated. >