IBM Support

COBOL Program with failed embedded SORT ends with RC00.

Troubleshooting


Problem

A SORT routine using DFSORT embedded in a COBOL program does not finish successfully, but the job step ends with RC00.

Symptom

The user reports the batch job shows messages +ICE158A and IGZ0026W but the final job's return code is 00.

Cause

The SORT-RETURN special register contains a return code of 0 (successful) or 16 (unsuccessful) at the completion of a sort or merge operation. If the sort or merge is unsuccessful and there is no use of this special register in the program, a message is displayed upon SYSOUT if there is a //SYSOUT DD.

Environment

Enterprise COBOL for z/OS, Language Environment, DFSORT, zOS

Diagnosing The Problem

Care should be taken to process and communicate the error. If SORT-RETURN is just DISPLAYed or referenced anywhere in the program, even in code that is not executed, there is no message and the program RETURN-CODE is not updated.

Resolving The Problem

There are several issues and possible actions:

1- The job ends with RC=00 based on the default setting of the RETURN-CODE special register which was not modified. Customer COBOL program MYPROG uses SORT statement but does not check the SORT-RETURN special register after that.
* If checked, they would find that SORT-RETURN is set to 16. The program may either move SORT-RETURN to RETURN-CODE or take other action if they want to indicate the error. Example-
IF SORT-RETURN = 16 MOVE 16 TO RETURN-CODE.

2- If a SYSOUT DD is omitted for job MYPROG, it causes the message
ICE158A 0 MYPROG.STEPX SYSOUT DD STATEMENT MISSING
* Adding a //SYSOUT DD statement will prevent this error message.

3- If the SYSOUT DD statement is present, this message may be produced
IGZ0026W The SORT-RETURN special register was never referenced, but
the current operation in program MYPROG on line number nnn
was unsuccessful.
* The explanation for the IGZ0026W message is that COBOL source does not contain any references to the SORT-RETURN register. A non-zero return code has been passed back to the program by Sort/Merge.

4- DFSORT has some Installation Options that can alter its behavior on failure.
* Here are some DFSORT options to review:
The ERET option default is RC16, which means to terminate with a return code of 16, but not abend.
The user could set the DFSORT ERET to ABEND and leave the ABCODE to either the default of MSG or set ABCODE to 16, or whatever number is desired, and the program will abend with that return code if the sort fails.

[{"Product":{"code":"SS6SG3","label":"Enterprise COBOL for z\/OS"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Compile","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"3.4;4.1;4.2","Edition":"","Line of Business":{"code":"LOB17","label":"Mainframe TPS"}}]

Document Information

Modified date:
08 August 2018

UID

swg21497649