|
midrange-l-request@xxxxxxxxxxxx wrote:
10. RE: Running SQL commands from CL (or elsewhere) (Scott Klement)Well, you could write the SQL statements programmatically into the source member used by RUNSQLSTM just the same as you can write the statements to an IFS text file to be used by the QShell db2 command with the -t -f parameters.Except that CL can't write data to a source file (directly). You'd have to call an HLL or QShell to write the records, and if you're going to do that, you may as well use the HLL or QShell to execute the SQL commands directly rather than writing it to a source file.
Although generally true, there are some exceptions that don't require HLLs. (When you don't have licenses for HLLs, you _find_ ways. NOT for general use, but sometimes...) CL can call QUSCHGUS and build strings within user spaces. That's been understood for a long time. However, a user space is acceptable as the FROMSTMF() value of a CPYFRMSTMF command and that's less known. That means that CL can "write streamfile records" into a user space and then copy those into a source file member. It takes some practice to understand EOL characters, CCSID, etc. CL can also call the QLGSORT and QLGSORTIO APIs. Those can accept "records" from an input buffer, i.e., a CALL parm variable, and output the records to a file. The CL can be written so one record is output per call or a block of records are passed per call. The APIs aren't fun, but they do work. Create a couple command shells for the APIs and you have a kind of 'prototype'. And there's always REXX. Tom Liotta
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.