ILE COBOL Language Reference

GIVING Phrase

file-name-3, ...
The output files.

When the GIVING phrase is specified, all the sorted records in file-name-1 are automatically transferred to the output files (file-name-3, ... ). At the time the SORT statement is executed, this file must not be open.

If the output files contain variable length records, the size of the records contained in file-name-1 must not be less than the smallest record nor greater than the largest described for the output files. If the output files contain fixed length records, the size of the records contained in file-name-1 must not be greater than the largest record described for the output files.

For each of the files referenced by file-name-3, the execution of the SORT statement causes the following actions to be taken:

Note:
When duplicate keys are found when writing to an indexed file, the SORT will terminate and the sorted data in all GIVING files will be incomplete.

These implicit functions are performed such that any associated USE AFTER EXCEPTION/ERROR procedures are executed; however, the execution of such a USE procedure must not cause the execution of any statement manipulating the file referenced by, or accessing the record area associated with, file-name-3.

On the first attempt to write beyond the externally defined boundaries of the file, any USE AFTER STANDARD EXCEPTION/ERROR procedure specified for the file is executed. If control is returned from that USE procedure or if no such USE procedure is specified, the processing of the file is terminated.

All output files must specify sequential or dynamic access mode, and must be described in FD entries in the Data Division.

The output file must be an indexed, relative or sequential file.

The output file should also be created without a keyed sequence access path. When the output file has such a path, the SORT statement cannot override the collating sequence defined in the data description specifications (DDS).


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