You should have a copy of <a href=”http://www.redbooks.ibm.com/redpapers/pdfs/redp3752.pdf”>IBM EserveriSeries Printing VII</a>. Note topic 6.8 — How Infoprint Server and the PDF mapping program communicate — where it discusses the potential for multiple calls to your mapping program.
You might use the ‘buffer size comparison’ technique. Or you might simply save the parms and compare them on the next call. If they’re the same between calls, then this is a second (or subsequent) call to your program for the same spooled file. When the parms change, it’s a call for a new spooled file.
You’ll probably want your program not to run in a *NEW activation group. The *CALLER activation group may be best. You don’t want your saved values to be reinitialized on every call.