Previous Topic: Selecting and Bypassing Records

Next Topic: Control Breaks and Group Totals


Sorting

Input records can be sorted into any order for processing. CA JARS Wizard uses from one to nine data fields as sort keys. For example:

SORT DIV CODE, ACTIVE TIME

This sample statement sorts records in alphanumeric order, from (A-Z and 0-9), by division code. Within each division, records are organized in numerically ascending order by active time.

The (D) suffix after a data field name provides a descending sort.

Example:

SORT DIV CODE, ACTIVE TIME(D)

Records are sorted in alphanumeric order by division code, as before. In this case, however, records within each division are sorted numerically in descending order of active time. Those with the largest active time values appear first.

A SORT statement is required in any run that includes a BREAK statement if the file is not in the proper sequence. Data field names must be in the same order that they appear in the BREAK statement. The SORT statement, however, can include additional field names that are not needed in the BREAK statement.

A data field name may be qualified.

Example:

APPL CODE (1,3) would direct consideration of only the first, second, and third characters in the application code data field for sorting.