Preparing to use Sort
Before using Sort, you must determine the type of sort you require, the length and format of the sorting fields in the data, the length of your data records, and the amount of auxiliary and main storage you will allow for sorting.
To determine the PLISRTx entry point that you will use, you must decide the source of your unsorted data, and the destination of your sorted data. You must choose between data sets and PL/I subroutines. Using data sets is simpler to understand and gives faster performance. Using PL/I subroutines gives you more flexibility and more function, enabling you to manipulate or print the data before it is sorted, and to make immediate use of it in its sorted form. If you decide to use an input or output handling subroutine, see Data input and output handling routines.
The entry points and the source and destination of data are as follows:
| Entry point | Source | Destination |
|---|---|---|
PLISRTA |
Data set | Data set |
PLISRTB |
Subroutine | Data set |
PLISRTC |
Data set | Subroutine |
PLISRTD |
Subroutine | Subroutine |
- The position of the sorting fields; these can be either the complete record or any part or parts of it
- The type of data these fields represent, for example, character or binary
- Whether you want the sort on each field to be in ascending or descending order
- Whether you want equal records to be retained in the order of the input, or whether their order can be altered during sorting
- Whether the record format is fixed or varying
- The length of the record, which is the maximum length for varying
Specify these on the RECORD statement, which is the second argument to PLISRTx.
Finally, you must decide on the amount of main and auxiliary storage you will allow for the Sort program. For further details, see Determining storage needed for Sort.