RATE THIS ANSWER
0
Click to Vote:
0
0
Hi Khadar
OPNQRY generates frequent questions
1. If you are going to use the opnqry on subsequent programs you should
use SHARE(*YES) on the OVRDBF then you do not need the CPYFRMQRYF when the override is in effect it will look like the PFDIV only contains the selected fields.
2. OPNQRY should include the file name --PFDIV
3. The QRYSLT string is sent to the database engine without interpertation.. you are sending this
&FDIV *GE &FRDIV *AND &FDIV *LE &TODIV) *AND (&FPR *GE &FRPR *AND &TPR *LE &TOPR)')
you must send something that looks a lot like SQL --
(FDIV *GE 10 *AND FDIV *LE 50) *AND (FPR *GE 'A1' *AND FPR *LE 'A9')
where FDIV and FPR are fields in the file
To build this string DCL a string var
CHGVAR SLTSTR ('(FDIV *GE '
*CAT &FRDIV
*CAT ' *AND FDIV *LE '
*CAT &TODIV
*CAT ') *AND (FPR *GE '''
*CAT &FRPR
*CAT ''' *AND FPR *LE '''
*CAT &TOPR
*CAT ''')')
Then use this string in the qryslt clause of the OPNQRYF
Where the string needs a quote in the output to deliniate a string value put
two '' which CL reads as insert a quote not as terminate a string.
Where we need both an insert a quote and a terminate a string you actually put in 3 ''' s
good luck
Phil
Last Answered:
Feb 1 2009 4:04 PM GMT by Philpl1jb 
24610 pts.