A Better Way to Get Query/400 Definitions?
May 31, 2002 Timothy Prickett Morgan
Hey, Ted:
I am writing in response to your article, “Print Query Defintions from a Batch Job” that was published in the May 22 issue of Midrange Guru, OS/400 Edition.
|  | 
A better solution is to use the Retrieve Query Management Query (RTVQMQRY) command, which works fine for a Query/400 definition (*QRYDFN object).
This puts the output into a source file that can be manipulated with a program.
See the following example:
PGM        PARM(&LIBRARY)
   DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)
   DCLF       FILE(DSPOBJD)
   CLRPFM     FILE(RTVQRYOUT)
   DSPOBJD    OBJ(&LIBRARY/*ALL) +
      OBJTYPE(*QRYDFN) +
      OUTPUT(*OUTFILE) +
      OUTFILE(QTEMP/DSPOBJD)
   OVRDBF     FILE(QTXTSRC) +
      TOFILE(QGPL/QTXTSRC) +
      MBR(RTVQRYTMP)
LOOP:
   RCVF       
 
							 