You can use the SORT-RETURN special register to end a sort or merge operation before it has completed. You set the SORT-RETURN special register to 16 in an error declarative or input/output procedure to end the sort or merge operation before all of the records have been processed. The sort or merge operation ends before a record is returned or released. Control then returns to the statement following the SORT or MERGE statement.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.