|
Vern, Thanks for you help - I have not had a chance to try this yet. I hope I will get back to it tomorrow. I did not know about the SETVAR parm being case sensitive. Is that documented anywhere? I have been looking at that command for a few years, and have not had the need to run it interactively while supplying variables in the query. I wondered why Tom Liotta had put his variable "q" in single quotes in his archived example posted a few weeks ago ( http://archive.midrange.com/midrange-l/200508/msg00958.html). His example was; Assuming four CHAR columns, for your QM SQL -- INSERT INTO OUTQFIX VALUES(&q&OUTQFIX_OUTQ&q, &q&OUTQFIX_AUTHLIST&q, &q&OUTQFIX_CHANGED&q, &q&OUTQFIX_MSGID&q) And to your STRQMQRY command: STRQMQRY QMQRY(OUTQFIX) + SETVAR((OUTQFIX_OUTQ &OUTQFIX_OUTQ) + (OUTQFIX_AUTHLIST &OUTQFIX_AUTHLIST) + (OUTQFIX_CHANGED &OUTQFIX_CHANGED) + (OUTQFIX_MSGID &OUTQFIX_MSGID) + ('q' '''') + ) I liked how he uses a variable to pass the quote into the query, and I have adopted his idea. Now I have learned 2 things in such a short time! Thanks Tom and Vern for your help. Jim At 05:16 PM 9/26/2005 Monday, you wrote: SETVARs are case-sensitive - be sure that the variable is &Q and not &q in the QMQRY source. Someone said that lowercase variables will always prompt. This is true if you do not force them to lowercase in STRQMQRY - remember, a lowercase value without apostrophes is actually uppercase when passed. Consider this example: select * from &l/&f in a QMQRY called SETVARCASE STRQMQRY QMQRY(SETVARCASE) SETVAR((l 'QIWS') (f 'QCUSTCDT')) will prompt you. Actually, the SETVAR elements you specified are ignored because they do not match the names in the QMQRY. However, consider STRQMQRY QMQRY(SETVARCASE) SETVAR(('l' 'QIWS') ('f' 'QCUSTCDT')) which does not prompt you. Actually, the command help is wrong in this matter. Here is what it says: Because lower-case characters in variable names are changed to upper-case characters when passed to the command processing program, you cannot use this parameter to set values for variables with mixed case names. But try this select * from &Library/&File in a QMQRY called TSTMXDCASE. Then use strqmqry tstmxdcase setvar(('Library' 'qiws') ('File' 'qcustcdt')) which works fine. So the rule is not, they must be uppercase in the QMQRY, the rule is that the case must match. It's just a little more error-free to use uppercase in the QMQRY. But you get lots more flexibility with mixed-case. Of course, you only have 50 to use anyway. ;-) HTH Vern At 04:49 PM 9/26/2005, you wrote: Hello, I've been searching IBM info center,and the list archive for a few hours now, and I can't see if what I want to do can be done. I have a QMQry that has parms passed to it. CL is as follows. DCL VAR(&Var1) + TYPE(*CHAR) + LEN(9) DCL VAR(&Q) + TYPE(*CHAR) + LEN(1) + VALUE('''') STRQMQRY QMQRY(NameOQry) + QMFORM(*QMQRY) + SETVAR((Variable1 &Var1) (q &q)) The Var1 is passed to the program as character. What I want is for the qry to run with the passed parms, but when it is run in an interactive job, I get prompted for the variables Var1, and 'Q'. Anyone know how to make it use the passed parms with running interactively? Thanks! ---------------------------------------------------------------------------------------------- Jim Essinger Senior Programmer/Analyst UnLtd Support Services PO Box 730 Fruitland ID 83619 208-452-4058 Ext 133 ---------------------------------------------------------------------------------------------- -- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l. -- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
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.