[comp.lang.fortran] XLF FORTRAN transfer on ERR=

jgs@gn.ecn.purdue.edu (jgs) (04/10/91)

I'm just posting this for a friend so please
direct e-mail to this address:

uunet!idaho!othello!rhodesii

Does anyone know of an alternative way to on
an IBM RS-6000 to make the following read statement 
transfer control?

      dimension array1(100),array2(100)
      write(7)array1
      rewind 7
      read(7,iostat=jstat,err=100)array2
      print*,'jstat=',jstat
      print*,'no transfer'
      stop
100   continue
      print*,'we transferred !!'
      print*,'jstat=',jstat
      end

Running this on an IBM RX-6000 PowerStation 320 yields:

1525-003 Warning, the unformatted I/O request for
file fort.7 cannot be completed because the end of
the record was reached. The program will continue.
 jstat=          0
 no transfer
STOP

It doesn't consider a read past end-of-record so
there is no error transfer and the ISOTAT is zero.
No blood no foul. This doesn't surprise me since
since IBM mainframe's behave the same way.
It appears that IBM has more or less just ported their
mainframe FORTRAN to their UNIX boxes.
Apparently the standard is quite specific as to what
actually constitutes an I/O error and IBM's interpretation
is a little stricter than the rest of the world's
(SUN, DEC, STARDENT, CRAY, ETA10, CYBER-205, HP,
and GOULD - hardly a complete list, but a fair
cross section nonetheless).

However, I now need to be able to know when
this condition (read past end of record)
exists and was wondering if anybody could suggest an
alternative here -after all it's smart enough to issue
the warning message, so is there some way to trap on
this condition?

It would be nice if IBM would make a compiler switch to
handle this condition. I can only dream -:)

Joel Rhodes
591 Park Ave. Suite 302
Idaho Falls ID. 83402
ph(208) 522-8443
uunet!idaho!othello!rhodesii