This item is required only to classify iSeries, eServer™ i5, or System i5® file records into several groups. When no value is specified in GROUP BY, all the records are treated as a single group.

If GROUP BY is not displayed, select Group functions at the bottom right of the screen. Then, GROUP BY appears. GROUP BY and HAVING are displayed concurrently. You can specify either, both, or neither.

When GROUP BY and HAVING are displayed but you do not want to specify either, select Remove Group functions. The two items disappear.

To classify several records into groups, specify one or more fields to act as the base for grouping. Records are grouped according to the field specified first, then by the field specified second, and so on. For example, suppose that the following groupings are specified:
In this example, the records are first grouped by SHIFT. Records belonging to a single group will subsequently have the same value as SHIFT. Then, the records in each group are grouped by DEPTNO. When there is only one record having a certain SHIFT value, the group has only one record.

Delimit field names with commas. Blanks can be specified to improve readability. Up to 50 field names can be specified. These fields must have been defined in the record format defined in FROM.

If a field cannot be found, selecting Browse displays a list of all the fields contained in the record.

With GROUP BY specified, specify SELECT to transfer the summary record of each group.