Page 1 of 2

Getting IGZ0026W message for COBOL Sort program

PostPosted: Sat Jul 09, 2011 11:41 pm
by magesh123
Hi,
I am using the below COBOL code for sorting the input file and storing the output into output file.

Program:
FILE-CONTROL.                         
     SELECT IFILE ASSIGN TO AS-DD1.   
     SELECT WORKFILE ASSIGN TO AS-DD2.
     SELECT OFILE ASSIGN TO AS-DD3.   
DATA DIVISION.                         
FILE SECTION.                         
FD IFILE.                             
01 I-REC.                             
     02 I-EMPNO PIC 9(3).             
     02 I-FILLER PIC X.               
     02 I-EMPNAME PIC A(9).           
     02 FILLER PIC X(67).             
SD WORKFILE.                           
01 W-REC.                             
     02 W-EMPNO PIC 9(3).             
     02 W-FILLER PIC X.               
     02 W-EMPNAME PIC A(9).                       
     02 FILLER PIC X(67).                         
FD OFILE.                                         
01 O-REC.                                         
     02 O-EMPNO PIC 9(3).                         
     02 O-FILLER PIC X.                           
     02 O-EMPNAME PIC A(9).                       
     02 FILLER PIC X(67).                         
PROCEDURE DIVISION.                               
MAINP.                                           
     SORT WORKFILE ON ASCENDING KEY W-EMPNO USING
     IFILE GIVING OFILE.                         
     STOP RUN.   


When i compile and run the above program, it execute successfully. But i am getting the below warning message after running the program and i dont get the expected
output for the above program.

Error Message:
IGZ0026W The SORT-RETURN special register was never referenced, but the current content indicated the sort or merge
operation in program PGM1 on line number 31 was unsuccessful.

Input dataset:
123456789    --> cols
006 GURU 
004 TARA 
001 ARUL 
Please help me to troubleshoot the problem.

Thanks in Advance,
Magesh.

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sat Jul 09, 2011 11:49 pm
by MrSpock
I'm not sure a sort workfile can be defined as a VSAM dataset.

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sat Jul 09, 2011 11:55 pm
by magesh123
Thanks for the information. I have also tried for sequential dataset and i am getting the same problem.

I found the below reason for the warning message IGZ0026W.

IGZ0026W The SORT-RETURN special register was never referenced, but the current content indicated the sort or merge operation in program program-name on line number line-number was unsuccessful.
Explanation: The COBOL source does not contain any references to the sort-return register. The compiler generates a test after each sort or merge verb. A nonzero return code has been passed back to the program by Sort/Merge.

Programmer Response: Determine why the Sort/Merge was unsuccessful and fix the problem. Possible reasons why the Sort/Merge was unsuccessful include:
There was an error detected by DFSORT. See the DFSORT messages for the reason for the error.
The SORT-RETURN special register was set to a non-zero value by the application program while in an input procedure or an output procedure.

System Action: No system action was taken.

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 12:01 am
by Robert Sample
Why do you find it so hard to do
PROCEDURE DIVISION.                               
MAINP.                                           
     SORT WORKFILE ON ASCENDING KEY W-EMPNO USING
     IFILE GIVING OFILE.                         
     DISPLAY SORT-RETURN.
     STOP RUN.
and find out what SORT is trying to tell you?

For that matter, were there not messages output from the SORT in your job?

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 12:29 am
by magesh123
Now i am getting return code as 0020 in sysout.

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 12:43 am
by magesh123
If i include the below SYSOUT DD statement in RUN JCL, it works fine. Thank you all for your immediate response.
//SYSOUT DD SYSOUT=*

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 12:43 am
by Robert Sample
From what I can see, it looks like return code 20 means the sort message data set is missing. What does your JCL look like?

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 1:12 am
by magesh123
//STEP1 EXEC PGM=load module of Compiled program
//STEPLIB DD DSN=Load module library,DISP=SHR
//DD1 DD DSN=Sort input dataset,DISP=SHR
//DD2 DD DSN=Sort work file dataset,DISP=SHR
//DD3 DD DSN=Output dataset,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
/*

Note: I was missing SYSOUT DD statement.

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 1:35 am
by Robert Sample
Well, did it work with the missing SYSOUT statement?

Re: Getting IGZ0026W message for COBOL Sort program

PostPosted: Sun Jul 10, 2011 4:58 am
by BillyBoyo
magesh123 wrote:If i include the below SYSOUT DD statement in RUN JCL, it works fine. Thank you all for your immediate response.
//SYSOUT DD SYSOUT=*


This post was at the same time as your spot, Robert, so answering your last question before it was asked.

Magesh123,

Why are you doing the sort in a Cobol program, instead of, well, using the sort?