Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Select "SECOND WORD" in text file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
jackare

New User


Joined: 27 Aug 2008
Posts: 32
Location: Brazil

PostPosted: Fri Aug 07, 2015 8:17 pm    Post subject: Select "SECOND WORD" in text file
Reply with quote

Hello everyone!
So... I have a text file like:

SORTIN (sample)
Code:

FIRST DAY
NEW DAY
TIME FOR FUN
MY NAME IS CARLOS


I need a result file with second word of each line, but problem is the start position of this second word is variable:

SORTOUT
Code:

DAY
DAY
FOR
NAME


I am trying to do this using a Syncsort utility, it's possible?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Aug 07, 2015 8:22 pm    Post subject: Reply to: Select "SECOND WORD" in text file
Reply with quote

Yes, have a look in the manual for PARSE. Many examples here, and elsewhere by search-engineing.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Sat Aug 08, 2015 12:17 am    Post subject:
Reply with quote

jackare,
Assuming your second word is always the one to start after (STARTAFT) first blank and ends before blank (ENDBEFR) and can be max 20 bytes (FIXLEN=20), below should work for you. Tested on DFsort.

Code:
//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC PARSE=(%01=(STARTAFT=C' ',ENDBEFR=C' ',FIXLEN=20)),
        BUILD=(%01)                                         
/*                                                         
//*                                                         


Gives below output. If it doesn't work, look for PARSE in Syncsort manuals.

Code:
----+----1----+----2
DAY                 
DAY                 
FOR                 
NAME               



Thanks,
Back to top
View user's profile Send private message
jackare

New User


Joined: 27 Aug 2008
Posts: 32
Location: Brazil

PostPosted: Sat Aug 08, 2015 11:33 pm    Post subject:
Reply with quote

sqlcode1 wrote:
jackare,
Assuming your second word is always the one to start after (STARTAFT) first blank and ends before blank (ENDBEFR) and can be max 20 bytes (FIXLEN=20), below should work for you. Tested on DFsort.

Code:
//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC PARSE=(%01=(STARTAFT=C' ',ENDBEFR=C' ',FIXLEN=20)),
        BUILD=(%01)                                         
/*                                                         
//*                                                         


Gives below output. If it doesn't work, look for PARSE in Syncsort manuals.

Code:
----+----1----+----2
DAY                 
DAY                 
FOR                 
NAME               



Thanks,



sqlcode1,
Very good!
Your tip works perfectly for my case. Thanks a lot
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us