|
Joe M. wrote
> How do you specify a numeric selection?
<snip>
> 700 DCL VAR(&SEL_OHQ) TYPE(*DEC) LEN(70) VALUE(1000)
> 800
> 900 CHGVAR VAR(&WRK_QRYSLT) VALUE(+
> 1000 'BFPART *GT ' *BCAT '''' *CAT &SEL_PRT *CAT '''' +
> 1100 *BCAT '*AND' *BCAT+
> 1200 'I$UTMS = ' *BCAT '''' *CAT &SEL_UOM *CAT ''''
> +
> 1300 *BCAT '*AND' *BCAT +
> 1400 'QTYOH = ' *BCAT '''' *CAT &SEL_OHQ *CAT
>'''')
> * CPD0712 30 Operand does not have valid type for operator.
> * CPD0711 30 Operands in expression not same type.
I believe the CL compiler is simply saying you can not concantenate a
numeric value (&SEL_OHQ) onto a string - concantentation only works
on string (OK, *CHAR) variables. Changing the declaration for
&SEL_OHQ as follows should let you build your select string
DCL VAR(&SEL_OHQ) TYPE(*CHAR) LEN(7) VALUE('0001000')
Alternatively, you could declare &WRK_QRYSLT with an initial value of
the entire select string using dummy place holders for the variant parts.
Then use CHGVAR in conjunction with the %SST function to insert the
appropriate values into the select string, like so
DCL VAR(&WRK_QRYSLT) TYPE(*CHAR) LEN(512) +
VALUE('BFPART *GT XXXXXXXXXX *AND I$UTMS = XX +
*AND QTYOH = XXXXXXX')
CHGVAR VAR(%SST(&WRK_QRYSLT 12 10) VALUE(&SEL_PRT)
CHGVAR VAR(%SST(&WRK_QRYSLT 37 2) VALUE(&SEL_UOM)
CHGVAR VAR(%SST(&WRK_QRYSLT 53 7) VALUE(&SEL_OHQ)
CHGVAR handles the conversion from numeric to string value for you.
Of course, you end up counting characters this way, especially if the
fields in the select criteria change, but I find the code more readable
'cause I can see the entire select string "as is" instead of trying to
visualize the result of a lots of *CAT's and whatnot
HTH
Scott
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the Midrange System Mailing List! To submit a new message, *
* send your mail to "MIDRANGE-L@midrange.com". To unsubscribe from *
* this list send email to MAJORDOMO@midrange.com and specify *
* 'unsubscribe MIDRANGE-L' in the body of your message. 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.