vendredi 24 juillet 2015

Go-to statement - Fortran 77 to fortran 90

I am working on a piece of legacy F77 code and trying to convert it to equivalent F90 code. I ran into these lines below and could some one advise if my conversion is correct?

Fortran 77 code:

Subroutine area(x,y,z,d)
do 15 j=1,10
if (a.gt.b) go to 20
15 CONTINUE
20 Statement 1
   Statement 2
   Statement 3
end subroutine

I tried to convert it to F90 and came up as below:

Subroutine area(x,y,z,d)
dloop: do j=1,10
if (a>b) then 
statement 1
statement 2
statement 3
else
write(*,*) 'Exiting dloop'
exit dloop
end if
end do dloop
end subroutine

Could anyone advise if this methodology is correct? In my results, I am not getting the results that I expect. So there could potentially be a problem with my logic. Any suggestions would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire