Created On:  08 October 2010


When executing an ACUCOBOL-GT program it abends with an "Illegal Sort" error.


The "Illegal Sort" error indicates that there is a problem in initiating the SORT operation. The following circumstances will cause an "Illegal Sort" message:

1. A previous SORT is still executing when the current requested SORT operation is attempted.   The ACUCOBOL-GT runtime limits one SORT at a time.

2. A previous SORT terminated prior to completion, i.e. EXIT PROGRAM, or explicit GO TO statement.

3. During the previous SORT, the input procedure found no records, therefore the output procedure is never executed.  Hence the SORT is still open.

Troubleshooting the above conditions will usually reveal the cause and resolution.
Adding a 'CANCEL SORT' prior to the SORT request can be a workaround which will prevent the error.  It has no effect if no previous SORTs have occurred. 

**NOTE** Be aware that 'CANCEL SORT' will terminate a sort that is currently executing.