|
> Mark Walter wrote:
> Here's a program that I wrote that does that.
>
Mark -
I'm not nit-picking, but with a simple modification,
you _don't_ have to create the outfile QRYFILEWK
before you can compile the above CLP. It's all a matter of knowing
which IBM-supplied outfile to use for compile purposes, along
with the appropriate overrides (see below).
All of the IBM-supplied outfiles exist in QSYS, prefixed
with QA. They are the model files that are used when an
outfile is specified on a command.
If you WRKOBJ OBJ(QSYS/QB*) OBJTYPE(*FILE),
you'll see a list of them.
The text on each file describes the commands that use them.
Regards,
Steve Landess
Austin, Texas
(512) 423-0935
----------------------------------------------------------------------------
--
Here is a modified version of your program that will compile
without having to first manuall execute the DSPOBJD command
to create the outfile named QRYFILEWK:
/******************************************************************
pgm parm(&lib)
dclf file(QSYS/QADSPOBJ)
dcl var(&lib) type(*char) len(10)
dcl var(&mbr) type(*Char) len(10)
/* put all query definitions into a temporary work file in QGPL */
/* This file has to be there for the program to compile */
dspobjd obj(&lib/*all) objtype(*qrydfn) output(*outfile) +
outfile(qgpl/qryfilewk) outmbr(*first *replace)
OVRDBF FILE(QADSPOBJ) TOFILE(QGPL/QRYFILEWK)
/* does the source physical file exist? */
/* if it doesn't, create it. */
chkobj obj(&lib/qrysource) objtype(*file)
monmsg msgid(cpf9801) exec(crtsrcpf file(&lib/qrysource))
/* if it does exist, remove all of the members */
rmvm file(&lib/qrysource) mbr(*all)
monmsg msgid(cpf7301)
/* file read loop */
read:
rcvf rcdfmt(qlidobjd)
monmsg msgid(cpf0864) exec(goto cmdlbl(eof))
/* add the member to the source file and retrive the query */
/* definition into the member you just added. */
addpfm file(&lib/qrysource) mbr(&odobnm)
rtvqmqry qmqry(&lib/&odobnm) srcfile(&lib/qrysource) +
srcmbr(&odobnm) alwqrydfn(*yes)
goto cmdlbl(read)
eof:
endpgm
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.