Page 1 of 1

No Error messages or Error codes, But Sort doesn't work.

PostPosted: Sat Dec 10, 2011 4:50 pm
by sriram1695
Hi I'm new to COBOL and JCL. What I'm trying to do is, to write a simple COBOL program that uses SORT verb to do a simple sort, based on a key. Nothing complex. I'm using 3 DataSets in my program. 1. Input File for Sort 2. Output File for Sort 3. Temporary Work file for Sort. All the datasets are Sequential,Fixed Block with a LRECL=18. When I compile the program, I don't get any error. Also when I try to execute the program I don get any error, my RC=0. But when I open the output file, its just empty. Below is my program.


=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 000008        IDENTIFICATION DIVISION.
 000009        PROGRAM-ID.  SORTEX.
 000010        AUTHOR. SRIRAM R.
 000011
 000012        ENVIRONMENT DIVISION.
 000013        INPUT-OUTPUT SECTION.
 000014        FILE-CONTROL.
 000015            SELECT WORKFILE ASSIGN TO TEMPFILE.
 000016            SELECT SRCFILE ASSIGN TO SRCFILE0.
 000017            SELECT SORTEDFILE ASSIGN TO SRTDFILE.
 000018
 000019        DATA DIVISION.
 000020        FILE SECTION.
 000021
 000022        SD WORKFILE.
 000023        01 WRKRECS.
 000024            02 WRK-NAME   PIC X(10).
 000025            02 WRK-ID     PIC 9(8).
 000026
 000027        FD SRCFILE.
 000028        01 SRCRECS.
 000029            02 SRC-NAME   PIC X(10).
 000030            02 SRC-ID     PIC 9(8).
 000031
 000032        FD SORTEDFILE.
 000033        01 SRTDRECS.
 000034            02 SRTD-NAME  PIC X(10).
 000035            02 SRTD-ID    PIC 9(8).
 000036
 000037        PROCEDURE DIVISION.
 000038        BEGIN.
 000039            SORT WORKFILE ON ASCENDING KEY WRK-ID
 000040                 USING SRCFILE
 000041                 GIVING SORTEDFILE.
 000042            IF SORT-RETURN > 0 THEN
 000043                 DISPLAY "SORT FAILED!!!"
 000044            ELSE
 000045                 DISPLAY "SORT SUCCESS!!!"
 000046            END-IF
 000047            STOP RUN.
 


Please help in identifying, where exactly the problem is. Thanks guys..!!

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Sat Dec 10, 2011 7:42 pm
by Robert Sample
Please help in identifying, where exactly the problem is.
Since you did NOT post the JCL you executed to run this program, there is ZERO chance of us helping you in this way. And no, we don't need to see the compile JCL -- just the execution JCL.

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Sat Dec 10, 2011 8:31 pm
by BillyBoyo
Make sure you have a

//SYSOUT DD SYSOUT=*


in your JCL.

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Sun Dec 11, 2011 6:20 am
by dick scherrer
Hello,

Have you verified that there is some input data? Where/how was the input created?

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Tue Dec 13, 2011 11:54 am
by sriram1695
The input was created manually be me. I just have 7 or 8 records in it. Here's the JCL that I used to run it.


//SRIRAGRU JOB 123456768,'SRIRAM',MSGCLASS=H,NOTIFY=SRIRAG,TIME=(1,0),
//         CLASS=A,MSGLEVEL=(1,1),REGION=200M
//JOBLIB DD DSN=SRIRAG.COBOL.LOADLIB,DISP=SHR
//STEP01 EXEC PGM=SORTEX
//TEMPFILE DD DSN=SRIRAG.SORTEDEX.TEMPFILE,
//            DISP=(NEW,DELETE,DELETE)
//SRCFILE0 DD DSN=SRIRAG.SORTEDEX.SRCFILE,DISP=SHR
//SRTDFILE DD DSN=SRIRAG.SORTEDEX.SRTDFILE,
//            DISP=(MOD,KEEP,DELETE)
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
/*
 

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Tue Dec 13, 2011 12:47 pm
by BillyBoyo
What SORT messages did you get?

Is SRIRAG.SORTEDEX.SRTDFILE catalogued? Why do you use MOD? Why MOD with DELETE if the Job fails?

Look at the JES messages from your run. See what it says about SRIRAG.SORTEDEX.SRTDFILE. If that doesn't help, post the messages here.

Re: No Error messages or Error codes, But Sort doesn't work.

PostPosted: Tue Dec 13, 2011 3:59 pm
by NicC
I would suggest that you use a name for your program that does not begin SORT - there could be other system sort programs of that name and you could be executing one of those.