View previous topic :: View next topic |
Author |
Message |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Apr 27, 2011 8:57 am Post subject: DFSORT help in unstring name field |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 27, 2011 10:27 am Post subject: |
|
|
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 |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Apr 27, 2011 6:56 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 27, 2011 8:18 pm Post subject: |
|
|
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 |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Wed Apr 27, 2011 9:57 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Apr 28, 2011 10:34 am Post subject: |
|
|
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 |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Fri May 06, 2011 11:23 pm Post subject: |
|
|
Sorry for late reply. Its working gr8. Thanks Kolusu. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
|
|