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

error in open in 2018 upd 2

Brooks_Van_Horn
New Contributor I
1,012 Views
I'm getting an error during execution on an open statement. There are two files and the first does exist while the second does not. 
The code segment follows:
C:\Users\Brooks\Desktop\Stats\Stats.txt
C:\Users\Brooks\Desktop\Stats\PRN.dat

forrtl: severe (29): file not found, unit 3, file \\.\PRN
Image              PC        Routine            Line        Source
libifcoremdd.dll   519D2617  Unknown               Unknown  Unknown
libifcoremdd.dll   519F9190  Unknown               Unknown  Unknown
MyStats.exe        0032F1BF  _MAIN__                    51  MyStats.f90
MyStats.exe        003354D3  Unknown               Unknown  Unknown
MyStats.exe        0033873E  Unknown               Unknown  Unknown
MyStats.exe        00338620  Unknown               Unknown  Unknown
MyStats.exe        003384CD  Unknown               Unknown  Unknown
MyStats.exe        00338758  Unknown               Unknown  Unknown
KERNEL32.DLL       759A8654  Unknown               Unknown  Unknown
ntdll.dll          77B64B17  Unknown               Unknown  Unknown
ntdll.dll          77B64AE7  Unknown               Unknown  Unknown

Code Segment:

    fName1 = "C:\Users\Brooks\Desktop\Stats\Stats.txt"
    write(6,*) fName1
    open (unit=2,file=fName1,status='REPLACE',form='FORMATTED',action="WRITE")
    rewind 2
    fName2 = "C:\Users\Brooks\Desktop\Stats\PRN.dat"
    write(6,*) fName2
    open (unit=3,file=fName2,status='REPLACE',form='FORMATTED',action="WRITE")  <=== Line 51

 

When status="REPLACE" I thought if the file does not exist then it creates one; but it bombs me out instead.

Thanks,

Brooks

0 Kudos
1 Solution
mecej4
Honored Contributor III
1,012 Views

PRN, LPT, COM1, COM2, CON are examples of special files, which are tied to devices with specific properties. You cannot have a file name that clashes with these dedicated names.

View solution in original post

0 Kudos
4 Replies
Brooks_Van_Horn
New Contributor I
1,012 Views

I'm running Win 10 x64 on an Intel i7 with 32GB RAM and 1 TB disk.

0 Kudos
mecej4
Honored Contributor III
1,013 Views

PRN, LPT, COM1, COM2, CON are examples of special files, which are tied to devices with specific properties. You cannot have a file name that clashes with these dedicated names.

0 Kudos
Brooks_Van_Horn
New Contributor I
1,012 Views

Thanks very much. Did not know that.

Brooks

0 Kudos
Brooks_Van_Horn
New Contributor I
1,011 Views

Thanks very much. Did not know that.

Brooks

0 Kudos
Reply