IBM Extension

SORT-RETURN Special Register

The SORT-RETURN special register is the name of a binary data item and is available to both sort and merge programs.

The SORT-RETURN special register has the implicit definition:
01     SORT-RETURN GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO.

When used in nested programs, the SORT-RETURN special register is implicitly defined as GLOBAL in the outermost COBOL program. The SORT-RETURN special register contains a return code of 0 (successful) or 16 (unsuccessful) at the completion of a sort/merge operation.

You can set the SORT-RETURN special register to 16 in an error declarative or input/output procedure to terminate a sort/merge operation before all records are processed. The operation is terminated before a record is RETURNed or RELEASEd. You may specify the SORT-RETURN special register in a function wherever an integer argument is allowed.

End of IBM Extension