G'day all.
I am trying to port some fortran programs from a True64 environment into Sun v9/SunStudio 11. On the alpha it has no problems, but on the Sun it can't open a file with a name that is only 78 characters long. The Fortran User's guide states that the maximum length for a file name is 1024 characters.. The file most certainly exists and is readable to the user: stat gives:
silo@eclipse /silo1/tech1/install/bin -> stat /silo1/tech1/install/import/rtmet/NCC/dayClim/200706/2007062720070627.dc
File: `/silo1/tech1/install/import/rtmet/NCC/dayClim/200706/2007062720070627.dc'
Size: 133170 Blocks: 288 IO Block: 8192 regular file
Device: 1d8005ah/30933082d Inode: 110852 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 3953/sielewiczj) Gid: ( 700/ ciss)
Access: 2008-07-23 12:44:00.533357000 +1000
Modify: 2008-07-04 14:21:00.107423000 +1000
Change: 2008-07-08 09:27:39.322719000 +1000
The compiled Fortran code (called from a wrapper script) however:
[07/23/08 12:46]: silo_dc_import_wrapper starting
Determining dates to process
Now starting to process Silo 1998
aah, how sweet - found file /tmp/silo/DC_filelist
About to check /silo1/tech1/install/import/rtmet/NCC/dayClim/200706/2007062720070627.dc
In file not Found /silo1/tech1/install/import/rtmet/NCC/dayClim/200706/2007062720070627.dc Bye
****** FORTRAN RUN-TIME SYSTEM ******
Error 2: No such file or directory
Location: the OPEN statement at line 770 of "dc_importer.f90"
Unit: 12
File: /silo1/tech1/install/import/rtmet/NCC/dayClim/200706/2007062720070627.dc
Abort
Note that it could succesfully open the file /tmp/silo/DC_filelist... The code in question is:
! Problematic snippet from much longer program..
integer*4 eof, ymd
character*120 in_file, filelist
logical file_exists
file_exists = .TRUE.
filelist = params(2)
inquire(file = filelist, exist = file_exists)
if ( file_exists == .FALSE. ) then
write(*,'(3a)') 'Not Found ', filelist, ' Bye'
return
endif
print *, "aah, how sweet - found file ", filelist
open ( unit=11, file=filelist, status='OLD' ) ! THIS succeeds (/tmp/silo/... short filename)
read ( 11, "(i8, A120)", iostat = eof) ymd, in_file
do while ( eof == 0 )
write (*,'(2a)') "About to check " , in_file
inquire(file = in_file, exist = file_exists)
if ( file_exists == .FALSE. ) then
write( *, '(3a)') 'In file not Found ', in_file, ' Bye'
! return (commented out to see if open also gives an error..)
endif
open ( unit=12, file=in_file(1:len_trim(in_file)) , status='OLD' ) ! THIS is where the program bombs out.
...
end do
I am stumped. Why would this bomb out? The file exists, is readable, the filename is << 1024 characters.. I've also tried to run this as the user who owns the file, to no avail. Any suggestions, please?
Cheers,
Tony