The simple answer is no. The total number of pages can only be determined by running through the output twice. In the past I have handled this issue by writing the detail lines out to a workfile, counting the number of detail lines (as each is output) and then generating the spooled document directly from the workfile entries (after determining the total number of required pages based on the number of detail lines per page). There may be an alternate way to handle this dilemma but this is the only method I have encountered in numerous IT shops.
Only way I know to be certain is to generate the report first. Place some recognizable constant in the positions occupied by page numbers while generating the report. Once the report has been spooled, retrieve it into user spaces, process the spaces to place your TotalPages value into everywhere you have page numbering tagged and then re-spool from the user spaces.
You won’t need a constant or marker if you feel confident enough to locate the positions by interpreting the space text.