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
 

 

Name Sorting using DFSORT

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

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Dec 09, 2011 12:20 pm    Post subject: Name Sorting using DFSORT
Reply with quote

Hi All,

Iam having NAME - 30 characters of length. I need to sort this name like First name, Last Name and Middle Name but i don't know from where middle and last names will start. For sure there is a space will come after first name, middle name and last name. Kindly help me how to sort this NAME separately as FIRSTNAME, MIDDLE NAME, LAST NAME ?

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

kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Fri Dec 09, 2011 12:33 pm    Post subject: Re: Name Sorting using DFSORT
Reply with quote

sambasivarao wrote:
I need to sort this name like First name, Last Name and Middle Name

You want to sort the file based on names or split the 30 byte name as first name, last name and middle name. If you want to split it, you will find lot of examples right here in this forum. Try it and let us know what issues you are facing.

Also provide more details like what should be maximum length of each field and if in case there is no middle name how to find it. It will be better if you give us some sample input records.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1456
Location: Azeroth

PostPosted: Fri Dec 09, 2011 12:37 pm    Post subject:
Reply with quote

http://ibmmainframes.com/about50903.html
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Dec 09, 2011 12:39 pm    Post subject: Name Sorting using DFSORT
Reply with quote

The length of the FIRSTNAME, MIDDLE NAME, LAST NAME is not constant. But space will separate among these.

EX: Find the below names how the length is varying of each. But for sure we are seeing space among all the three.

SAMBASIVA REDDY RAVURI
SRINIVASA RAO RAVURI
MAHENDRA BABU KOTA
PAVAN KUMAR KOTA

Kindly help me how to sort ?

Regards,
Sambasiva.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Dec 09, 2011 10:01 pm    Post subject:
Reply with quote

sambasivarao,

Assuming you want to sort the input on FIRSTNAME, the following DFSORT JCL will give you the desired results.


Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
SAMBASIVA REDDY RAVURI                       
SRINIVASA RAO RAVURI                         
MAHENDRA BABU KOTA                           
PAVAN KUMAR KOTA                             
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=30), 
               %02=(ENDBEFR=C' ',FIXLEN=30), 
               %03=(ENDBEFR=C' ',FIXLEN=30)),
        BUILD=(%01,%02,%03)                   
  SORT FIELDS=(1,30,CH,A)                     
//*


The output of this is
Code:

MAHENDRA                      BABU                          KOTA 
PAVAN                         KUMAR                         KOTA 
SAMBASIVA                     REDDY                         RAVURI
SRINIVASA                     RAO                           RAVURI
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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Stripping and Sorting of VB file G SRINIVASA RAO SYNCSORT 5 Wed Sep 14, 2016 1:34 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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