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

Read a ".asc" file into Fortran

msm26
Beginner
1,396 Views
Hello,

I am new to Fortran. I have a *.asc file that I am trying to open and read data from.

I tried the normal open command:

INTEGER :: ierror
INTEGER :: status
OPEN (UNIT=10,FILE=s1989.asc,STATUS= 'OLD', ACTION = 'READ', IOSTAT = ierror)
READ (UNIT=10,*,IOSTAT=status) i x

But the Intel compiler won't comple the program.
error #6456: This name must be a RECORD name. [S1989]
error #6460: This is not a field name that is defined in the encompassing structure. [ASC]

Any help would be greatly appreciated.

0 Kudos
2 Replies
ArturGuzik
Valued Contributor I
1,396 Views
Quoting - msm26
OPEN (UNIT=10,FILE=s1989.asc,STATUS= 'OLD', ACTION = 'READ', IOSTAT = ierror)

Hi,

FILE takes a character expression, so you're missing ' (quotes).

Change it to: FILE='s1989.asc'

A.
0 Kudos
msm26
Beginner
1,396 Views


Thanks a lot for your help. That did it.

All the best,
Sean

0 Kudos
Reply