Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Simple sort pgm in cobol using jcl not working

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 3:54 pm    Post subject: Simple sort pgm in cobol using jcl not working
Reply with quote

hi ,

i have done a simple sort pgm in cobol using jcl, using temproary files. but the s/m creating the sorted file with output. the code is below
Code:
//FILE JOB NOTIFY=ESCUB11,MSGLEVEL=(1,0)                 
//JOBLIB DD DSN=ESCUB11.SARATH.LOAD,DISP=SHR             
//S1 EXEC PGM=SORTCOB                                   
//MADE  DD DSN=ESCUB11.SARATH.FILE11,                   
//       DISP=SHR                                       
//MADE1 DD DSN=&&TEMP                                   
//MADE2  DD DSN=ESCUB11.SARATH.FILE17,                   
//       DISP=(NEW,CATLG,DELETE),                       
//       VOL=SER=USER04,                                 
//       UNIT=SYSDA,                                     
//        SPACE=(TRK,(1,3),RLSE),                       
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)   
//                                                       
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Mar 20, 2007 3:57 pm    Post subject:
Reply with quote

Hi There,

Would u please paste ur program code?
And please specify what do u mean by this?

Quote:
but the s/m creating the sorted file with output
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 3:58 pm    Post subject: Re: sort pgm not working
Reply with quote

in the above pgm dd name made refer to the file where the records are stored. dd name made 2 for creating a o/p file for the sorted data. my pgm not working even though i got maxcc =0.

IGZ0026W The SORT-RETURN special register was never referenced
this was the msg i got when i execute the pgm.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Mar 20, 2007 4:00 pm    Post subject:
Reply with quote

Hi Sarath,

As i said u previously would you please paste the code from program where r u using sorting?
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 4:01 pm    Post subject: Re: sort pgm not working
Reply with quote

Code:
IDENTIFICATION DIVISION.           
 PROGRAM-ID. XYZ.                   
 ENVIRONMENT DIVISION.               
 INPUT-OUTPUT SECTION.               
 FILE-CONTROL.                       
     SELECT INFILE ASSIGN TO MADE   
     ORGANIZATION IS SEQUENTIAL     
     ACCESS MODE IS SEQUENTIAL       
     FILE STATUS IS FS1.             
     SELECT WORKFILE ASSIGN TO MADE1.
     SELECT OUTFILE ASSIGN TO MADE2 
     ORGANIZATION IS SEQUENTIAL     
     ACCESS MODE IS SEQUENTIAL       
     FILE STATUS IS FS2.             
 DATA DIVISION.                     
 FILE SECTION.                       
 FD INFILE                           
     LABEL RECORDS ARE STANDARD     
     RECORDING MODE IS F             
     DATA RECORD IS EMPREC.         
 01 EMPREC.                         
     02 NAME PIC X(10).             
     02 AGE  PIC 9(2).               
     02 DEP PIC  X(2).                     
     02 FILLER PIC X(66).                 
 SD WORKFILE.                             
 01 WORKREC.                               
    02 WNAME PIC X(10).                   
    02 FILLER PIC  X(70).                 
 FD OUTFILE                               
     LABEL RECORDS ARE STANDARD           
     RECORDING MODE IS F                   
     DATA RECORD IS OUTREC.               
 01 OUTREC.                               
     02 ONAME PIC  X(10).                 
     02 OAGE PIC   9(2).                   
     02 ODEP PIC   X(2).                   
     02 FILLER PIC  X(66).                 
 WORKING-STORAGE SECTION.                 
 01 FS1 PIC X(2).                         
 01 FS2 PIC X(2).                         
 PROCEDURE DIVISION.                       
 P1.                                       
     SORT WORKFILE ON ASCENDING KEY WNAME 
     USING INFILE                         
     GIVING OUTFILE.                       
     STOP RUN.                             
[/quote]
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 4:11 pm    Post subject: Re: sort pgm not working
Reply with quote

hi,

i want to sort a simple sequential file using simple sort...
please help me
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 20, 2007 4:17 pm    Post subject:
Reply with quote

Is there any reason why you would want to write a program rather than use the SORT product available at your site ?
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 4:18 pm    Post subject: Re: sort pgm not working
Reply with quote

sorry i didnt get any out put. but a file is created with out any data[/quote]
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 4:21 pm    Post subject: Re: sort pgm not working
Reply with quote

because i am in my startting level, i don't know to use utilities. so please tell why i dont get the sorted file.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 20, 2007 4:37 pm    Post subject:
Reply with quote

OK, I am not a programmer so may well be very wrong here.

You say that DDNAME MADE is where your reords are, but are you not sorting WORKFILE which I think relates to DDNAME MADE1 which is allocated to DSN=&&TEMP

If this is the case, are there any records in &&TEMP

As for utilities, take some time and look at them, DFSORT is a very good friend to have.
Back to top
View user's profile Send private message
sarathbabum
Currently Banned

New User


Joined: 15 Mar 2007
Posts: 12
Location: Kerala

PostPosted: Tue Mar 20, 2007 5:00 pm    Post subject: Re: sort pgm not working
Reply with quote

the file that i refer using DD name MADE contains the data records that i want to sort...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 20, 2007 5:18 pm    Post subject:
Reply with quote

But your sort refers to WORKFILE which relates to DDNAME MADE1, but your records for sorting are in DDNAME MADE.
Quote:

SORT WORKFILE ON ASCENDING KEY WNAME
USING INFILE
GIVING OUTFILE.
STOP RUN.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Mar 20, 2007 5:38 pm    Post subject:
Reply with quote

Expat, it is correct, you sort the SD (workfile) using input giving output.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 20, 2007 5:45 pm    Post subject:
Reply with quote

Yes, but it seems to me that you have not put any records into WORKFILE, so there is nothing to sort, so no output.

As I said, I am not a programmer, merely offering a suggestion or two.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Mar 20, 2007 5:46 pm    Post subject:
Reply with quote

Sarath,

There should be some additional output in the jes queue, SYSOUT or SYSPRINT or similat with some additional information about the sort.

Just to confirm that you are executing the program you think you are, after the paragraph header "P1" and befroe the SORT verb, put a DISPLAY 'This is the correct program'. Then recompile and re-execute it. Let us know how everything went.
Back to top
View user's profile Send private message
ibm4me

New User


Joined: 23 Oct 2006
Posts: 3

PostPosted: Tue Mar 20, 2007 6:20 pm    Post subject: use IGYSORT
Reply with quote

// JOB card
// JCLLIB ORDER = YOUR.PDS
//STEP1 EXEC PGM = IGYSORT, MEM = YOURMEMBER
//COBOL.SYSIN DD DSN = YOUR.PDS(&MEM), DISP = SHR
//GO.DD1 DD DSN = INPUT FILE, DISP = SHR
//GO.DD2 DD DSN = &&TEMP, DISP = NEW
//* "OUTFILE" IF IT IS ALREADY CREATED
//GO.DD3 DD DSN = OUTPUTFILE, DISP = SHR
//GO.SYSIN DD *
/*
//
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 20, 2007 9:51 pm    Post subject:
Reply with quote

Hello,

Have you verified that this:
Quote:
the file that i refer using DD name MADE contains the data records that i want to sort
is true?

Please go into tso and browse the dataset and make sure there records in the file.

To clear up a bit of confusion on the internal sort - the sort statement refers to the "sort work file" (in many cases "SELECT SORT-FILE ASSIGN TO UT-S-SORTWK01" is used and the sortwork DD statement(s) are the same as if an external sort was used). When using/giving is specified, the "sort" record is not referenced in the code. With "using", the "input" fd specified is read and processed by the sort (in the file defined as an SD (rather than FD)). When "giving" is specified, the final output from the sort is written to the output fd.

For an educational exercise using/giving will run, but when working on programs that will be promoted to production using/giving should not be used in the same program. It is the worst possible performance choice.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us