Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

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, and the length of your data records.

To determine which PLISRTx built-in subroutine to 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 the data before it is sorted, and to make immediate use of the data in its sorted form. If you decide to use an input or output handling subroutine, read Sort data handling routines.

The sort built-in subroutines and the source and destination of data are as follows:

Built-in subroutine Source Destination
PLISRTA Data set Data set
PLISRTB Subroutine Data set
PLISRTC Data set Subroutine
PLISRTD Subroutine Subroutine

Source data sets are defined using the SORTIN environment variable while destination data sets are defined using SORTOUT. Alternatively, you can use the PUTENV built-in function to set those functions.

Having determined the subroutine you are using, you must now determine a number of things about your data set and specify the information on the SORT statement:

Next, you must determine two things about the records to be sorted and specify the information on the RECORD statement:

You use these on the RECORD statement, which is the second argument to PLISRTx.

Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide