The ON control statement designates a series of statements to process when no database records or sort records are available for processing.
The ON control statement can be supplied only once for non-sort logic (no SORT control statement), presort logic (statements preceding the SORT control statement), and logic after the sort (statements following the SORT control statement). The END control statement terminates the series of statements designated by the ON control statement.
ON ENDDATA … END
The ON control statement is used for various purposes, but it is especially convenient for printing final totals, as follows:
/DEFINE CNT BIN /PRINT ID 'SYSOUT ID /PRINT GEN ‘GEN’ /PRINT SEQ ‘SEQ’ /SET CNT=CNT+1 /ON ENDDATA / PRINT 'TOTAL REPORTS =' SKIP(2) / PRINT CNT /END
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|