Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
There's an option that came about in V5R4 but wasn't working until V6R1 and later. That option is for SELECT statements in SQL. If you specify your SELECT statement and follow it with the OPTIMIZE FOR clause, it will return that "first page" of records much faster.
SELECT A,B,C FROM CUSTMAST WHERE STATE in ('IL', 'IN', 'IA') ORDER BY STATE OPTIMIZE FOR 40 ROWS