× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Passing parameters to a query
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Thu, 11 Jun 1998 10:25:10 -0400
  • Organization: commsoft

On Thursday, June 11, 1998 8:02 AM, Damian Esealuka 
[SMTP:desealuka@elliman.com] wrote:
> Can someone show me or direct me on how to run a query through a CL that
> will prompt the user to enter values(selection) and use the entered
> values to complete the query.

A while ago, we had a thread on this very topic.  There's no simple 
answer, but Vernon Hamberg's note should get you started...

On Tuesday, April 28, 1998 7:19 PM, Vernon Hamberg
[SMTP:hambergv@goldengate.net] wrote:
> Do I remember someone asking about sending variable data to
> Query/400
> queries? I just read something in Query Management Programming that
> offers
> a way to do this.
>
> What you do is use a special syntax in the record selection part.
> This
> syntax is like the following:
>
>     :t01.varname
>
> You cannot run these so-called dependent queries (they're designed
> for
> merging in OfficeVision) with RUNQRY, but you *can* with STRQMQRY
> ALWQRYDFN(*ONLY). With this command you can send variable data to
> the
> query, using the VAR parameter of STRQMQRY. The variable name to
use
> that
> corresponds to the above is
>
>     t01_varname
>
> You may need an ampersand (&) in front of the name. The VAR
> parameter is a
> list of name-value pairs.

By using RTVQMQRY one can extract the SQL statement from the QRY/400
query.  Just say ALWQRYDFN(*YES).  Once you get the source, you can
 add variables to it like so:

SELECT NAME,AD1,CITY FROM CUSTMAST ORDER BY CITY
becomes
SELECT NAME,AD1,CITY FROM CUSTMAST WHERE ZIP=&zip ORDER BY CITY

CRTQMQRY and then run with the STRQMQRY command ALWQRYDFN(*YES).  If
you don't specify ZIP on the SETVAR parm, QMQRY will prompt you for
it!  Try it; it's pretty cool.  By specifying ALWQRYDFN(*YES) you get
to keep the formatting of the query while using your own SELECT
statement.  You can have multiple variables, like WHERE ZIP=&zip AND
NAME LIKE &name...


Buck Calabro
Commsoft, Albany, NY
mailto:mcalabro@commsoft.net

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.