On Fri, 15 May 2020, at 19:25, Tom Brennan wrote:
> That's a Rexx I never tried, probably out of fear of the "OO" 
> designation :)

You can write code in 'Classic' REXX, in ooREXX and incorporate 
no, or just a little or a lot of OO stuff.

Most of my code is more or less Classic, but (on Windows) I quite
often read an existing file by eg:

   mystream = .stream~new("C:\this\that\other.file")

(which is vaguely analogous to allocating a dd in TSO), then

   linez = mystream~arrayin

which forms an ooREXX array object (named linez) from the lines of 
data, then

   mystream~close

which closes the file.  Then eg 

  say "The file has" linez~items "lines"

   do aline over linez
       say "a line:" aline
   end

will list all of the lines.  ooREXX does now have an "execio" subcommand
but before that came about this small excursion into objects is how I have
quickly and easily read a text file without having to loop to do the I/O
explicitly one record at a time.  The array object isn't a stem, but one can
of course access each element within it explicitly, as well as using the "do
... over" iterative thing. 

-- 
Jeremy Nicoll - my opinions are my own.

----------------------------------------------------------------------
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