I’m most liikely missing something, but doesn’t the special value -1 for the spool number parameter meet your needs (assuming that a new printer file is written by the called program)? If not, then perhaps using the Retrieve Identity of Last Spooled File Created (QSPRILSP) API before and after running the program would be an easy way to determine the last print file generated (and not being from prior to running the program). Comparing the output of the before and after API calls would certainly tell you what I believe you are looking for.
QTIME could be used, but the logic may fail if run for instance during a daylight saving time transition where time is changed back an hour. As QTIME represents local time I wouldn’t be surprised in this situation if the time of the “last” entry was be before the time of the “last – 1” entry (though I didn’t test it either).