Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Unusual INQUIRE() function return value in IVF

Yulin_Z_
Beginner
163 Views

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

0 Kudos
1 Reply
Steven_L_Intel1
Employee
163 Views

I can't reproduce this problem when I turn your fragment into a running program. Would you please supply a small but complete program that shows the problem? Also please tell me the exact version of Intel Visual Fortran you are using (for example, 16.0.2 or Parallel Studio XE 2016 Update 2).

0 Kudos
Reply