MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » May 2002

RE: Passing parms to query



fixed

Dan said:

>I followed up on the thread earlier of
>passing parms to a query,
>and the results were good.

>SETVAR((LODATE 1011001))
>
>beautiful, but I tried it with
>SETVAR((LODATE *GE 1010101))
>and I get the error:
>
>Too many values in list for parameter SETVAR.
>
>I looked STRQMQRY up in the manuals (remember
>them) from V3R2 and it used the example of VAR1
>and VAR2 being SQL statements, but gave no
>indication of where these two variables belonged
>in the QUERY definition.

The error message is probably right.  The 'list of values' that SETVAR wants
are simple pairs:
((PARM1 value1)
 (PARM2 value2)
 (PARM3 value3))

SETVAR is confused because there are three things inside the parentheses,
not a pair.

The parameters (PARMn) relate to the QMQRY source directly:
select a,b,c from file where
  field1 = &PARM1 and
  field2 < &PARM2 and
  field3 > &PARM3

If you want to change the operator (in this case the *GE) you need to change
the underlying QMQRY sort of like this:

SELECT NAME,TOTAL
 FROM MASTER
 WHERE &WHERE
 ORDER BY NAME

It would execute various scenarios like this:
strqmqry master3 setvar((where 'TOTAL = 0'))
strqmqry master3 setvar((where 'TOTAL > 5'))

  --buck






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

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact