Re: Read a list with undefined length
- From: Louis Krupp <lkrupp_nospam@xxxxxxxxxxxxxxxxx>
- Date: Sat, 26 Mar 2011 11:49:00 -0600
On 3/25/2011 2:15 PM, glen herrmannsfeldt wrote:
Allamarein<matteo.diplomacy@xxxxxxxxx> wrote:<snip>When I use the READ statement, I use data file of this kind:
npts
25
x y
2 5
7 9
10 13
....
(snip)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.
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.
No, it's not going to get any style points, but this might be the quickest and easiest way to solve the problem. Unless we're talking about files with millions of records, it will take longer to code a solution -- any solution -- than it will take to run the program. A program that takes ten minutes to write will be quicker in the end than one that takes an hour to code.
(It's the same thing that makes scripting languages like Perl so popular. Sure, they're slow, but if that fact is irrelevant to the task at hand, it's a fact that's easily forgotten.)
Louis
.
- Follow-Ups:
- Re: Read a list with undefined length
- From: glen herrmannsfeldt
- Re: Read a list with undefined length
- References:
- Read a list with undefined length
- From: Allamarein
- Re: Read a list with undefined length
- From: glen herrmannsfeldt
- Read a list with undefined length
- Prev by Date: Re: Read a list with undefined length
- Next by Date: Re: how to reference module variable without the use of USE, but explicit?
- Previous by thread: Re: Read a list with undefined length
- Next by thread: Re: Read a list with undefined length
- Index(es):