Fortran language compiled in vs, matrix or array (GB, JB, etc.) shows' Unspecified error occurred 'in local variables windowFortran language compiled in vs, matrix or array (GB, JB, etc.) shows' Unspecified error occurred 'in local variables windowFortran

DIMENSION GB1(2,2),GB2(2,2),JB(2,10),GB(2,2),
$ GE1(10,2),GE2(10,2),JE(10,10),GE(2,2),XB(2)
common /INV/GBx(70,70),GBy(70,70),GBai(70,70)
common /MATRIX/A(100,100),B(100,100),AA(100,100)
DOUBLE PRECISION GBX,GBY,GBAI,GB1,GB2,GB,GE1,GE2,GE,JE,A,B,AA
C
CHARACTER RI12,R1,ZZI10,ZZO10
REAL L
C
WRITE(,‘(1X,’‘Input the name of input file :’‘)’)
READ(
,‘(A)’)ZZI
OPEN(1,FILE=ZZI,STATUS=‘OLD’)
WRITE(,‘(1X,’‘Input the name of output file :’‘)’)
READ(
,‘(A)’)ZZO
OPEN(2,FILE=ZZO,STATUS=‘NEW’)
C * * * * * * * (ARES=mm2,rp=Kg/dm3,E=GPa(N/mm**2),L=mm) * * * * * * * *
READ(1,) ARES,RP,E,L
READ(1,
) NN
rp=rp1.E+3
ares=ares
1.E-6
E=E1.E+6JB
L=L
1.E-3
c
c * * * * * * * * U2=1,U8=2,F2=3,F8=4 * * * * * * * * *
c * * * * * * * K1 & K2 are the reserved variables * * * * * * * *
c
read(1,)k1,k2
C
GB1(1,1)=-0.5
GB1(1,2)=0.5
GB1(2,1)=0.5
GB1(2,2)=-0.5
C
GB2(1,1)=0.
GB2(1,2)=-0.5
L/(ARESE)
GB2(2,1)=-0.5
L/(ARESE)
GB2(2,2)=0.
C
DX=L/NN
X=0
DO 10 I=1,NN
X=X+DX
JB(1,I)=-RP
DX0.5X/E
JB(2,I)=-RPDX0.5*(L-X)/E
GE1(I,1)=0.5
GE1(I,2)=0.5
GE2(I,1)=0.5X/(ARESE)
GE2(I,2)=-0.5ABS(L-X)/(ARESE)
X2=X
X1=0.
DO 20 J=1,NN
X1=X1+DX
JE(I,J)=-0.5*ABS(X1-X2)RPDX/E
20 CONTINUE
10 CONTINUE

Welcome to the forum!

I guess your question is hidden in the title, as the message itself only contains source code (and not formatted at that - please use the </> button so that code gets properly treated). But the implicit question is not enough to help you. The code is merely a fragment, it seems, and it is not even proper FORTRAN or Fortran. You will have to explain what you are doing and what is going wrong, before we can even begin to understand what the problem is, I am afraid.

I changed the comment lines to ! (thus changing to free-form source), made up some random input, and the program compiled and ran with no problem.

Mike

which suggests, along with the error message, that the fixed-format code is being compiled as free format? Perhaps the code is contained in a *.f90 file instead of a *.f file?

My conclusion that is not correct FORTRAN was based on READ statements without a format for instance, but that seems to be due to the asterisk being taken for a formatting character for the message text. Another argument for using the </> button to present code ;). Looking back I see the italics now.

$DEBUG
C	MAIN PROGRAMME 03-05-25 am
	DIMENSION H(10,10),U(10),A(10,10),T(10,10)
	CHARACTER ZZI*10,ZZO*10
C
	WRITE(*,'(1X,''Input the name of input file :'')')	
	READ(*,'(A)')ZZI
	OPEN(1,FILE=ZZI,STATUS='OLD')
	WRITE(*,'(1X,''Input the name of output file :'')')
	READ(*,'(A)')ZZO	  
	OPEN(2,FILE=ZZO,STATUS='NEW')
c
C	* * * * * * * * * * * * * * *
c
	READ(1,*) N
	DO 100 I=1,N
100	READ(1,*) (H(I,J),J=1,N)
C
C	* * * * * * * * * * * * * * * * * * * * * * * * *
C
	DO 10 K=1,N-2
	  M=K+1
	  b=0
	  DO 20 I=M,N
20	  b=b+H(I,K)*H(I,K)
	  S=SQRT(B)
	  write(2,*)'s=',s
C	  	  
	  IF(ABS(H(M,K)+S).GE.ABS(H(M,K)-S)) THEN
	    U(M)=H(M,K)+S
	    D=S*S+H(M,K)*S
	  ELSE
	    U(M)=H(M,K)-S
	    D=S*S-H(M,K)*S
	  END IF
C
	  DO 30 I=M+1,N
30	  U(I)=H(I,K)	
	write(2,*)'u='
	write(2,*)(u(jj),jj=1,n)
  
	  DO 40 L=M,N
	    T(K,L)=0
	    T(L,K)=0
	    T(K,K)=1
40	  CONTINUE
C
	  DO 50 I=M,N
	    DO 50 J=M,N
	    IF(I.EQ.J) THEN
	      E=1
	    ELSE
	      E=0
	    END IF
	    T(I,J)=E-U(I)*U(J)/D
50	  CONTINUE
	write(2,*)'t='
	do 101 ii=1,n
101	write(2,*)(t(ii,jj),jj=1,n)
	write(2,*)	

C	* * * * * * * * * * * * * * * *
c	  CALL AB(T,H,A,N)
	DO 1000 ii=1,N
	DO 1000 jj=1,N
	  A(II,JJ)=0.
	  DO 2000 KK=1,N
2000	  A(II,JJ)=A(II,JJ)+T(II,KK)*H(KK,JJ)
1000	CONTINUE      




	write(2,*)'t*h='
	DO 201 Ij=1,N
201	WRITE(2,'(1X,10F12.8)')(a(Ij,Jj),Jj=1,N)


C	  CALL AB(A,T,H,N)

	DO 3000 II=1,N
	DO 3000 JJ=1,N
	  H(II,JJ)=0.
	  DO 4000 KK=1,N
4000	  H(II,JJ)=H(II,JJ)+A(II,KK)*T(KK,JJ)
3000	CONTINUE      

	write(2,*)'H='
	do 102 ii=1,n
102	write(2,*)(h(ii,jj),jj=1,n)


10	CONTINUE
C
	DO 200 I=1,N
200	WRITE(2,'(1X,10F12.8)')(H(I,J),J=1,N)
	END
C
C	* * * * * * * * P*Q=R * * * * * * * *
C
	subroutine AB(P,Q,R,N)
	DIMENSION P(10,10),Q(10,10),R(10,10)

	write(2,*)'p='	
	do 102 ii=1,n
102	write(2,*)(p(ii,jj),jj=1,n)
	write(2,*)'q='	
	do 103 ii=1,n
103	write(2,*)(q(ii,jj),jj=1,n)
	write(2,*)'r='	
	do 104 ii=1,n
104	write(2,*)(r(ii,jj),jj=1,n)



	RETURN
	END

Hello, thank you very much for your help, for example, in this program, I defined a GB1 (2x2 matrix, but in the debugging process, the value of the local variable will show “unspecified error”), but the local variable and monitoring can not show the matrix.
AAA

It is unclear to me what software you are using, though I can make a guess. I would say that the problem you are showing is not within your program itself, but rather with the debugger. There can be many different causes for that, but you can also circumvent the proiblem: use the age-old technique of printing relevant variables at selected locations in the program.

If you want advise on the debugger, then please let us know:

  • What software you use for this (MS Visual Studio?)
  • What version of that software
  • What version of the Fortran compiler

To clarify: Visual Studio and Intel Fortran can cooperate, but only certain combinations of versions.