Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!mentor.cc.purdue.edu!s.cc.purdue.edu!ags From: ags@s.cc.purdue.edu (Dave Seaman) Newsgroups: comp.lang.fortran Subject: Re: ERR= and END= Message-ID: <3840@s.cc.purdue.edu> Date: 2 Mar 89 14:01:58 GMT References: <2291@unmvax.unm.edu> <91480@sun.uucp> <3234@ttrdc.UUCP> <3836@s.cc.purdue.edu> <91960@sun.uucp> Reply-To: ags@s.cc.purdue.edu (Dave Seaman) Distribution: usa Organization: Purdue University Lines: 36 In article <91960@sun.uucp> khb@sun.UUCP (fatcity) writes: >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. You missed my point. The fact that you have all your machine-dependent code gathered in one place does not make it less machine-dependent. The ANSI standard guarantees that an end-of-file condition exists if and only if the IOSTAT return is negative, and an error condition exists if and only if the IOSTAT return is positive. The standard does not say what the actual value is required to be. If you prefer to see disguised constants, then by all means use: INTEGER OK PARAMETER (OK=0) . . . READ (5,10,IOSTAT=ISTAT) X,Y,Z IF (ISTAT .LT. OK) THEN . . . handle the EOF condition ELSE IF (ISTAT .GT. OK) THEN . . . handle the error condition ENDIF The point is that this code runs on any standard-conforming processor without change. -- Dave Seaman ags@j.cc.purdue.edu