Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

List directed I/O error Help.

pecan204
Beginner
795 Views
Hi,

I am getting a list direct I/O syntax error. Everything compiled and created an execuatable.

Does eveything look legal in the file. It is usung an adjustable array in the read.

Thanks, Here is the file.

 program read_data
 
 USE ReadConfigFile

 Implicit Double Precision ( A-H, O-Z), Integer (I-N)

 Character*80 filepath(3),file1, file2, file3

 Double precision, Allocatable :: xread1(:),xread2(:),xread3(:)
 Dimension nvars_in_file(3)

 call gtconfig(nvars_in_file, filepath)

  lin2 = 2
  lin3 = 3
  lin4 = 4


! default sequential, formatted
 open(unit=lin2,file=trim(filepath(1)),status='old',mode='read',share='denynone')
 open(unit=lin3,file=filepath(2),status='old',FORM='formatted')
 open(unit=lin4,file=filepath(3),status='old',FORM='formatted')
 
  nv1 = nvars_in_file(1)
  nv2 = nvars_in_file(2)
  nv3 = nvars_in_file(3)

 ALLOCATE(xread1(nv1),xread2(nv2),xread3(nv3))
 

 Read(lin2,*) (xread1(i), i=1,nv1)
 Read(lin3,*) (xread2(i), i=1,nv2)
 Read(lin4,*) (xread3(i), i=1,nv3)
 

end program Read_data
0 Kudos
4 Replies
Intel_C_Intel
Employee
795 Views
Don't you need TRIM fr the second and the third OPEN too? Couldn't the PATH be longer than 80 characters?

Sabalan.
0 Kudos
Steven_L_Intel1
Employee
795 Views
The TRIM isn't necessary in this case. Trailing blanks in filespecs are ignored. If it was a problem with the OPEN, the error from the READ would be different.

Without seeing the data file, it's difficult to analyze the problem. You should be able to figure out which line (or lines) are being read to help narrow it down.

Steve
0 Kudos
pecan204
Beginner
795 Views
Thanks for the replies.

After reading them I was able to focus more on the file and found that the first field had a time stamp. It bombed on the read of the time.

Such as 12:01:01

The other fields had floating point or integers.

Any suggestions on handling the time? I do need the parameter for later processing.

Thanks
0 Kudos
Steven_L_Intel1
Employee
795 Views
Read it as a string with an (A) format.

Steve
0 Kudos
Reply