This example shows how to optimize to minimize the number of records read.
OVRDBF FILE(FILEA) SHARE(*YES) OPNQRYF FILE(FILEA) QRYSLT('CODE *EQ "B"') + KEYFLD(CUST) OPTIMIZE(*MINWAIT) CALL PGM(PGMA) POSDBF OPNID(FILEA) POSITION(*START) CALL PGM(PGMB) CLOF OPNID(FILEA) DLTOVR FILE(FILEA)