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

I/O Problem with specifying and connecting to directory path and file name in OPEN statement

grosguth
Beginner
300 Views

Dear Sir,

Please find attached piece of code. For some reason the program fails (error code 29) to connect to the A690012.A07006.ASCII file with what I understand to be its fully qualified pathname D:LESS_Batch�_Endian_Conversion1Q07. I have tried the pathname without the D:and I get the same error code 29. The program appears to be assembling the path name and file name correctly. It states in the Intel Fortran Language Reference that the FILE specifier can contain the pathname prefixing the filename. There are no blanks in the path or file names. IBM PC directories are delimited by '' and directories on UNIX computers are delimited by / (also servers which are UNIX based).
I want to refer back to previous programs' output filesfor input to the next program's input files without duplicating files and wasting space.
BATCH COMPILE LINK AND EXECUTE (Test.bat):
rem compile, link and execute Test Program
rem Intel Visual Fortran Compiler 9.0 for Windows
ifort Test.for /Qsave /traceback /check:bounds
Test.exe D:LESS_Batch�_Endian_Conversion1Q07
pause

FORTRAN Program Source Code (Test.for):
 PROGRAM TEST
C
CHARACTER*60 DSNIN
CHARACTER*120 DSNINP
CHARACTER*60 PATH
C
CALL GETARG(1,PATH)
C
DSNIN='A690012.A07006.ASCII'
LARG=39
DSNINP = PATH(1:LARG)//DSNIN(1:20)
WRITE(UNIT=6,FMT='(A,A)') ' DSNINP=',DSNINP
WRITE(UNIT=6,FMT='(A,A)') ' DSNIN=',DSNIN
C
OPEN (1, FILE=DSNIN,RECL=1440,BLOCKSIZE=1440,STATUS='OLD',
* RECORDTYPE='FIXED',FORM='FORMATTED',ACCESS='SEQUENTIAL',
* IOSTAT=IER)
IF (IER .NE. 0) WRITE(UNIT=6,FMT='(A,I5)') ' IERX=', IER
C
STOP
END

UNIT 6 OUTPUT RESULTS (at terminal screen):
DSNINP=D:LESS_Batch�_Endian_Conversion1Q07A690012.A07006.ASCII
DSNIN=A690012.A07006.ASCII
IERX= 29

DIRECTORY STRUCTURE LAYOUT ON PC (PATHNAME AND FILENAME):
D:LESS_Batch�_Endian_Conversion1Q07A690012.A07006.ASCII
D:LESS_Batch1_Edit1Q07Test.for
D:LESS_Batch1_Edit1Q07Test.exe
D:LESS_Batch1_Edit1Q07Test.bat
Geoff Grosguth
0 Kudos
1 Reply
Steven_L_Intel1
Employee
300 Views
Did you perhaps mean to reference variable DSNINP in the OPEN rather than DSNIN?
0 Kudos
Reply