Virtually all the homegrown products use QMQRY under the covers. (Yes, I have one as well.)

If you run QMQRY to an outfile, I think you'll find that it processes the result set twice, once to put it to a temp file, then a second time to put it to your outfile. At least it used to work this way and it could be significant overhead if you had a large result set. You can see it happening if you watch the open files with a large result set.

That's why I mentioned the create table as (select ...) approach.

If you don't use QMQRY, then I think you'd have quite a bit of development effort to determine the data types of the result set and build an output file from them. (Of course, you'd think that IBM would have all that code somewhere in a re-useable form...)

Whatever, IBM RUNSQL doesn't support outfiles.


On 11/15/2012 8:04 AM, Vernon Hamberg wrote:
Hi Sam

Since I've written several of these SQL statement processors on my own
and now the ones we have in our products, I can't agree that putting in
OUTPUT parameters is all that difficult.

It's easy to use an API to get the exact parameter definitions from the
STRQMQRY command, for example. Or just look at a prompt and imitate it -
close enough.

Then it's simply a matter of passing the value to the STRQMQRY command
in the command-processing program for your command.

Even using the QM commands directly instead of STRQMQRY, this is pretty
trivial stuff, seems to me. But I've been playing with this for years,
so maybe I'm jaded!!


This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page