MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT help in unstring name field

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Apr 27, 2011 8:57 am    Post subject: DFSORT help in unstring name field Reply with quote

My input file is having Full-name field from 1-40 bytes. Starts from 1st byte.
I need to split this name into First-name and Last-name fields in the output file each of 30 bytes.
Full name will contain names with spaces in between.
Name before first space should go to First-name field and name before second space should go to Last-name field.

Example1:
Input file:
Code:
----+----1----+----2----+----3----+----4
RADHA KRISHNAN                         

Output file:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6

RADHA                         KRISHNAN                     

Example2:
Input file:
Code:
----+----1----+----2----+----3----+----4
RAVI KUMAR NAYAK                       


Output file:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6
RAVI                          KUMAR                         


I need to do this using DFSORt. Please help in this.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 27, 2011 10:27 am    Post subject: Reply with quote

psmadhusudhan,

Do you want to truncate the last name if it has an embedded space? In the 2nd example you dropped Nayak from the last name, is that what you really want? ie. delimiting the last name also with a space. If that is indeed the case then use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                 
RADHA KRISHNAN                                   
RAVI KUMAR NAYAK                                 
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
  INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=30),     
               %02=(ENDBEFR=C' ',FIXLEN=30)),   
        BUILD=(%01,%02)                         
//*


This will create an output file of 60 bytes with the following contents
Code:

----+----1----+----2----+----3----+----4----+----5----+----6
RADHA                         KRISHNAN       
RAVI                          KUMAR           

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Apr 27, 2011 6:56 pm    Post subject: Reply with quote

Thanks Kolusu for your solution. How to do this if my Full name is in between the record like say 100-139 and also I am doing outrec format on other fields then how should this jcl be formatted.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 27, 2011 8:18 pm    Post subject: Reply with quote

psmadhusudhan wrote:
Thanks Kolusu for your solution. How to do this if my Full name is in between the record like say 100-139 and also I am doing outrec format on other fields then how should this jcl be formatted.


psmadhusudhan,

Show me your existing control cards and I will show you how to incorporate parsing into them.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Wed Apr 27, 2011 9:57 pm    Post subject: Reply with quote

Below is my control card
OUTREC Fields=(24,9,PD,EDIT=(TTTTTTTTTTTTTTTT),111,20))

Fullname field is from 12O and unstring names should be present in between above two outrec fields
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 28, 2011 10:34 am    Post subject: Reply with quote

psmadhusudhan wrote:
Below is my control card
OUTREC Fields=(24,9,PD,EDIT=(TTTTTTTTTTTTTTTT),111,20))

Fullname field is from 12O and unstring names should be present in between above two outrec fields


Psmadhusudhan,

If the full name field starts at pos 120 , how come you are picking 20 bytes from pos 111? isn't it already picking a part of the full name? Either way use the following control cards and change the last field to whatever you want. I am assuming your input is RECFM=FB file. If it is VB then you have to consider the RDW.

Code:

//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC PARSE=(%01=(ABSPOS=120,ENDBEFR=C' ',FIXLEN=30),         
               %02=(ENDBEFR=C' ',FIXLEN=30)),                   
        BUILD=(24,9,PD,EDIT=(TTTTTTTTTTTTTTTT),%01,%02,111,9)   
//*



PS: It would save you and myself a lot of time if you posted all the details in one go rather than in bits and pieces.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
psmadhusudhan
Beginner


Joined: 28 Nov 2006
Posts: 143
Topics: 48

PostPosted: Fri May 06, 2011 11:23 pm    Post subject: Reply with quote

Sorry for late reply. Its working gr8. Thanks Kolusu.
_________________
Thanks
Madhu Sudhan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group