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

Sorting a file based on three fields


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Feb 05, 2008 10:10 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top