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

Best logic to Unstring a 1500 bytes description


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 20, 2009 5:30 pm
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

Moderator Emeritus


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

PostPosted: Fri Nov 20, 2009 8:40 pm
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: 1281
Location: Belgium

PostPosted: Fri Nov 20, 2009 9:39 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
No new posts Rexx Logic error while adding seperat... CLIST & REXX 3
No new posts PL/1 Callback address logic in z/OS C... PL/I & Assembler 1
Search our Forums:

Back to Top