Re: Read a list with undefined length

Allamarein <matteo.diplomacy@xxxxxxxxx> wrote:
When I use the READ statement, I use data file of this kind:


x y
2 5
7 9
10 13

Are branch specifiers if an error (ERR=label), end-of-file
(END=label), or end-of-record (EOR=label) condition occurs.
EOR can only be specified for nonadvancing READ statements."

Could I use this optional input for my purpose?

This has resulted in long discussions in the past.
There is no easy answer.

Well, in the days of static allocation it was easy. One allocated
the arrays as large as possible (on the single task machine) and
read in as much as one could.

With dynamic allocation, one has to know how big to allocate
the array to read in the data, but one doesn't know how big
until the data has been read. There are ways around that, but
not so easy to describe in one post.

My least favorite is to read the whole file counting records
but not storing data, REWIND, allocate, and read again. I am
not recommending it, but that is what some do.

-- glen