Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Using the Sort program

Preparing to use Sort
Choosing the type of Sort
Specifying the sorting field
Specifying the records to be sorted
Maximum record lengths
Determining storage needed for Sort
Main storage
Auxiliary storage
Calling the Sort program
Example 1
Example 2
Example 3
Example 4
Example 5
Determining whether the Sort was successful
Establishing data sets for Sort
Sort work data sets
Input data set
Output data set
Checkpoint data set
Sort data input and output
Data input and output handling routines
E15—Input handling routine (Sort Exit E15)
E35—Output handling routine (Sort Exit E35)
Calling PLISRTA example
Calling PLISRTB example
Calling PLISRTC example
Calling PLISRTD example
Sorting variable-length records example

The compiler provides an interface called PLISRTx (x = A, B, C, or D) that allows you to make use of the IBM-supplied Sort programs.

To use the Sort program with PLISRTx, you must:

  1. Include a call to one of the entry points of PLISRTx, passing it the information on the fields to be sorted. This information includes the length of the records, the maximum amount of storage to use, the name of a variable to be used as a return code, and other information required to carry out the sort.
  2. Specify the data sets required by the Sort program in JCL DD statements.

When used from PL/I, the Sort program sorts records of all normal lengths on a large number of sorting fields. Data of most types can be sorted into ascending or descending order. The source of the data to be sorted can be either a data set or a user-written PL/I procedure that the Sort program will call each time a record is required for the sort. Similarly, the destination of the sort can be a data set or a PL/I procedure that handles the sorted records.

Using PL/I procedures allows processing to be done before or after the sort itself, thus allowing a complete sorting operation to be handled completely by a call to the sort interface. It is important to understand that the PL/I procedures handling input or output are called from the Sort program itself and will effectively become part of it.

PL/I can operate with DFSORT™ or a program with the same interface. DFSORT is a release of the program product 5740-SM1. DFSORT has many built-in features you can use to eliminate the need for writing program logic (for example, INCLUDE, OMIT, OUTREC and SUM statement plus the many ICETOOL operators). See DFSORT Application Programming Guide for details and Getting Started with DFSORT for a tutorial.

The following material applies to DFSORT. Because you can use programs other than DFSORT, the actual capabilities and restrictions vary. For these capabilities and restrictions, see DFSORT Application Programming Guide, or the equivalent publication for your sort product.

To use the Sort program you must include the correct PL/I statements in your source program and specify the correct data sets in your JCL.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)