Unformated file opening error (IoStat=30)

Unformated file opening error (IoStat=30)

I am using the same subroutine to open and read unformatted files in two different programs, built on a Win2000 machine using CVF 6.6a. The files have been created on a VMS machine, with a fixed record length.

The following code, which is part of a subroutine, is used to examine the properties of the files and open them:

	Open(		Unit		= FileLun,	&						! try to open exisiting file
     			File		= FileName,	&
     			Form		= 'UNFORMATTED',	&
     			IoStat		= IoStat,	&
!dvf     		Recl		= 512,								! VMS
     			Recl		= 128,		&						! CVF
     			RecordType	= 'FIXED',	&
     			Shared,			&
     			Status		= 'OLD')

The two programs report different properties for the same file:

Program A: exists=.True., recl=0, Recordtype=UNKNOWN and the Open command is successful.

Program B: exists=.True., recl=132, Recordtype=STREAM_LF and the Open command fails with IoStat=30

I looked carefully the compiler and linker options, but they look the same.

Any clue, where to look for a solution.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I just noticed, that the inquire command has been left out from the code posted. Please add the following line in front of the Open statement:

	INQUIRE (FILE = FileName, EXIST = exists, recl=recl, recordtype=recordtype)

Take off the IOSTAT and see what error you get.

Note that RECL= in INQUIRE isn't useful for non-opened files on Windows.


Retired 12/31/2016

The following error was observed after removing the IoStat from the open statement:

forrtl: The process cannot access the file because it is being used by another process.
forrtl: severe (30): open failure, unit 11, file C:RE179TG.SPC

There is no other process running, which wants to open this file. Restarting the computer and running the application gives the same error.

Well, something has the file open - perhaps it is opened in the same program on another unit?


Retired 12/31/2016


You are right. The file has been opened by the program using a different unit number. Interestingly it did not cause any problem on the VMS system, where the program has been developed.

If all your OPENs use same options, I would still suspect an external agent. If all units are open shared that should work on either OS.


Leave a Comment

Please sign in to add a comment. Not a member? Join today