To concatenate this 3 numeric fields just do
I normally create a QRYSLT field
CHGVAR &NEWDATE VALUE((TRYEAR*10000)+(TRMONTH*100)+TRDAY)
CHGVAR &QRYSLT VALUE(‘&PROCESSDATE *GE ‘ *CAT + &NEWDATE *CAT ‘ *AND &NEWDATE *LE ‘ *CAT &CYCLEDATE ‘)
OPNQRYF FILE((XXXXXXX)) QRYSLT(&QRYSLT) …..
that’s not quite it …
If TRYEAR ,TRMONTH and TRDAY are in the file you’re doing the open query on you have to pass the computational method not the value. And PROCESSDATE and CYCLEDATE are fields in the CL not the query file and are char types.
&Newdate is a char type!
CHGVAR &NEWDATE VALUE(‘((TRYEAR*10000)+(TRMONTH*100)+TRDAY))’)
CHGVAR &QRYSLT VALUE(&PROCESSDATE *CAT ‘ *GE ‘ *CAT +
&NEWDATE *CAT ‘ *AND ‘ *cat &NEWDATE *LE ‘ *CAT &CYCLEDATE )
I think this is closer.
The OPNQRYF will have something like that
QRYSLT(‘FILEDATE = %Range(LASTCYCLE CURRENTCYCLE)’)
Of course, you should mount a the query string to insert LASTCYCLE and CURRENT CYCLE values in it but the most important is the MAPFLD parameter to achieve what you are looking for.
CHGVAR &QRYSLT VALUE(‘FILEDATE = %Range(‘ *CAT +
&NEWDATE *CAT ‘ ‘ *CAT &CYCLEDATE *CAT ‘)’)
Wilson – that’s great
1. TRYEAR, TRMONTH and TRDAY are numeric in the file
if these are character then they need to be || togeter and a ”’ added before and after
&NEWDATE and &CYCLEDATE
2. TRYEAR contains the 4 digit year ie. 2009
3. &NewDate and &CycleDate are char if they aren’t create &NewDateC and &CycleDateC and use ChgVar to set them equal to the numerics.
That was a great start .. as you know OPNQRYF is a bear, it accepts and compiles almost anything and then doesn’t give much of a hint on why threre aren’t any records.
I think that Mohan K got his query to run, since he came back with performance questions.