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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am

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