Groups of records are formed by combining the records in a file in accordance with a common criterion, the grouping criterion.
In order to do this, it is necessary to specify in the SET-GROUP-ATTRIBUTES statement the fields in the input record which constitute the grouping criterion (BC, EF and IK in the example). Defined groups can be output together with data from this group and information specified by the user.
When a group is formed, editing of records (SET-PAGE-LAYOUT) is implicitly specified.
Forming a group with a group break
One or more fields of the input record are defined as the grouping criterion. Consecutive records with the same grouping criterion form one group. If all the records with the same grouping criterion are to be identified as a group, the file must be sorted according to this grouping criterion (e.g. by means of the software product SORT; see the manual [4] "SORT").
A group break occurs whenever two consecutive files with different grouping criteria are detected when reading a file.
PERCON provides routines which are executed whenever a group break occurs. These routines, “group leader” and “group trailer”, are executed before and after a group break, respectively.
The following actions can be performed in the event of a group break:
editing of group break lines from fields of the input record, from keywords and literals
formatting of group break lines with the aid of user modules
line feed by 1 to 15 lines
page feed by one page
output of totals of specified record fields of the relevant group.
Example
Output file
Group definitions can be nested, i.e. several overlapping group criteria can be defined for a single file.
This gives rise to the concept of group levels. Up to 8 group levels are possible. Priorities are assigned by numbering the levels from 1 to 8, level 1 being the highest level. If a group break occurs on a higher priority level, it also takes place on all lower levels, even if the criterion for a group break is not satisfied in these groups. An example of a group break is given on "Formation of groups ".
Each group level of a file is assigned a group counter (see "Keywords ").