View previous topic :: View next topic
|
Author |
Message |
jackare
New User
Joined: 27 Aug 2008 Posts: 35 Location: Brazil
|
|
|
|
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
I am trying to do this using a Syncsort utility, it's possible? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, have a look in the manual for PARSE. Many examples here, and elsewhere by search-engineing. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
jackare
New User
Joined: 27 Aug 2008 Posts: 35 Location: Brazil
|
|
|
|
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 |
|
|
|