Enform Plus Reference Manual
Clauses
Enform Plus Reference Manual—422684-001
5-32
BY and BY DESC Clauses
BY and BY DESC Clauses
The BY and BY DESC clauses group and sort target-records according to the value of a
specified field. The syntax of the BY and BY DESC clauses is:
by-item
is the name of a field from an input record whose values are to be used to group and
sort target-records.
BY and BY DESC clauses group and sort records according to the field values. The BY
clause sorts the records in ascending order according to the value of the specified field;
the BY DESC clause sorts in descending order. The following example groups and sorts
the partnum field:
BY partnum,
When more than one sort is specified, Enform Plus uses a major-to-minor sorting
precedence. Enform Plus determines the sorting precedence by the order in which a BY
or BY DESC clause appears in a LIST or FIND statement. The first BY or BY DESC
clause has the highest priority, the next one second priority, down to the last BY or
BY DESC clause.
When a BY or BY DESC clause is used with a LIST statement, Enform Plus prints only
the first instance of a grouped value in a report. When a BY or BY DESC clause is used
with a FIND statement, Enform Plus writes all of the values of a grouped value to the
physical output file or transmits all of the values to the host language program.
Several clauses require that a field be grouped by a preceding BY or BY DESC clause.
See the CUM, PCT, SUBTOTAL, AFTER CHANGE and BEFORE CHANGE clauses in this
section and Target Aggregates in Section 3, Enform Plus Language Elements
.
{ BY } by-item
{ BY DESC }