• Subject: Re: Passing parameters to QUERY/400
  • From: Alan Novick <ANovick@xxxxxxxxxxxxxxxx>
  • Date: Tue, 22 Dec 1998 09:31:47 -0500

Mordy,

I had a similar problem when querying on our product number field, which
is a character field but I wanted to select based on number values.  The
trick was to use three quotes like this:

STRQMQRY QMQRY(TEST) SETVAR((P1 '''9900''') (P2 '''9999'''))

hope this helps

Alan Novick
Pressman Toy Corporation
New Brunswick, NJ

Mordechai Gluck wrote:
> 
> Hi to all,
> 
> Here is my problem. I have a query that does record selection based on a
> RANGE of values which always has to be changed by the user.  I would like to
> automate the selection by running this job in batch called by a weekly pgm
> which will automatically change the values based on certain conditions and
> pass it to  the query. So I tried using the following code.
> 
> PGM        PARM(&IT1  &IT2  )
> DCL        VAR(&IT1  )  TYPE(*CHAR) LEN(4 )
> DCL        VAR(&IT2  )  TYPE(*CHAR) LEN(4 )
> 
> STRQMQRY   QMQRY(MGLUCK/BLANCA2) ALWQRYDFN(*ONLY) +
>              SETVAR((IT1   &IT1  ) (IT2   &IT2  ))
> 
> but the SQL engine isn't satisfied with a character field using RANGE as the
> operator.
> This is the message I'm getting. -
> Message ID . . . . . . :   SQL0401       Severity . . . . . . . :   30
> Message type . . . . . :   Diagnostic
> Message . . . . :   Comparison operator BETWEEN operands not compatible.
> 
> I tried the record selection with = operator  and it works.
> 
> Any ideas will be greatly appreciated.
> Thanks,
> Mordy Gluck
> 
> +---
> | 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
> +---
+---
| 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-Ups:
Replies:

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.