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
 

 

Splitting of the text without affecting words

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Splitting of the text without affecting words
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Feb 20, 2015 8:22 pm    Post subject: Reply to: Splitting of the text without affecting words
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    Post subject: Reply to: Splitting of the text without affecting words
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: 1219
Location: Israel

PostPosted: Mon Feb 23, 2015 3:14 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Only text from varchar Seppe DB2 8 Thu Apr 21, 2016 10:42 pm
No new posts Query on Splitting up a file abdulrafi COBOL Programming 19 Wed Apr 20, 2016 3:26 pm
No new posts How to send email with Rich Text usin... santhosh5983 JCL & VSAM 4 Fri Apr 08, 2016 2:30 am


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