行继续符不起作用

时间:2018-11-23 07:59:25

标签: fortran gfortran fortran77

我已经使用了Fortran 77几个月了,并且行连续符有时不起作用。

    if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then          
    write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j),
  &           a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j),
  &           b3(j),0.2
    else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
    write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),
  &           a8(j),a9(j),a10(j),a11(j),a12(j),a13(j),
  &           a14(j),a15(j),b1(j),b2(j)
    end if

这是代码,当我编译它时,编译器说'&'是无效字符。我真正好奇的是,有时候它有用,有时却没有。可能我对fortran语法有一个基本的误解。

final.f:59:72: Error: Expected expression in WRITE statement at (1)
final.f:60:9:

    &           b3(j),0.2
         1
Error: Invalid character in name at (1)
final.f:63:72: Error: Expected expression in WRITE statement at (1)
final.f:64:9:

    &           a14(j),a15(j),b1(j),b2(j)
         1
Error: Invalid character in name at (1)

有人可以帮助我吗?

    parameter(m=813,n=616)
    real*8 a5(m),a6(m),a7(m),a8(m),a9(m),a10(m),a11(m),a12(m),a13(m)
    integer*8 a1(m),a2(m),a3(m),a4(m),p1(n)
    real*8 p2(n),p3(n),p4(n),p5(n),p6(n),a14(m),a15(m)
    real*8 b1(m),b2(m),b3(m)
    character skip80*80


    open(11,file='dist.dat')

    open(12,file='mksa.dat')
    open(13,file='mksb.dat')
    open(14,file='mksc.dat')
    open(15,file='mksi.dat')

    open(22,file='ksaf.dat')
    open(23,file='ksbf.dat')
    open(24,file='kscf.dat')
    open(25,file='ksif.dat')



    read(12,*)skip80
    do i=1,m
    read(12,*) a1(i),a2(i),a3(i),a4(i),a5(i),a6(i),a7(i),
 &           a8(i),a9(i),a10(i),a11(i),a12(i),a13(i),a14(i),a15(i)
    end do

    do i=1,n
    read(11,*) p1(i),p2(i),p3(i),p4(i),p5(i),p6(i) 
    end do


    do j=1,m
    do i=1,n
    if(a1(j).eq.p1(i))then
    b1(j)=p4(i)
    b2(j)=p5(i)
    b3(j)=p6(i)


    end if


    end do

    if((b1(j).eq.0d0).and.(b3(j).ne.0d0))then          
        write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j),a8(j)
  &              ,a9(j),a10(j),a11(j),a12(j),a13(j),a14(j),a15(j)
  &              ,b3(j),0.2
    else if((b3(j).eq.0d0).and.(b1(j).ne.0d0))then
        write(22,*) a1(j),a2(j),a3(j),a4(j),a5(j),a6(j),a7(j)
  &              ,a8(j),a9(j),a10(j),a11(j),a12(j),a13(j)
  &              ,a14(j),a15(j),b1(j),b2(j)
    end if




    end do
    end

0 个答案:

没有答案