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

Splitting of the text without affecting words


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Feb 18, 2015 6:10 pm
Reply with quote

Hi All,

I have records of length 80 with the following text which I would like to split into 3 columns of widths 25, 24 and rest into the third column delimited by PIPE.

Can someone suggest me the DFSORT code for this?

Code:



[b]Input[/b]
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000100 RELIANCE INDUSTRIES LIMITED MAIN BRANCH MUMBAI POWAI                   
000200 RELIANCE COMMUNICATIONS, ABCD ROAD, BANGALORE                           
000300 LUPIN PHARMA LIMITED, STREET NO. 1 MYSORE,                             
000400 TATA CONSULTANCY SERVICES| LIMITED, DOMESTIC, MADHAPUR                 
000410                                                                         


Code:

[b]Output[/b]
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000500 RELIANCE INDUSTRIES      |LIMITED MAIN BRANCH     |MUMBAI POWAI
000600 RELIANCE COMMUNICATIONS, |ABCD ROAD, BANGALORE    |           
000700 LUPIN PHARMA LIMITED,    |STREET NO. 1 MYSORE,    |           
000800 TATA CONSULTANCY SERVICES| LIMITED, DOMESTIC,     |MADHAPUR   


Rec # 1: To split the text after 25 chars, the word LIMITED is going to disturb. so the split should happen at the SPACE before the position 26

Rec # 2: New word ABCD starts at pos 26, Previous pos 25 is a SPACE. So, split happened there

Rec # 3: Same as Rec # 1

Rec # 4: The word SERVICES ended at pos 25 and there is a SPACE at pos 26, PIPE added at pos 26 and the SPACE moved to the next column.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Fri Feb 20, 2015 8:22 pm
Reply with quote

Please don't aim your posts at unsolicited individuals.

It can be done, but it is a lot of code compared to a program written in a general-purpose language.

If you need something before the weekend, use a general-purpose programming language.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Feb 20, 2015 10:11 pm
Reply with quote

@Bill Woodger,
Yes, I have started writing a program as well for this. Thanks for your response. Will wait for further responses ...
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Mon Feb 23, 2015 3:14 am
Reply with quote

I too would opt for a program.
Which language do you use?
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Feb 24, 2015 12:08 pm
Reply with quote

@ Marso,
I'm using COBOL proram.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Send text at cursor position on an IS... CLIST & REXX 10
No new posts FTP ASCII-Text to Mainframe - REG All Other Mainframe Topics 4
No new posts logically splitting a CICS region - help CICS 3
No new posts Splitting one record in a file to 10 ... DFSORT/ICETOOL 9
No new posts Splitting one row into multiple Rows ... DFSORT/ICETOOL 9
Search our Forums:

Back to Top