Page 1 of 1

SORT CAPACITY EXCEEDED AND ZERO RETURN CODE

PostPosted: Mon Jun 29, 2009 2:51 am
by Ron Mascarenhas
We have recently migrated to DFSORT and having a problem when a DFSORT file in a COBOL program runs out of space with
the message SORT CAPACITY EXCEEDED. The problem is that the program always end with a zero return code. The SORT-RETURN also returns a zero code. Is there any way for the DFSORT to return a non-zero code or issue an abend when an out-of-space error occurs during sort?

Re: SORT CAPACITY EXCEEDED AND ZERO RETURN CODE

PostPosted: Mon Jun 29, 2009 4:45 am
by dick scherrer
Hello,

Please post all of the diagnostic info along with the message ids.

I have not yet seen an internal sort that failed and still had zero in SORT-RETURN. This is a cobol internal sort?

Re: SORT CAPACITY EXCEEDED AND ZERO RETURN CODE

PostPosted: Mon Jun 29, 2009 1:10 pm
by Ron Mascarenhas
Yes, this is an internal COBOL SORT. I did some additional tests with the program and found that the SORT-RETURN is 16 when it is tested AFTER the SORT verb. However the program was testing the SORT-RETURN after each RELEASE/RETURN statement and expecting any errors to be trapped.

Which errors are trapped when the SORT-RETURN is tested after the RETURN/RELEASE?

Re: SORT CAPACITY EXCEEDED AND ZERO RETURN CODE

PostPosted: Mon Jun 29, 2009 8:44 pm
by Frank Yaeger
SORT-RETURN after the SORT verb contains the condition code passed back from DFSORT.

I don't believe that SORT-RETURN after RETURN/RELEASE is meaningful. SORT-RETURN is the value in register 15. I believe COBOL uses DFSORT exits associated with RETURN/RELEASE. I don't know what RETURN/RELEASE corresponds to in the COBOL program exactly or how it corresponds to the flow with the DFSORT exits, but I suspect that register 15 = SORT-RETURN at that point has nothing to do with DFSORT failing with an ICE046A message.

Re: SORT CAPACITY EXCEEDED AND ZERO RETURN CODE

PostPosted: Tue Jun 30, 2009 2:29 am
by dick scherrer
Hello,

SORT-RETURN should be tested (immediately - imho) after the SORT statement. There is no reason to test SORT-RETURN after release/return statements.

You can also set SORT-RETURN to 16 if you want to stop processing the SORT statement before all records are processed. If you set SORT-RETURN to 16, the SORT is terminated on the next input or output operation.