Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Unusual INQUIRE() function return value in IVF

$
0
0

Hello all,

I have a old program which was finished in Fortran 77 on Microsoft FORTRAN Powerstation. I am trying to immigrating the codes to IVF right now. I got one issue with the return value of the INQUIRE function and I attached the needed subroutines as follows:

  •       CHARACTER*132 LINE, I_NAME
  •       LOGICAL       EOF, I_OPEN, I_EXIST, HASNAME
  •       INTEGER*2     IO,IO_OPENSYS1,IO_CLOSESYS,NREC,NUMBER,I_NUMBER,
  •      *                       IS,IE,IERR,I,IDG,IFD,J,NUMCHR32
  •       LINE=MODEL(1:LEN_TRIM(MODEL))//'\'//
  •      *     MODEL(1:LEN_TRIM(MODEL))//'.TYP'
  •      INQUIRE(UNIT=0,OPENED=I_OPEN,NAME=I_NAME,NUMBER=I_NUMBER) !test
  •       close(0)
  •       open(5,file=LINE)
  •       INQUIRE(FILE=LINE,EXIST=I_EXIST,NAME=I_NAME,NUMBER=NUMBER) !test
  •       close(NUMBER)
  •       INQUIRE(FILE=LINE,EXIST=I_EXIST,NAME=I_NAME,NUMBER=NUMBER)
  •       IF(NUMBER.EQ.-1) THEN
  •         IO=IO_OPENSYS1(0,LINE,'INPUT')
  •       ELSE 
  •         IO=NUMBER
  •         CALL BACKSPACE_TO_TOP(IO,NREC)
  •       ENDIF
  •       RETURN
  •       END

 I used three INQUIRE function. The first two are for test. After the last INQUIRE statement, the NUMBER value is always 0. In my opinion, I have used the close() function which means the unit should have already been disconnected with the file and the NUMBER in the last INQUIRE should return -1. The last NUMBER on the previous platform (Powerstation) returns -1 but in IVF always return 0. Are there any ideas what is happening here? Thank you.

Yulin


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>