Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort inside a sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort inside a sort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Jul 09, 2012 9:59 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Mon Jul 09, 2012 10:04 pm    Post subject:
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    Post subject: Sort for a key
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Jul 09, 2012 10:24 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Jul 09, 2012 10:49 pm    Post subject:
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

Site Director


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

PostPosted: Mon Jul 09, 2012 11:55 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us