|
Please refer to the OS/400 CL Reference
Snipped here is the relevent section for your problem
QRYSLT
Specifies the selection values used (before grouping) to determine
which records are available by using the open query file.
*ALL: All records in the physical or logical files, members, and
record formats specified on the FILE parameter (after join processing,
if required) are selected.
'query-selection': Specify an expression of up to 5000 characters
(enclosed in apostrophes) that describes the values used to determine
which records are selected. Any logical expression formed from
relations can be specified (such as *EQ and *NE) of field and constant
values or functions of field and constant values. At least one field
name is specified in each relation. However, a field cannot be
specified that depends on an aggregate function either directly in its
definition or indirectly by referring to a mapped field. Refer to the
"Expressions" section of "Additional Considerations" on page 3.1.921
of this command description for a complete list of the operators used
for this parameter.
For example, to select all records for which the value of field CUSNBR
is less than 7000 and the value of field BALDUE is greater than 90% of
the value of field CRLIMIT, specify the following:
QRYSLT('CUSNBR<7000 *AND
BALDUE>CRLIMIT*0.9')
Each field name may be qualified with either a file name or number
that indicates which element in the list of files, members, and record
formats specified on the FILE parameter contains the field. The
special value *MAPFLD may be used to qualify the field name if the
field is defined on the MAPFLD parameter.
As you see above the QRYSLT must be a character string that represents the
query. The problem you are having is that you are attempting to pass
variables and other things which QRYSLT does not know about.
This is assuming your &XFROM and &XTO fields are alphanumeric rather than a
numeric type.
'VENDOR *EQ (%RANGE( ' || '&XFROM || ' ' || '&XTO || ')'
Personally I prefer to create a variable and do all my concatenation to the
variable and then pass the variable as the QRYSLT
CHGVAR &QRYSLT VALUE('VENDOR *EQ (%RANGE( ' || '&XFROM || ' ' || '&XTO ||
')')
Hope this helps
Eric
______________________________________________
Eric N. Wilson
President
Doulos Software & Computer Services
2913 N Alder St
Tacoma WA 98407
----- Original Message -----
From: keshava narasimha <anandthirta@hotmail.com>
To: <RPG400-L@midrange.com>
Sent: Tuesday, August 17, 1999 7:40 AM
Subject: opnqryf
> Hi !
>
>
> This could be a very simple question to most of you .
>
> Is this the right way to define the built-in fn.%RANGE in the OPNQRYF?
>
> Eg.OPNQRYF QRYSLT('VENDOR *EQ (%RANGE((&XFROM) ( &XTO))')
>
> VENDOR is a database file field
> XFROM (5,0) & XTO (5,0) are the screen fields.
>
> The query doesn't seem to be running.
>
> I tried with *GE & *LE also but I was left with run time errors.
>
>
> Can I get help!!
>
>
> Thanks in advance .
>
> kESHAV
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
david@midrange.com
> +---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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 mailing list archive is Copyright 1997-2025 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.