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 records between the multiple headers & traders.

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


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Fri Jun 24, 2011 5:20 am    Post subject: Sort records between the multiple headers & traders. Reply with quote

I have a requirement to build a sort card. Can anyone help in this to build a sort card

Requirement:-

Input File :-

Code:
       

A00001
C00002
B00002
B00001
B00009
B00006
D00001
D00002



Output file:-

Code:
       
A00001
C00002
B00001
B00002
B00006
B00009
D00001
D00002


All the records which start with B should be sorted and the remaining records from the input file should be copied same to the output file. If we consider all other records which are not starting B as headers & trailers i.e. (multiple headers & trailers). The header & trailers are not constant as shown in below

Example1

Input File

Code:

A00001                                                           
A00002
C00001
C00002                                                           
B00002                                                           
B00001                                                           
B00009                                                           
B00006                                                           
D00001
D00002                                                           
D00003
D00004                                                           


Output file

Code:

A00001                                                           
A00002
C00001
C00002                                                           
B00001                                                           
B00002                                                           
B00006                                                           
B00009                                                           
D00001
D00002                                                           
D00003
D00004                                                           



Example2

Input file

Code:

A00001                                                           
B00002                                                           
B00001                                                           
D00001                                                           


Output file
Code:

A00001                                                           
B00001                                                           
B00002                                                           
D00001                                                           




Thanks,
Siva
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 Jun 24, 2011 7:50 am    Post subject: Reply with quote

sivafdms,

See the smart DFSORT trick "Sort groups of records" here

https://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Sat Jun 25, 2011 1:51 pm    Post subject: Reply with quote

Thanks kolusu..

I have tried with DATASORT. It works fine when i already know that there are this many header & trailer present in the file.. the problem here is that the no of header & trailer are not constant. i want a sort it would handle multiple headers & trailers and sort the details records.

Thanks,
Siva
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: Sat Jun 25, 2011 11:59 pm    Post subject: Reply with quote

sivafdms,

Well you should have looked at sorting groups of records using when=group instead of datasort. Either way if your data has A, B, D in the first byte, isn't it a simple sorting on that ? You need to post better examples of data if you need help from us.
_________________
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