This example shows total-only processing with record selection.
OVRDBF FILE(FINTOT) TOFILE(FILEA) SHARE(*YES) OPNQRYF FILE(FILEA) FORMAT(FINTOT) + QRYSLT('CODE *EQ "B" ') MAPFLD((COUNT '%COUNT') + (TOTAMT '%SUM(AMT)') (MAXAMT '%MAX(AMT)')) CALL PGM(PGMG) /* Created using file FINTOT as input */ CLOF OPNID(FILEA) DLTOVR FILE(FINTOT)
You can use the GRPSLT keyword with the final total function. The GRPSLT selection values you specify determines if you receive the final total record.