error with character length

error with character length


I was using the following code in fortran 90 for reading different input files. But when i used intel fortran it gave me this error

Error 1 error #6362: The data types of the argument(s) are invalid. [LEN] D:\3D_U_1 - Prism_int\sub1.f90 6

Error 2 error #6415: This name cannot be assigned this data type because it conflicts with prior uses of the name. [FNAME] D:\3D_U_1 - Prism_int\sub1.f90 6

" fname : is the name of different file that i need to read"

Subroutine InputNum(fname,nv)

character(len=len(fname)), intent(in) :: fname
integer, intent(out) :: nv

Open(10,file = fname, STATUS='old')
Read(10,*) nv
Close (10)

End subroutine InputNum

Subroutine getmatrix_int(fname,v,nv,z)

character(len=len(fname)), intent(in) :: fname
integer, intent(in) :: nv,z
Integer, dimension(nv,z), intent(out) :: v
integer :: i, stat

Open(10,file = fname, STATUS='old')
i = 1


Read(10,*,iostat=stat) (v(i,j),j=1,z)

if (stat < 0) exit
i = i + 1

End do
Close (10)

End subroutine Getmatrix_int



2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The statement:

character(len=len(fname)), intent(in) :: fname

is incorrect because it is trying to use a characteristic of fname to declare itself. I think what you want is:

character(len=*), intent(in) :: fname

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today