Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Print OUTQ SPOOL Monitor?
has no ratings.
Published: 27 Aug 2012
Revised: 23 Jan 2013 - 4133 days ago
Last viewed on: 16 May 2024 (6094 views) 

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.

Print OUTQ SPOOL Monitor? Published by: Bob Cozzi on 27 Aug 2012 view comments(3)

I'm working on a Print Monitor that will trap any SPOOL files created and do something with them. Right now I have it either copying the SPOOL file to another output queue or saving it for archival purposes.

I'm wondering if the QIBM_NOTIFY_CRTSPLF environment variable posts DTAQ entries before, during or after the SPOOL file is in RDY state? I can't really find the explicitly stated anywhere.

Also, does anyone else use one of these kinds of things? If so what do you do with it (use it for)?

Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: jjcllhn
Premium member *
Comment on: Print OUTQ SPOOL Monitor?
Posted: 11 years 8 months 20 days 15 hours 30 minutes ago
Edited: Mon, 27 Aug, 2012 at 22:18:28 (4282 days ago)

Given the name of the environment variable, I'd take IBM literally from the manual:

"As spooled files are created, the entries are logged in the data queue."

If that's true, would mean you have to deal with data queue entries for open spool files and empty spool files. Maybe consider deferring the processing of the data queue entries until the job has completed.

Wrote a output queue handler to archive SNA-RJE emulation printer output 15 years ago. Created a data queue, configured the output queue to write dq entries when RDY, converted spool files to PDFs (some PSF/IPDS configuration magic from one the Printing RedBooks) and shipped 'em off to the IFS (or was it QDLS?). Burned the older PDFs to CDROM once a quarter. Much neater than the shelves of boxes of duplicate paper laying around, heck of lot more efficient to research older items, way cheaper than the optical systems being pushed at the time (fortunately didn't have to meet legal archival requirements- just providing a way to research items from the mainframe)

Posted by: bobcozzi
Site Admin ****
Comment on: Print OUTQ SPOOL Monitor?
Posted: 11 years 8 months 20 days 15 hours 5 minutes ago
Edited: Mon, 27 Aug, 2012 at 22:34:25 (4282 days ago)

I now call the Retrieve SPLF Attributes API and test for the STATUS='*OPEN' and that's helpful. I sleep(5) and then lop around again. I may put in a counter t limit the number of retries. Next I'll have to see if I can check for status='*FIN" so I can "skip it". But I have a feeling I can't actually process that or retrieve the attributes, so I'll probably just get a message back.

Thanks Jack!

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Print OUTQ SPOOL Monitor?
Posted: 11 years 8 months 20 days 2 hours 23 minutes ago

Haven't messed with the environment variable.

I've monitored queues with a program that periodically runs List Spooled Files (QUSLSPL) API on selected queues (list of queues comes from a table). Uses varied - cleanup, archive, ...

I see a DTAQ() keyword on CRTOUTQ, which might be simpler than the environment variable, but wouldn't work well if you want to handle every single queue. Sounds like it would be easier than what I had done in the past, though. Good thing is the *DTAQ messages are when spooled file is RDY, so no worry about checking status. Bad thing is if it goes from RDY to HLD to RDY again, you get another message for the same file. Program would have to update an attribute, maybe USRDTA, or something, so that it could avoid processing the same file twice. Or log them to a file (which would work if you're archiving). If you're moving or deleting, maybe this wouldn't matter.