So I take it you got the open query working.
OPNQRYF simplifies the RPG,
1. you only see the records/fields you want.
2. it’s dynamic the Query Select can be built on the fly, or you can have different ones for different cases without having to alter the RPG
3. the open query can be used through a number of processes within the job
Since SQL was added to RPG we see less use of OPNQRYF but it does have some advantages
For speed, you might get a big improvedment with an SQL with the correct indexes. Of couse, this means your system is maintaining additional index(s).
If you could accept the date as the primary key you could drop the OPNQRYF and just use SETLL – Read Loop with an logical built on Year – Month – Day (whatever additional fields) looping until you reach a date that’s got the date > upper limit. Of course this means your system will be maintaining an additional logical.