Yes, you want to get a file/list of the spool files in an outq
this could be done in two steps
1. WRKOUTQ OUTQ(youroutq) OUTPUT(*PRINT)
when you look at this
Read each record from this file you will find
Spool file # 72-78
1.a or you could use WRKSPLF OUTPUT(*PRINT) — layout is a little different
2. copy this spool file to a physical file – easy this is the first spool file of this job.
3. read each row in the file
4. if the spool file is one you want extract the fields needed.
I’m sure someone else has some handy tools or API’s the make this easier.