Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sorting a file based on three fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chandan mehta

New User


Joined: 22 May 2007
Posts: 1
Location: Mangalore

PostPosted: Tue Feb 05, 2008 9:15 pm    Post subject: Sorting a file based on three fields
Reply with quote

I have a file which needs to be sorted based on three fields first name, middle-name and last-name.

Say input file is in this form:

first-name(24 bytes) middle-name(11 bytes) last-name(24 bytes)

chandan0 kumar12 mehta11
chandan0 kumar1 mehta1
chandan0 kumar1
chandan0 kumar23 mehta12

Desired Output should be in this form:

chandan0 kumar1 mehta1
chandan0 kumar12 mehta11
chandan0 kumar23 mehta12
chandan0 kumar1

P.S. Take starting position as 1 and total bytes as 55.

Thanks.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Feb 05, 2008 10:10 pm    Post subject:
Reply with quote

It's not clear what you want to do. You say the total is 55 bytes but 24+11+24 adds up to 59 bytes, not 55 bytes. You say you want to sort on the first name, middle name and last name. The result of sorting that way with

Code:

    SORT FIELDS=(1,59,CH,A)


or with

Code:

    SORT FIELDS=(1,24,CH,A,25,11,CH,A,36,24,CH,A)


which are equivalent, would be:

Code:

chandan0                kumar1             
chandan0                kumar1     mehta1   
chandan0                kumar12    mehta11 
chandan0                kumar23    mehta12 


since blank sorts before the letters, but you show the expected result as:

Code:

chandan0                kumar1     mehta1
chandan0                kumar12    mehta11
chandan0                kumar23    mehta12
chandan0                kumar1


You need to explain more clearly what you're trying to do and the "rules" you want to use to get the result you want.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us