|
Hi Amit: RTVQMQRY is your answer. It will create members in a Source Physical File. This is a sample code PGM PARM(&LIBRARY) DCLF FILE(QADSPOBJ) DCL VAR(&LIBRARY) TYPE(*CHAR) LEN(10) DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) RTVJOBA TYPE(&JOBTYPE) /* If interactive, submit to batch */ IF COND(&JOBTYPE *EQ '1') THEN(DO) SBMJOB CMD(CALL PGM(YOURPGM) PARM(&LIBRARY)) + JOB(QRYSRCBLD) RETURN ENDDO /* Produce output file of all query definitions in given library */ DSPOBJD OBJ(&LIBRARY/*ALL) OBJTYPE(*QRYDFN) + OUTPUT(*OUTFILE) OUTFILE(QRYLIST) DLTF FILE(QRYSEARCH/&LIBRARY) MONMSG MSGID(CPF0000) CRTSRCPF FILE(QRYSEARCH/&LIBRARY) RCDLEN(112) + TEXT('Query definitions') MONMSG MSGID(CPF0000) /* For each query in list (outfile), retrieve definition as Query Mgmt */ /* query source */ OVRDBF FILE(QADSPOBJ) TOFILE(*LIBL/QRYLIST) Main10: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(MAIN90)) /* + EOF */ RTVQMQRY QMQRY(&ODLBNM/&ODOBNM) + SRCFILE(QRYSEARCH/&LIBRARY) ALWQRYDFN(*YES) GOTO CMDLBL(MAIN10) Main90: DLTOVR FILE(*ALL) ENDPGM * * * E N D O F S O U R C E * * * This is the Result: H QM4 05 Q 01 E V W E R 01 03 03/02/11 09:38 V 1001 050 V 5001 004 *HEX SELECT ALL ADAENB, ADDCCD, ADCVNB, ADFCNB, ADDRNB, ADAJDT, ADAKDT, ADAQQT FROM AMFLIBQ/MBADREP T01 WHERE ADAENB = 03 AND ADAQQT > 0 AND ADAJDT = 1300101 Hope this helps! Regards, Hrishikesh Kotwal >From: "Amitava Banerjee" <AMITAVA.BANERJEE@xxxxxxxx> >Reply-To: RPG programming on the AS400 / iSeries <RPG400-L@xxxxxxxxxxxx> >To: <RPG400-L@xxxxxxxxxxxx> >Subject: Converting a Query to RPG >Date: Fri, 16 May 2003 15:15:21 -0500 > >Hi >Thanks. But actually I did not want to do it in those ways (WRKQRY, then print etc). I mean, I thought all the information should be some where in the system (some file ?). A generic program will read that and generate the RPG source for the query. It will be a generic program, that will convert any query to a RPG. > >I tried CRTQMQRY. But that did not give all information and whatever it gave is not in a specific format. Or did I do some thing wrong? > >Thanks >Amitava > >_______________________________________________ >This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list >To post a message email: RPG400-L@xxxxxxxxxxxx >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/mailman/listinfo/rpg400-l >or email: RPG400-L-request@xxxxxxxxxxxx >Before posting, please take a moment to review the archives >at http://archive.midrange.com/rpg400-l. > ---------------------------------------------------------------------- Attention NRI! Send money home easily. Just sign up!
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.