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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby sriram1695 » Sat Dec 10, 2011 4:50 pm

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..!!
sriram1695
 
Posts: 6
Joined: Sat Dec 10, 2011 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Robert Sample » Sat Dec 10, 2011 7:42 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

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

Postby BillyBoyo » Sat Dec 10, 2011 8:31 pm

Make sure you have a

//SYSOUT DD SYSOUT=*


in your JCL.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby dick scherrer » Sun Dec 11, 2011 6:20 am

Hello,

Have you verified that there is some input data? Where/how was the input created?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby sriram1695 » Tue Dec 13, 2011 11:54 am

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=*
/*
 
sriram1695
 
Posts: 6
Joined: Sat Dec 10, 2011 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby BillyBoyo » Tue Dec 13, 2011 12:47 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby NicC » Tue Dec 13, 2011 3:59 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post