IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Simple sort pgm in cobol using jcl not working


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

PostPosted: Tue Mar 20, 2007 3:57 pm
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
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: 1208
Location: Bangalore,India

PostPosted: Tue Mar 20, 2007 4:00 pm
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
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 20, 2007 4:17 pm
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
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 20, 2007 4:37 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 20, 2007 5:18 pm
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: 3156
Location: Tucson AZ

PostPosted: Tue Mar 20, 2007 5:38 pm
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 20, 2007 5:45 pm
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: 3156
Location: Tucson AZ

PostPosted: Tue Mar 20, 2007 5:46 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Mar 20, 2007 9:51 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top