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
 

 

Extract first name and last name from input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
gaps030980

New User


Joined: 27 Sep 2005
Posts: 8
Location: Gurgaon

PostPosted: Wed Nov 26, 2008 2:26 am    Post subject: Extract first name and last name from input file
Reply with quote

I have an input file having first name a space followed by the last name. The max combined length is 20 char. I need to pull up the first name and store it separately to a 2nd file and extract the last name and store it separately to a 3rd file. How do I do that using a JCL/SORT?
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2181
Location: @my desk

PostPosted: Wed Nov 26, 2008 2:30 am    Post subject:
Reply with quote

Can you post here the sort product info.(DFSORT/Syncsort) with the version nbr. See the SYSOUT of any job run to find this info.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 26, 2008 2:40 am    Post subject:
Reply with quote

Kushal,

You can use a DFSORT job like the following to do what you asked for.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
ALFRED SMITH
WILLIAM JONES
JOE PLUMBER
GEORGE WASHINGTON
/*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=OUT1,
    PARSE=(%01=(ENDBEFR=C' ',FIXLEN=20)),
    BUILD=(%01)
  OUTFIL FNAMES=OUT2,
    PARSE=(%=(ENDBEFR=C' '),
           %02=(FIXLEN=20)),
    BUILD=(%02)
/*


OUT1 would have:

Code:

ALFRED   
WILLIAM   
JOE       
GEORGE   


OUT2 would have:

Code:

SMITH       
JONES       
PLUMBER     
WASHINGTON 


For complete details of DFSORT's PARSE function, see:

http://www.ibm.com/systems/support/storage/software/sort/mvs/peug/
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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