Stopping a sort or merge operation prematurely

To stop a sort or merge operation, move the integer 16 into the SORT-RETURN special register.

Move 16 into the register in either of the following ways:

  • Use MOVE in an input or output procedure.

    Sort or merge processing will be stopped immediately after the next RELEASE or RETURN statement is performed.

  • Reset the register in a declarative section entered during processing of a USING or GIVING file.

    Sort or merge processing will be stopped immediately after the next implicit RELEASE or RETURN is performed, which will occur after a record has been read from or written to the USING or GIVING file.

Control then returns to the statement following the SORT or MERGE statement.