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
 

 

how to split name using parse

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: how to split name using parse
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Apr 09, 2013 11:03 pm    Post subject: Reply to: how to split name using parse
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    Post subject: Re: Reply to: how to split name using parse
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    Post subject: Re: Reply to: how to split name using parse
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Apr 09, 2013 11:34 pm    Post subject: Reply to: how to split name using parse
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    Post subject: Reply to: how to split name using parse
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    Post subject: Re: Reply to: how to split name using parse
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    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 split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am
No new posts Increase the screen size after split mistah kurtz TSO/ISPF 2 Fri Sep 02, 2016 6:39 pm
This topic is locked: you cannot edit posts or make replies. Massive flat file split sort hsivaramak SYNCSORT 2 Wed Jul 27, 2016 7:44 am
No new posts Huge File Split Sort hsivaramak SYNCSORT 3 Wed Jul 27, 2016 1:12 am


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