I have 4-fileds on Display File like frdiv(zoned),todiv(zoned),frpr(char),topr(char) all the fields are of size 2 only.
I am using a "OPNQRYF" to filter the records froma Physical file (pfdiv), it containes 1,25,000 records .
Through this openqryf all the selected records I will copy to a file (pftemp) using "CPYFRMQRYF".
Then I will use the pftemp file in the RPG/400 programme to disply on Subfile Screen.
I have written a CL-programme like this:
PGM
DCLF FILENAME(DISPLAY-FILE)
OVRDBF PFDIV(PHYSICAL-FILE)
OPNQRYF QRYSLT('(&FDIV *GE &FRDIV *AND &FDIV *LE &TODIV) *AND (&FPR *GE &FRPR *AND &TPR *LE &TOPR)')
CPYFRMQRYF FROMF(PFDIV) TO(PFTEMP)
CALL PGM(RPG)
CLOF PFDIV
DLTOVR PFDIV
ENDPGM
WHERE &FDIV = FROM DIVISION
&TDIV = TO DIVISION
&FPR = FROM PROJECT
&TPR = TO PROJECT
I am entering values 10,50,A1,A9 respectively
10,50 means from 10(division) to 50
A1,A9 means from A1(Project) to A9
ALL THE ABOVE FIELDS FROM THE PHYSICAL-FILE (PFDIV)
Here , once I am running this programme the query is not working properly, it is showing an error ,
Please can anyone help me in this regards.
Thanks In Advance.
Software/Hardware used:
ASKED:
February 1, 2009 2:21 PM
UPDATED:
February 2, 2009 5:52 PM
OPNQRYF has a built-in function of %RANGE. This can simplify a select statement.
For example, to select a range of divisions the select statement would include ‘DIVISION = %Range(‘ *CAT &FDIV *BCAT &TDIV *CAT ‘)’
Another hint – be sure the variables concatenated into your query select string are in character format. I’ve found that OPNQRYF is a lot happier with character data in the select statement.