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

Name Sorting using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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: 1742
Location: Tirupur, India

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

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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top