MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SORT with STARTREC and ENDREC

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Aug 15, 2014 4:31 am    Post subject: SORT with STARTREC and ENDREC Reply with quote

I have just run a job with the following JCL
Code:

//R0110    EXEC PGM=SORT                                       
//*                                                           
//SYSOUT   DD SYSOUT=*                                         
//*                                                           
//SORTIN   DD DSN=filein,DISP=SHR         
//*                                                           
//FORSTA   DD DSN=fileout,DISP=(,CATLG), 
//         RECFM=VB,LRECL=1000,SPACE=(TRK,(5,5))               
//*                                                           
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                             
 OUTFIL FNAMES=FORSTA,STARTREC=1,ENDREC=1000                   


The input file has 121,530,021 records. The actual job took 4 minutes elapsed time and the impression I get is that it read the WHOLE file.
Quote:

ICE054I 0 RECORDS - IN: 121530021, OUT: 121530021
ICE227I 0 FORSTA : DELETED = 121529021, REPORT = 0, DATA = 1000
ICE228I 0 FORSTA : TOTAL IN = 121530021, TOTAL OUT = 1000



Can someone explain why it would do that when I've specified a value in ENDREC (which, logically to me, should ensure that DFSORT "knows" when it's read enough records).
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Fri Aug 15, 2014 5:08 am    Post subject: Reply with quote

misi01,

The same goes for this question too

http://www.mvsforums.com/helpboards/viewtopic.php?p=60225#60225

Given that your input is VB , you should also read upon the keywords VLSCMP and VLSHRT.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Mon Aug 18, 2014 6:13 am    Post subject: Not sure I understood your answer Reply with quote

I changed the JCL to the following
Code:

//FORSTA   DD DSN=output file,DISP=(,CATLG), 
//         RECFM=VB,LRECL=167,SPACE=(TRK,(5,5))               
//*                                                           
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                             
 OPTION VLSHRT                                                 
 OUTFIL FNAMES=FORSTA,STARTREC=5000,ENDREC=5100               


but am still seeing the following results
Quote:

ICE227I 0 FORSTA : DELETED = 26469, REPORT = 0, DATA = 101
ICE228I 0 FORSTA : TOTAL IN = 26570, TOTAL OUT = 101

I would have imagined that the results for TOTAL in would have been 5100, not 26570
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Mon Aug 18, 2014 7:37 am    Post subject: Reply with quote

Well, you've limited the particular OUTFIL group, but haven't limited the SORTIN dataset.

Try SKIPREC and STOPAFT on an OPTiON statement (or the SORT statement).

For an OUTFIL group, ACCEPT (assuming your DFSORT is up-to-date) with STARTREC is neater than using ENDREC with STARTREC in this case.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Mon Aug 18, 2014 8:20 am    Post subject: Thanks William. Reply with quote

Tried your example using
Code:

OPTION COPY,SKIPREC=4,STOPAFT=3

and it worked exactly as I would have expected, ie, read only those records needed, no more.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Mon Aug 18, 2014 9:28 am    Post subject: Reply with quote

So you're happy now? It's not quite clear...

What I think you're asking is "why doesn't the OUTFIL I coded do that?"?

I think you'd be asking for code for a very specific case: a COPY operation, no SORTOUT and only one OUTFIL. The relationship here between SORTIN and OUTFIL is coincidental only. As soon as you actually SORT, that pseudo-relationship is broken. If you have SORTOUT, that pseudo-relationship is broken. If you have two OUTFILs.... well, you get the picture.

And where what you want to achieve can be done anyway by limiting the SORTIN with what is available to do that.

Although it may appear neat if it worked like you seem to want, you'd have more code in several places just to achieve that. Just a waste.

There's always a chance Kolusu will say I'm wrong Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group