|
It's an error in the manual - make the following change VALUE('' *TCAT should be VALUE('''' *TCAT There was a recent post with a very elegant solution to the quoting problem - use a variable in your QMQRY, say, &APOST, and set it to '''' in the SETVAR parameter. You use it wherever you need in the SQL statement, so you'd have WHERE JOB = &APOST&COND1&APOST AND SALARY < &COND2 and the SETVAR would include SETVAR((&APOST '''')) - that's 4 apostrophes and the CHGVAR becomes CHGVAR VAR(&CHARJOB) VALUE(&VAR1) I think that's right ;-) HTH Vern Original message -------------- > > Hi, > I'm trying to pass a parameter to a QMquery via STRQMQRY and I > thought I'd found the solution > > Figure 66. Test Query SELECT Statement > DB2 for AS/400 Query Management > > > Query . . . . . . : SALARYQ3 > Library . . . . : EXAMPLE > Text . . . . . . . : TEST QUERY > SEQNBR |...+....1....+....2....+....3....+....4....+....5....+....6.... > 000001 SELECT JOB,DEPT,NAME,ID,YEARS,SALARY,COMM > 000002 FROM TESTDATA/STAFF > 000003 WHERE JOB = &COND1 AND SALARY < &COND2 > 000004 ORDER BY JOB,SALARY > * * * * * END OF SOURCE * * * > The CL program in Figure 67 > > htm> uses the query shown in Figure 66 > > htm> . > > Figure 67. CL Program Source File > SEU SOURCE LISTING > SOURCE FILE . . . . . . . EXAMPLE/SOURCE > MEMBER . . . . . . . . . CLPGM > SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ... > 100 PGM PARM(&VAR1 &VAR2 &VAR3 &VAR4) > 200 DCL &VAR1 *CHAR LEN(6) > 300 DCL &VAR2 *CHAR LEN(6) > 400 DCL &VAR3 *CHAR LEN(6) > 500 DCL &VAR4 *CHAR LEN(10) > 600 DCL &CHARJOB *CHAR LEN(10) > 700 CHGVAR VAR(&CHARJOB) VALUE('' *TCAT &VAR1 *TCAT '''') > 800 STRQMQRY QMQRY(EXAMPLE/SALARYQ3) QMFORM(EXAMPLE/&VAR4) + > 900 OUTPUT(&VAR3) + > 1000 SETVAR((COND1 &CHARJOB) (COND2 &VAR2)) > 1100 ENDPGM > > > > * * * * E N D O F S O U R C E * * * * > This is at: > http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/rzala/r > zalamsg.html > > But the CHGVAR above is illegal even though it's in an IBM manual! > Anybody any ideas on what I really need to pass a parameter similar to > this? I think I need to add a quote either side of the parameter and > yet not have the parameter end up in quotes. > > Regards > Ian > > > > > > > > > > ************************************ > This e-mail and any files transmitted with it are proprietary and intended > solely for the use of the individual or entity to whom they are addressed. If > you have received this e-mail in error please notify the sender. Please note > that any views or opinions presented in this e-mail are solely those of the > author and do not necessarily represent those of ITT Industries, Inc. The > recipient should check this e-mail and any attachments for the presence of > viruses. ITT Industries accepts no liability for any damage caused by any > virus > transmitted by this e-mail. > ************************************ > -- > 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.