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

how to split name using parse


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
norm.flynn

New User


Joined: 08 Jan 2013
Posts: 20
Location: usa

PostPosted: Tue Apr 09, 2013 10:17 pm
Reply with quote

I have a file with a name last name, first name, followed by some other data, need to split the name field into 2 fields last name and first name, the name field itself is fixed.
Code:
=COLS> ----+----1----+----2----+----3----+----4----+---
000008 0  000003401   ADAMS, MARIA R.             CX A
000009    000004440   WADE, MAUREEN YVETTE        CX A
000010    000011500   ALFARO, CARMEN MERCEDEZ     CX A


So the name fiels starts at 16, and ends at 43. Just need the parse statement to create the 2 fields last name and first name

Thanks
Norm
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 11:03 pm
Reply with quote

What output are you expecting from that sample?
Back to top
View user's profile Send private message
norm.flynn

New User


Joined: 08 Jan 2013
Posts: 20
Location: usa

PostPosted: Tue Apr 09, 2013 11:09 pm
Reply with quote

I am expecting 2 fixed fields one with the last name and one with the first name. I know how to include the parsed fields in a build statement, just not sure how to construct the 2 parsed fields.

Thanks
Back to top
View user's profile Send private message
norm.flynn

New User


Joined: 08 Jan 2013
Posts: 20
Location: usa

PostPosted: Tue Apr 09, 2013 11:23 pm
Reply with quote

My difficulty is that there is could be an embedded space in the first name, so not sure how to get the parse to stop in the correct place, ideally I could have it search just the positions taken up by the entire name, but that does not seem to be an option.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 09, 2013 11:34 pm
Reply with quote

OK, can you post some sample data which covers all the things you can think of, and show the actual expected output for that data, please.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Apr 09, 2013 11:37 pm
Reply with quote

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
0  000003401   ADAMS, MARIA R.             CX A               
   000004440   WADE, MAUREEN YVETTE        CX A               
   000011500   ALFARO, CARMEN MERCEDEZ     CX A               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INREC BUILD=(16,28)                                         
  OUTREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=20),%02=(FIXLEN=20)),
         BUILD=(%01,%02)                                       
//*
Back to top
View user's profile Send private message
norm.flynn

New User


Joined: 08 Jan 2013
Posts: 20
Location: usa

PostPosted: Mon Apr 15, 2013 10:37 pm
Reply with quote

Thanks, I didn't mention that I needed to create an output file which splits many other fields from a report into a tab-delimited file. You solution gave me the idea to just add the name field at the end of the inrec, and then apply your parse command to the extra field and include them in the outrec, which work fine. The final sort statment is as follows

Code:

SORT FIELDS=COPY
INREC BUILD=(1,133,16,28)                                             
OUTREC PARSE=(%01(ABSPOS=134,ENDBEFR=C',',FIXLEN=20),                 
       %02=(FIXLEN=20)),                                               
    BUILD=(4,9,X'05',%01,X'05',%02,X'05',44,2,X'05',47,1,X'05',     
               50,17,X'05',68,8,X'05',78,3,X'05',82,11,X'05',95,3)     

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 How to split large record length file... DFSORT/ICETOOL 8
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts JCL/SORT to Split Records SYNCSORT 28
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
Search our Forums:

Back to Top