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 all records but leave first record "in place"

 
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 Mar 06, 2015 10:25 am    Post subject: Sort all records but leave first record "in place" Reply with quote

Here's an example of the data I want to sort
Code:

019999-12-31
026001       
026831       
036001       
046001       

I want to sort all records (apart from the first one) on columns 3-6 and then 1-2.

I tried the following simple example
Code:

//Q4847    EXEC PGM=SORT           
//*                               
//SYSOUT   DD SYSOUT=*             
//*                               
//SORTIN   DD *                   
019999-12-31                       
026001                             
026831                             
036001                             
046001                             
//*                               
//SORTOUT  DD SYSOUT=*             
//*                               
//SYSIN    DD *                   
  SORT FIELDS=(3,4,CH,A,1,2,CH,A) 
//*                               
//*                               

but this gave the following results
Code:

026001       
036001       
046001       
026831       
019999-12-31


I thought of trying something like OVERLAY to ensure positions 3-6 in record 1 contained 0000, but the trouble is, I must preserve the contents of record 1 as-is.

I'm sure there must be a simply method of doing this, but it's beyond my DFSORT capabilities. (Obviously SKIPREC would be fine except for the fact that it would throw away the first record)

Forgot to mention, I want the end results to be
Code:

019999-12-31
026001       
036001       
046001       
026831       

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
misi01
Advanced


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

PostPosted: Fri Mar 06, 2015 10:31 am    Post subject: My apologies Reply with quote

I suddenly remembered I'd been down this road before. The following ICETOOL JCL worked fine
Code:

//Q5914    EXEC PGM=ICETOOL                             
//*                                                     
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
019999-12-31                                             
026001                                                   
026831                                                   
036001                                                   
046001                                                   
//*                                                     
//SORTOUT  DD SYSOUT=*                                   
//*                                                     
//TOOLIN   DD *                                         
 DATASORT FROM(SORTIN) TO(SORTOUT) HEADER(1) USING(ICE1)
//*                                                     
//ICE1CNTL DD *                                         
 SORT FIELDS=(3,4,CH,A,1,2,CH,A)                         
//*                                                     

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
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