DSPOBJD OBJ(*ALL) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) OUTFILE(QTEMP/PRT)
<i>SQL:</i> DELETE FROM prt WHERE not ODOBAT like ‘%PRT%’
DSPOBJD OBJ(*ALL) OBJTYPE(*OUTQ) OUTPUT(*OUTFILE) OUTFILE(QTEMP/OUTQ)
<i>SQL:</i> SELECT * FROM outq a WHERE a.ODOBNM [not] in (SELECT b.ODOBNM FROM prt b)</pre>
That uses DSPOBJD to create a file of all device descriptions. I named my example file PRT and put it in QTEMP. I then used interactive SQL to DELETE all devices that were not any kind of printer.
And it uses DSPOBJD again to create a file of all *OUTQs. (In my case, I chose all *OUTQs in my library list. You can set a library if you wish.) I named that file OUTQ and created it also in QTEMP. I then used interactive SQL to SELECT all *OUTQs from the file that had a matching *DEVD object name in the previous PRT file. You could insert the [not] operator if you wanted to list *OUTQs that <i>did not have</i> a matching *DEVD.
That’s one basic outline of a possible procedure you could follow.