Had to fight that battle already. Since Common Server prints thru QSHELL (as Joe mentioned above), only option is to control the Output Queue it is sent to (on ARSDOC Print command), and monitor that queue (using Data Queues & a program). When it shows up, you have to decide what to do with it. We have an application that will Fax/Email documents from Common Server:
--Multiple programs drop records into a file for request to print.
--Program 1 reads a record from that file, and requests the document to print, and waits.
--QShell does it's thing, the document shows up in the Outq, and an entry is placed in the Data Queue.
--Program 2 reads the Data Queue, and reads the spool file for the key information we use to pull it
(Invoice #, Customer #), and writes an entry to a second Data Queue (keys, spoolfile ID, Job ID)
--Program 1 reads that Data Queue, checks to see if it is the correct Document type (Invoice), and if
the keys match (Invoice #, Customer #), continues to process the spoolfile (fax or email, or
could even print)
SFA was much easier ! But since every print request is submitted, you can't track it directly.
Also, we only do this with documents that came from spool files--scanned documents will not print to an outq, they must go to the IFS, but we haven't gotton that far (but how difficult can that be !).
Hope it helps.