Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!fatcity!khb From: khb@fatcity.Sun.COM (fatcity) Newsgroups: comp.lang.fortran Subject: Re: ERR= and END= Message-ID: <91960@sun.uucp> Date: 2 Mar 89 01:24:17 GMT References: <2291@unmvax.unm.edu> <91480@sun.uucp> <3234@ttrdc.UUCP> <3836@s.cc.purdue.edu> Sender: news@sun.uucp Reply-To: khb@sun.UUCP (fatcity) Distribution: usa Organization: Sun Microsystems, Mountain View Lines: 50 In article <3836@s.cc.purdue.edu> ags@s.cc.purdue.edu (Dave Seaman) writes: >In article <3234@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes: >>In article <91480@sun.uucp>, khb%fatcity@Sun.COM (fatcity) writes: >>< do i = 1, max >>< read(ilun,'(your format)',IOSTAT=istat) your variable list >>< if (istat .EQ. EOF) then >>< EXIT >>< else if (istat .NE. OK) then >>< call abort('your favorite abort messages',istat) >>< endif >>< your processing goes here >>< end do >> >>Nice idea, but isn't it kind of environment dependent? Like, where does the >>value of the EOF parameter come from? > >A good point. To make it environment-independent, change the condition > > if (istat .EQ. EOF) then > >to read > > if (istat .LT. 0) then > I neglected to save a copy of my original posting, but I beleive that I pointed out that the constants had to be defined. If one wishes to remain totally ansi compliant (no includes), yet have the codes be in exactly one place INTEGER EOF COMMON /IOSTUF/ EOF, etc. and a block common used to define the machine values. Dave is right, one can use the numerical values directly....but I find that it is easier to read, and maintain code with the suggested symbolic substitution. If one allows macros (as found in all POSIX compliant systems, and many wanna be's) #include "iostuff" And there you have it. Cheers, all. Keith H. Bierman It's Not My Fault ---- I Voted for Bill & Opus