ENFORM User's Guide

Sorting and Grouping Selected Information
Developing an ENFORM Query
3–32 058058 Tandem Computers Incorporated
If a BY or BY DESC clause is specified in a FIND statement, duplicate values are
included in the FIND file. For instance, consider the query and the diagram of a FIND
file shown in Figure 3-11.
Figure 3-11. Sample ENFORM Query and FIND File Diagram
Ordernum Partnum
0021
0021
0021
0021
0025
• • •
0244
2001
2403
4103
0244
• • •
FIND File Diagram:
ENFORM Query:
OPEN odetail,orderup;
FIND orderup
(BY odetail.ordernum,
odetail.partnum );
Notice that all the values of ordernum appear in the FIND file.
When multiple BY, BY DESC, ASCD, and DESC clauses appear in the same query,
ENFORM establishes a major to minor sort sequence. The first field name modified by
a BY, BY DESC, ASCD, or DESC clause has first priority, the second next priority, and
so on, down to the last. In the following example, regnum is sorted and grouped first,
branchnum is sorted next, and job is sorted and grouped last:
OPEN employee;
LIST BY DESC regnum,
BY DESC branchnum,
BY job;
Report:
REGNUM BRANCHNUM JOB
------ --------- --------
99 1 MANAGER
5 3 MANAGER
2 1 MANAGER
SALESMAN
1 2 SALESMAN
1 MANAGER
...