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
 

 

Best logic to Unstring a 1500 bytes description

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Fri Nov 20, 2009 3:34 pm    Post subject: Best logic to Unstring a 1500 bytes description
Reply with quote

i need to split a max 1500 bytes descriptioon to 32 bytes split like if the description has 1280 bytes i need to write in to 40 records ..32 records each..i.e., 32*40 = 1280 bytes..

and i need to find the space , comma , full stop before writing in to the next record ...

Plz post if u have any logic or functions which makes it easy....


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

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Nov 20, 2009 5:30 pm    Post subject: Reply to: Best logic to Unstring a 1500 bytes description
Reply with quote

probably the best approach would be to use the reference modification..

for the full stop the issue is clear
if the long variable contains ... wwww. sssss. rrrr.
build 3 records and get rid of the inital blank after the full stop
Code:
12345678901234567890123456789012
wwww.
sssss.
rrrr.


the comma and space issues are not very clear
please show more details for the process
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Nov 20, 2009 8:40 pm    Post subject:
Reply with quote

Hello,

Suggest you post some sample input showing all of the conditions that might need to be handled and the output from that sample input. . .

What should happen to a comma followed by a space? A double space? And on. . .

Along with the data, you need to post the rules for getting from the input to the output.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Fri Nov 20, 2009 9:39 pm    Post subject:
Reply with quote

I guess it's a long text that he wants to display or print in a 32char wide area, but no splitting of words is allowed.

something like this maybe
Code:
move 1 to startpos
move 1 to ixl

perform until startpos > length(str) or str(starpost:) = spaces
   move 32 to len
   perform until str(startpos+len:1) = ' ' or ',' or '.' or len=0
       subtract 1 from len
   end-perform
   if len=0 then move 32 to len end-if
   move str(startpos:len) to line(ixl)
   add 1 to ixl
   compute startpos=startpos + len + 1
end-perform
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help in building a logic Benchwarmer All Other Mainframe Topics 4 Wed Feb 22, 2017 2:49 am
No new posts TWS EQQYCAIN - not sure how to get ap... mbenaud IBM Tools 0 Wed Dec 14, 2016 8:45 pm
No new posts Wildcard logic in COBOL dudenithy COBOL Programming 13 Thu Sep 01, 2016 7:36 pm
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm
No new posts Sort Logic to extract data scorp_rahul23 DFSORT/ICETOOL 13 Tue Mar 01, 2016 1:22 am


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