As far as I know there is no particual API for *QRYDFN meta manipulation.
But - there is a stored procedure called QSYS2.Print_Query_Definition
it will print the query definition, including the printer name, and with some basic SQL you can iterate it and spot the query you need without external tools.
with a reasonably recent IBMi you can even search with a regex thousand of spool files content with a regex just with SQL
here some hints:
https://www.ibm.com/support/pages/extract-information-qrydfn-object-types
ciao
------------------------------
--ft
------------------------------