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 Based on record type

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


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Aug 15, 2005 7:10 am    Post subject: SORT Based on record type Reply with quote

Hi,
I've a file with 4 record types.
type 'a' - sort 10-14 bytes
type 'b' - sort 15-19 bytes

.
.

I need to sort them based on record type and merge them in one file.Please let me know if we can do it bu sort.

Vijay
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: Mon Aug 15, 2005 8:18 am    Post subject: Reply with quote

Vijay,

Try this untested JCL. I assumed that your input is of FB type with an lrecl of 80 bytes. I also assumed that the indicator(a,b,c,d) is in pos 1.

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
----+----1----+----2----+----3----+----4----+
A        22222                               
A        11111                               
A        44444                               
B             33333                         
B             22222                         
B             11111                         
C                  22222                     
C                  11111                     
C                  44444                     
D                       33333               
D                       22222               
D                       11111               
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
 INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),       
               OVERLAY=(81:10,5)),           
       IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),       
               OVERLAY=(81:15,5)),           
       IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),       
               OVERLAY=(81:20,5)),           
       IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),       
               OVERLAY=(81:25,5)),           
       IFTHEN=(WHEN=NONE,                   
               OVERLAY=(81:C'99999'))       
                                             
 SORT FIELDS=(01,01,CH,A,                   
              81,5,CH,A)                     
                                             
 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
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Aug 15, 2005 8:32 am    Post subject: Reply with quote

Vijay,

If you are getting an error using the above control cards, then you can try with the following control cards

Code:

//SYSIN    DD *                                 
 INREC FIELDS=(1,80,                           
               81:1,1,CHANGE=(5,C'B',C'99999', 
                                C'C',C'99999', 
                                C'D',C'99999'),
                              NOMATCH=(10,5),   
                                               
               86:1,1,CHANGE=(5,C'A',C'99999', 
                                C'C',C'99999', 
                                C'D',C'99999'),
                              NOMATCH=(15,5),   
                                               
               91:1,1,CHANGE=(5,C'A',C'99999', 
                                C'B',C'99999', 
                                C'D',C'99999'),
                              NOMATCH=(20,5),   
                                               
               96:1,1,CHANGE=(5,C'A',C'99999', 
                                C'B',C'99999', 
                                C'C',C'99999'),
                              NOMATCH=(25,5))   
                                               
 SORT FIELDS=(01,01,CH,A,                       
              81,05,CH,A,                       
              86,05,CH,A,                       
              91,05,CH,A,                       
              96,05,CH,A)                       
                                               
 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
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Aug 15, 2005 8:39 am    Post subject: Reply with quote

Kolusu,
Are you sure this works with syncsort.I need to use SYncsort.

Vijay
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: Mon Aug 15, 2005 8:51 am    Post subject: Reply with quote

Quote:

Kolusu,
Are you sure this works with syncsort.I need to use SYncsort.


vijay,

Go thru your first post once again and see you have ever mentioned that you need to use Syncsort.

How do you expect me to guess what is on your mind? You haven't posted any details like LRECL,RECFM and position of the indicator. I just posted the example based on my assumptions.

Try the second example posted. It works for syncsort.

Next time you seek help please try to provide all the details and which would avoid the guesswork for the people who are trying to help.

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Aug 15, 2005 10:05 am    Post subject: Reply with quote

Quote:
Try this untested JCL.


Kolusu,

Your job works fine with DFSORT.

Quote:
Are you sure this works with syncsort.I need to use SYncsort.


Vijay,

You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so since you don't have DFSORT, you won't be able to use them. For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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