ILE COBOL Programmer's Guide

Sorting Files

The sort operation accepts unsequenced input and produces output in a specified sequence.

You can specify input procedures to be performed on the sort records before they are sorted using the SORT...INPUT PROCEDURE statement.

You can specify output procedures to be performed on the sort records after they are sorted using the SORT...OUTPUT PROCEDURE statement.

You use input or output procedures to add, delete, alter, edit, or otherwise modify the records.

You can use the SORT statement to:

An ILE COBOL program containing a sort operation is usually organized so that one or more input files are read and operated on by an input procedure. Within the input procedure, a RELEASE statement places a record into the sort file. If you don't want to modify or process the records before the sorting operation begins, the SORT statement USING phrase releases the unmodified records from the specified input files to the new file.

After completion of the sorting operation, sorted records can be made available, one at a time, through a RETURN statement, for modification in an output procedure. If you don't want to modify or process the sorted records, the SORT statement GIVING option names the output file and writes the sorted records to an output file.

Refer to the WebSphere Development Studio: ILE COBOL Reference for further information on the SORT, RELEASE, and RETURN statements.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]