0
votes

I am getting an error during the execution of my Fortran subroutine with a commercial program (Abaqus). I have used some write statements for printing the results to external text files. e.g. printing some integer values to already existing file:

OPEN(UNIT=304,FILE="full_path_to_file/outputs.txt",position="append")
WRITE(304,*) KINC,NOEL,NPT

I get this error:

UNRECOVERABLE error on system request
lib-2: No such file or directory
Encountered during an OPEN of unit 101
Fortran unit 101 is not connected

I investigated the documentation, as well as did a lot of googling on internet, about this lib-2 thing, as well as Fortran output file units, but no success. Furthermore I changed the unit number, but this error has nothing to do with a specific unit number. I will be very thankful if someone with knowledge about this can give me some hints about the origin of this error as well as how to resolve it.

Thanks!
Mubeen.

2
if you are really stuck, one thing you may find useful is to write your own main calling program to call your user subroutine for debugging. - agentp
another thought, are you opening the file on every call to the subroutine? Do you close it? This a bad thing for performance anyway, but maybe the error related to opening an already open unit. - agentp
actually the Windows version of this software (which I have installed with Intel's Visual Fortran) runs quite well with this subroutine; as well as the other Linux machines with ifort + Abaqus also write data to external files perfectly fine!! But on Linux platform with ** Open64 Compiler Suite **, the Linux version of this software has problems with writing data to external files!! and I am still trying to figure it out if it is compatibility issue (Abaqus + Open64 compiler suite) ?? - Mubeen Shahid

2 Answers

0
votes

The lib-2 is nothing standard, it is just a compiler specific thing (you do not mention your compiler). Does the file exist? Do you have the right working directory? If you try

OPEN(UNIT=304,FILE="full_path_to_file/outputs.txt",status="replace")

, you should see, where a new file emerged and that is the place you file should be placed for appending into it.

0
votes

Your code fragment shows a write to Fortran unit 304 yet the error message is about Fortran unit 101. There are compiler specific limits on the largest possible unit number. Perhaps 304 is too large for your compiler. Or does the code somewhere else use unit 101? Look for an open statement that uses unit number 101 and see what file that open statement is trying to open. Is the compiler informing you of the line number of the statement causing the problem?

P.S. In response to comments: What happens if you change the writes to "write (*, *)"? Does the program work then? If so, it suggests a problem with the open statement. Are you sure that the path to the file is correct? That the program has privileges to write to that directory? Try removing the path and opening a file in the current directory. If you have access to a different Fortran compiler, try it and see if it provides you with a more useful error message.