
Return to the Query Tips
Build Source File Member for Query Definitions.
From: Allen, Stuart
Here's a start. It puts source for each query into a source file member, after which you could use WRKMBRPDM option 25.
PGM
/***********************************************************************/
/* BUILD QUERY REFERENCES FILE */
/* */
/* Submits itself to batch if interactive, then does DSPOBJD of all */
/* queries in *ALLUSR libraries to output file QRYREF in QGPL. */
/* */
/* REVISION HISTORY: */
/* 10/11/1999 pcd Program created. */
/* */
/***********************************************************************/
DCLF FILE(QADSPOBJ)
DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1)
/* If interactive, submit to batch */
RTVJOBA TYPE(&JOBTYPE)
IF COND(&JOBTYPE *EQ '1') THEN(DO)
SBMJOB CMD(CALL PGM(QRYSRCBLDC)) JOB(QRYSRCBLD)
RETURN
ENDDO
/* Produce output file of all query definitions in all user libraries */
DSPOBJD OBJ(*ALLUSR/*ALL) OBJTYPE(*QRYDFN) +
OUTPUT(*OUTFILE) OUTFILE(MISTOOLS/QRYLIST)
/* For each query in list (outfile), retrieve definition as Query Mgmt query
source */
OVRDBF FILE(QADSPOBJ) TOFILE(MISTOOLS/QRYLIST)
Main10:
RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(MAIN90)) /*eof*/
RTVQMQRY QMQRY(&ODLBNM/&ODOBNM) +
SRCFILE(MISTOOLS/QUERIES) ALWQRYDFN(*YES)
GOTO CMDLBL(MAIN10)
Main90:
DLTOVR FILE(*ALL)
ENDPGM
[report a broken link by clicking here]






