Error which appears in one program

Dear all ;

I use the following subroutine in 2 programs.

in one of the programs it can be compiled without any error and in the

other one it makes a lot of errors.

SUBROUTINE LAGZO(N,X,W)

! =========================================================

! Purpose : Compute the zeros of Laguerre polynomial Ln(x)

! in the interval [0,], and the corresponding

! weighting coefficients for Gauss-Laguerre

! integration

! Input : n --- Order of the Laguerre polynomial

! X(n) --- Zeros of the Laguerre polynomial

! W(n) --- Corresponding weighting coefficients

! =========================================================

IMPLICIT DOUBLE PRECISION (A-H,O-Z)

DIMENSION X(N),W(N)

HN=1.0D0/N

DO 35 NR=1,N

IF (NR.EQ.1) Z=HN

IF (NR.GT.1) Z=X(NR-1)+HN*NR**1.27D0

IT=0

10 IT=IT+1

Z0=Z

P=1.0D0

DO 15 I=1,NR-1

15 P=P*(Z-X(I))

F0=1.0D0

F1=1.0D0-Z

DO 20 K=2,N

PF=((2.0D0*K-1.0D0-Z)*F1-(K-1.0D0)*F0)/K

PD=K/Z*(PF-F1)

F0=F1

20 F1=PF

FD=PF/P

Q=0.0D0

DO 30 I=1,NR-1

WP=1.0D0

DO 25 J=1,NR-1

IF (J.EQ.I) GO TO 25

WP=WP*(Z-X(J))

25 CONTINUE

Q=Q+WP

30 CONTINUE

GD=(PD-Q*FD)/P

Z=Z-FD/GD

IF (IT.LE.40.AND.DABS((Z-Z0)/Z).GT.1.0D-15) GO TO 10

X(NR)=Z

W(NR)=1.0D0/(Z*PD*PD)

35 CONTINUE

RETURN

END

+++++++++++++++++++++++++++++++++++

ifort test.f90

**************************

errors:

fortcom: Error: test.f90, line 23: A specification statement cannot

appear in the executable section.

SUBROUTINE LAGZO(N,X,W)

------^

fortcom: Error: test.f90, line 35: A specification statement cannot

appear in the executable section.

IMPLICIT DOUBLE PRECISION (A-H,O-Z)

--------^

fortcom: Error: test.f90, line 36: A specification statement cannot

appear in the executable section.

DIMENSION X(N),W(N)

--------^

fortcom: Error: test.f90, line 37: This name does not have a type, and

must have an explicit type. [HN]

HN=1.0D0/N

--------^

fortcom: Error: test.f90, line 38: This name does not have a type, and

must have an explicit type. [NR]

DO 35 NR=1,N

--------------^

fortcom: Error: test.f90, line 38: An INTEGER or REAL data type is

required in this context. [NR]

DO 35 NR=1,N

--------------^

fortcom: Error: test.f90, line 39: This name does not have a type, and

must have an explicit type. [Z]

IF (NR.EQ.1) Z=HN

------------------------^

fortcom: Error: test.f90, line 41: This name does not have a type, and

must have an explicit type. [IT]

IT=0

-----------^

fortcom: Error: test.f90, line 43: This name does not have a type, and

must have an explicit type. [Z0]

Z0=Z

-----------^

fortcom: Error: test.f90, line 44: This name does not have a type, and

must have an explicit type. [P]

P=1.0D0

-----------^

fortcom: Error: test.f90, line 47: This name does not have a type, and

must have an explicit type. [F0]

F0=1.0D0

-----------^

fortcom: Error: test.f90, line 48: This name does not have a type, and

must have an explicit type. [F1]

F1=1.0D0-Z

-----------^

fortcom: Error: test.f90, line 49: This name does not have a type, and

must have an explicit type. [K]

DO 20 K=2,N

-----------------^

fortcom: Error: test.f90, line 49: An INTEGER or REAL data type is

required in this context. [K]

DO 20 K=2,N

-----------------^

fortcom: Error: test.f90, line 50: This name does not have a type, and

must have an explicit type. [PF]

PF=((2.0D0*K-1.0D0-Z)*F1-(K-1.0D0)*F0)/K

--------------^

fortcom: Error: test.f90, line 51: This name does not have a type, and

must have an explicit type. [PD]

PD=K/Z*(PF-F1)

--------------^

fortcom: Error: test.f90, line 54: This name does not have a type, and

must have an explicit type. [FD]

FD=PF/P

-----------^

fortcom: Error: test.f90, line 55: This name does not have a type, and

must have an explicit type. [Q]

Q=0.0D0

-----------^

fortcom: Error: test.f90, line 57: This name does not have a type, and

must have an explicit type. [WP]

WP=1.0D0

--------------^

fortcom: Error: test.f90, line 58: This name does not have a type, and

must have an explicit type. [J]

DO 25 J=1,NR-1

--------------------^

fortcom: Error: test.f90, line 58: An INTEGER or REAL data type is

required in this context. [J]

DO 25 J=1,NR-1

--------------------^

fortcom: Error: test.f90, line 64: This name does not have a type, and

must have an explicit type. [GD]

GD=(PD-Q*FD)/P

-----------^

fortcom: Warning: test.f90, line 66: This argument's data type is

incompatible with this intrinsic procedure; procedure assumed

EXTERNAL. [DABS]

IF (IT.LE.40.AND.DABS((Z-Z0)/Z).GT.1.0D-15) GO TO 10

---------------------------------------^

fortcom: Error: test.f90, line 66: This name does not have a type, and

must have an explicit type. [DABS]

IF (IT.LE.40.AND.DABS((Z-Z0)/Z).GT.1.0D-15) GO TO 10

----------------------------^

fortcom: Error: test.f90, line 70: A RETURN statement is invalid in

the main program.

RETURN

--------^

fortcom: Error: test.f90, line 83: This name does not have a type, and

must have an explicit type. [BESJ0]

func=(besj0(x)*besj1(x))/(x*2*exp(-x))

---------------^

fortcom: Error: test.f90, line 83: This name does not have a type, and

must have an explicit type. [BESJ1]

func=(besj0(x)*besj1(x))/(x*2*exp(-x))

------------------------^

compilation aborted for test.f90 (code 1)

Is there anyone can explain the reason for me?

Thanks in advance,

Fatemeh