For nonfile events:
AT START [OF] REPORT statement
For fields in a file:
CHECK fname ,
AT START [OF] fldname statement
END fldname OR fldname...
WATCH may be used as a synonym for CHECK. Fname can be either an internal file name declared earlier or the special keyword VARIABLE[S]. Fldname must be a declared field name from the file fname or a variable if VARIABLE[S] is used. The choices of TOP or START are provided to satisfy personal tastes; the type of event specified will be the same (likewise for BOTTOM or END). Statement can be any valid statement as described at the beginning of the section on statement.
Any nonunique field references will be resolved using fname.
Breaks allow the normal processing of data to be interrupted in order to handle special events that occur. After the event has been processed, normal execution will resume at the point it was interrupted.
Setting breaks is accomplished by two statements. In both statements there is the concept of the top and bottom, or the start and end, of some event. The top (start) of an event occurs just after the event has occurred. The bottom (end) of an event occurs just before the event is about to occur. For example, the TOP OF PAGE event occurs whenever the first character is about to be output on each page, and the BOTTOM OF PAGE event will occur after the last line has been printed on a page but before the paper has been moved to the top of the next page.
The CHECK (WATCH) file statement is used to set breaks on fields that are in a particular file. For this statement there is a special file name, VARIABLES, to set breaks on variables instead of fields.
The top (start) of a field event will occur just after a field has changed to a new value. At the time of the break all of the totals for the file will have been done, and all of the fields in the file will have their new values.
The bottom (end) of a field event will occur just before a field is about to change. At the time of the break no totals for the new values will have been made, and all of the fields in the file will still have their old values.
The AT statement is used to set breaks on nonfile events.
The top (start) of a report event will occur just before the first character is about to be printed. At the time of the break, all initializations have been done.
The bottom (end) of a report event will occur after the end of the special MAIN procedure is reached. At the time of the break, all totals have been accumulated, all end of field events have been processed, but the last end of page event has not been processed and will be done after the end of report event.
The top (start) of a page event will occur just before the first character is about to be printed on each page. Before the event is processed, the printer will be spaced down to FIRSTLINE (see setting report attributes).
The bottom (end) of a page event will occur just after the last new line character has been printed on the last line of each page. After this event has been processed, the printer will be spaced down to the top of the next page.
AT TOP OF PAGE
CHECK master, AT START OF type OR dept
CHECK master, AT END OF type