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

Copy only TEXT or String from a record


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pshongal

New User


Joined: 14 Jun 2012
Posts: 98
Location: India

PostPosted: Fri Nov 08, 2024 3:49 am
Reply with quote

I have a file as below. I want to copy only the "text" from the records. Since the position of text is random, how do I copy?

Input:
Code:

1   1  xxx-xxx
2   1  nn-nn-nn
3   1  yy-y
4      2   xx-xx
5      2   mm-mm 


Output:
Code:

xxx-xxx
nn-nn-nn
yy-y
xx-xx
mm-mm


Thanks
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Fri Nov 08, 2024 9:24 am
Reply with quote

For the given sample data, use:
Code:
OPTION COPY                                               
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,PREBLANK=C'0123456789'))
END
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Fri Nov 08, 2024 10:05 am
Reply with quote

Alternatively, a PARSE on the third column helps.
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 98
Location: India

PostPosted: Tue Nov 19, 2024 12:03 pm
Reply with quote

Thank you very much Joerg. I was not aware squeeze option in sort. It worked.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Nov 19, 2024 12:43 pm
Reply with quote

The alternate option would be like this:
Code:
OPTION COPY                                               
INREC IFTHEN=(WHEN=INIT,                                 
  PARSE=(%=(STARTAT=NONBLANK,ENDBEFR=BLANKS,REPEAT=2),   
         %01=(STARTAT=NONBLANK,ENDBEFR=BLANKS,FIXLEN=80)),
  BUILD=(%01))                                           
END
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
Search our Forums:

Back to Top