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 file only particular records

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


Joined: 14 Sep 2005
Posts: 18
Topics: 8

PostPosted: Fri Mar 09, 2007 3:12 pm    Post subject: Sort file only particular records Reply with quote

Hi,

I need to sort file only particular records. Please let me know if this can be done using SORT.

My requirement is

Input File

9999
6666
3333
3333
4444
2222
2222


Output file
9999
6666
4444
2222
2222
3333
3333


I need to sort 2222 and 3333 only. If 3333 & 2222 are found then it should sorted in ascending sequence. Rest of the file order shouldn
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 09, 2007 3:21 pm    Post subject: Reply with quote

try this job

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                               
9999                                           
6666                                           
3333                                           
3333                                           
4444                                           
2222                                           
2222                                           
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *
  OPTION EQUALS                               
  SORT FIELDS=(81,1,CH,A)                     
  INREC IFTHEN=(WHEN=INIT,                     
       OVERLAY=(81:C'0')),                     
                                               
        IFTHEN=(WHEN=(1,4,CH,EQ,C'2222'),     
       OVERLAY=(81:C'1')),                     
                                               
        IFTHEN=(WHEN=(1,4,CH,EQ,C'3333'),     
       OVERLAY=(81:C'2'))                     
                                               
  OUTREC FIELDS=(1,80)                         
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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