Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I have users who create reports at month-end. I've built a hook into the Print Monitoring exit point via a data queue. When a report is created on any outputq by the use, that report is copied to an archival outq for safekeeping.
Sadly, when the user does WRKSPLF they also see the copied SPOOL file now in the Archive outq, and often will just delete it along with their own reports once they've printed hard copy.
We need to keep these for archival purposes, however.
I'm looking for an exit point or SPOOL File Attribute that says "you can't delete this". Any suggestions?
Assuming your process retains the user as the owner of the spool file, it's going to be difficult to prevent the owner from managing spool files it has created. If WRKSPLF sends a DLTSPLF command, you'd be able to examine the command using the QIBM_QCA_CHG_COMMAND exit point and change it if the command was pointed at an archive output queue, but if it calls the delete spool file api directly that won't help.
If you're using the QSPCRTSP to duplicate the spool file, you might consider changing the owner (creating the duplicate under a spool archive user profile), retain the originating job info in the USRDFNDTA, and changing the archive output queue to allow public display of its entries (AUT(*USE), DSPDTA(*YES)).
Change the Owner is the solution but I could swear someone told me there was a way to attach a data queue to a specific OUTQ and then monitor that data queue--I could then change the owners at things were added to the OUTQ (and even change to SAVE(*YES) so that they won't evaporate if inadvertently printed.)
Apparently there is a DTAQ parameter on OUTQ De!--script--ions. But it only signals when the SPOOL file is in RDY (ready) state. I need it even if the SPOOL file is created in SAV state.