The SORT and MERGE instructions specify whether to perform a sort or merge operation. These two functions are mutually exclusive. A SORT or MERGE instruction must be followed by a FIELDS phrase that indicates the fields on which a file is to be sorted or merged. You specify the start position, the length, the type, and the order for each sort field. Use a comma to separate field attributes and a comma before starting to describe a new field. A merge operation combines records from files that are already sorted on the specified fields. The syntax for these functions follows:
acusort sort fields(start, length, type, order) acusort merge fields(start, length, type, order)
where
start | is the offset of the field in the record (in bytes, starting at position 1). |
length | is the size of the field in bytes. |
type | is a two-letter code indicating the type of data in the field (see the data field type descriptions below). |
order | is the order of output, either ascending (A) or descending (D). |
The following data field types are supported in AcuSort:
BI | Unsigned numeric, USAGE COMP |
C5 | Unsigned numeric, USAGE COMP-5 |
C6 | Unsigned numeric, USAGE COMP-6 |
CH | Alphanumeric |
CX | Usage COMP-X |
FL | Usage floating point |
LI | Signed numeric, SIGN IS LEADING |
LS | Signed numeric, SIGN IS LEADING SEPARATE |
NU | Unsigned numeric |
PD | Signed numeric, USAGE COMP-3 |
SB | Signed numeric, USAGE COMP |
S5 | Signed numeric, USAGE COMP-5 |
TS | Signed numeric, SIGN IS TRAILING SEPARATE |
TI | Signed numeric, SIGN IS TRAILING |
In the following example:
acusort sort fields (1, 10, ch, a)
the sort operation begins at position 1 in a 10-byte sort field, and the alphanumeric data are sorted in ascending order. See AcuSort Code Sample for more sample code.