This name has not been declared as an array or a function. [TRIM]

The following code gives error:

D:\kraanbaan\kraanbaan\kb_cpp.f90(1006): error #6410: This name has not been declared as an array or a function. [TRIM]

    read(TRIM(HC_local)(LEN_TRIM(HC_local):LEN_TRIM(HC_local)), '(I1)', iostat=ios) HCCl
    if (ios /= 0 .or. HCCl < 1 .or. HCCl > 4) then
        write(error_unit,*) "Error: dyfa - HC must be in format 'HCn' where n is 1-4. Got: ", trim(HC_local)
        beta2 = 0.0_c_float
        phi2min = 0.0_c_float
        phi2 = 0.0_c_float
        norm = 0.0_c_float
        sch = 0.0_c_float
        return
    end if

Roger

You get the error because in Fortran you cannot subscript an expression. In your case, I think you can write

read(HC_local(LEN_TRIM(HC_local):LEN_TRIM(HC_local)), '(I1)', iostat=ios) HCCl
1 Like

Thank you!