IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort inside a sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkatatcts

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Mon Jul 09, 2012 9:53 pm
Reply with quote

Hi,

I have a key file.

Code:

Key1        Name      City       
AAB1        XCVB      NewJ
AAB1        XCVB      Aust
AAB1        XACB      India
AAB1        XACB      Aust
AAC1        XCVA      Engl
AAC1        XCVD      Aust
AAC1        XACC      Cert

I have sort the file based on Name and City inside each key.

For Example for the key (AAB1) the name should be sorted first and then based on city.

Output should be:

Key1        Name      City   
AAB1        XACB      Aust
AAB1        XACB      India
AAB1        XCVB      Aust
AAB1        XCVB      NewJ

AAC1        XACC      Cert
AAC1        XCVA      Engl
AAC1        XCVD      Aust



Thanks in Advance,
Venkat
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 9:59 pm
Reply with quote

Specify three fields in your sort key. If that does not get it for you, you'll have to do a btter job of explaining.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 10:04 pm
Reply with quote

actually you only need one field in the sort key - the field length would would be the total length of key1 + Name + City
since the fields are contiguous.
Back to top
View user's profile Send private message
venkatatcts

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Mon Jul 09, 2012 10:11 pm
Reply with quote

Hi,

If I give just the sort key i will get the output as. I have to sort records for a key1 (which can occur multiple time) and then based on Name and City for each record.

Code:

Key1        Name      City   
AAB1        XACB      Aust
AAB1        XACB      India
AAC1        XACC      Cert
AAC1        XCVA      Engl
AAB1        XCVB      Aust
AAB1        XCVB      NewJ
AAC1        XCVD      Aust



Thanks,
Venkat B.


[/code]
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 10:24 pm
Reply with quote

Can you show the control cards, jcl and sysout which produced your file in that order please?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 10:49 pm
Reply with quote

Quote:
think of this comment as post which should be deleted.
_________________
Dick Brenholtz
patched back in from erroneously deleted post d

Considered so, dbz.

If you don't get it, venkatatcts, we just don't believe you. We think you have your own idea about what DFSORT would do with your data, and then you expect us to provide a solution for how you think it works, not for how it actually works.

Read, code and test with the earlier advice. If you still have problems, show all the stuff previously asked for what you have tried.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 11:55 pm
Reply with quote

Hello,

I should have read thru to the end before deleting the post from DBZ. . . icon_confused.gif
It has been patched back into Bill's reply. . .

Quote:
If I give just the sort key i will get the output as.
Post where you found this in some IBM manual or post the jcl/sort control statements and the informational messages printed for the running of this. Show the actual output file created from this test data.

Your input data fields Are contiguous, right?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top