Q: Can anyone tell me how to monitor spooled files (unattended) to convert them to a physical file? I know there is a way to get the spooled list through an API function, but this method seems too slow to intercept a ready-to-print spooled file before it begins to print. I need to find a better way to intercept every spooled file before it prints and convert it to a physical file. Maybe this monitoring job has to run repeatedly in a separate subsystem?
A: On the Create Output Queue (CRTOUTQ) command you can specify a data queue in the Data queue (DTAQ) parameter to receive a message whenever a spool file on that queue goes to a ready (RDY) status. Each time a spooled file on the output queue reaches RDY status, an entry is sent to the data queue.
You could have your spool files go to a output queue with no active printer writer running. When a spool file gets to a RDY status, your job would detect it through the data queue and copy the spool file to a database file. Then you could move the spool file to an output queue attached to a writer. This would ensure that the capture is done before the file prints.