Much more elegant solution.

Lionel B. Dyck <sdg><
Website: https://www.lbdsoftware.com

"Worry more about your character than your reputation.  Character is what you 
are, reputation merely what others think you are." - John Wooden

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Paul Gilmartin
Sent: Saturday, July 11, 2020 10:53 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Concatenating lines

On Sat, 11 Jul 2020 08:27:54 -0500, Lionel B Dyck wrote:

>This is a very quick and somewhat dirty example:
>
>/* rexx */                                             
> 'alloc f(in) ds(lionel.doc(concinp)) shr reuse'        
> 'execio * diskr in (finis stem in.'                    
> 'free  f(in)'                                          
> do i = 1 to in.0                                       
>   data = ''                                            
>   if substr(in.i,72,1) /= '+'                          
>   then data = in.i                                     
>   else do while substr(in.i,72,1) = '+'                
>     data = data''substr(in.i,1,71)                     
>     i = i + 1                                          
>     data = data''substr(in.i,1,71)                     
>     i = i + 1                                          
>     if substr(in.i,72,1) /= '+' then i = i - 1         
>   end                                                  
>   say data                                             
> end                                                    
>
>Now have fun with this and I'm sure you can improve upon it for your purposes 
>- a generalized input prompt or allocation and same for output.
>
/* Not making a non-continued line a special case,
   I'd simplify the loop to: */

 signal on novalue  /* Always!  */
 data = ''                                            
 do i = 1 to in.0
   parse value in.i with l 72 c 73 .
   data = data''l
   if c = ' ' then do
     say data
     data = ''
   end
 end i

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to