Silverfrost Forums

Welcome to our forums

non-writable expression

13 Dec 2023 8:10 #30862

I have a problem with the following:

  1.   READ(5,500)  II, JJ, (VIEW(I, J, K),K=1,4)
    

*** Non-writable expression in READ statement *** Compilation abandoned

I can find no reference to explain the problem here. The odd thing is that this error has only now appeared having been no problem before. I wondered if I had amended a compiler option somehow but again could find nothing to explain what was happening and why and so found no help to resolve the code.

What is happening here? Any suggestions?

13 Dec 2023 9:18 #30863

This error report is produced by FTN95 when there is something wrong with one of the variables in the list.

How are II, JJ, and VIEW defined?

13 Dec 2023 9:33 #30864

The definitions are as below

  INTEGER IOS, I, J, II, JJ

  CHARACTER VIEW(20, 20, 4)*40

The latter is in a common block and the integers are local variables.

Thanks for your comments; does the above help?

13 Dec 2023 10:20 #30865

Can you post a small program with all the necessary features to reproduce the error?

13 Dec 2023 10:53 #30866

The first line of code in my initial post delivered the two lines of comment that followed.

I have even tried the following 'program' with no declarations at all

  READ(5,500)  (VIEW(I, J, K),K=1,4)
  • END
    

and get the same results.

I am using code which appeared to be compiled OK yesterday morning that suddenly flagged this error and would not compile (I have other similar cases). Could I have inadvertently changed something in the settings....?

Thank you for your help - I am at a loss to understand the error.

13 Dec 2023 11:08 #30867

Yes but the compiler does not know that VIEW is an array.

13 Dec 2023 11:18 #30869

My guess is that the character array VIEW, which is in a common block, is used in more than one subprogram, and one of those subprograms does not contain the COMMON declaration. Absent a type declaration for VIEW, the expression VIEW(I,J,K) would be regarded as a function invocation with arguments I, J, K.

13 Dec 2023 12:11 #30870

That's it.

In editing files yesterday I inadvertently removed the include file that held all the declarations and common statements - and, more importantly, the 'implicit none'. So compilation seemed OK.....

Thank you Paul for tour help and thank you mecej4 for the help with the common block.

I am most grateful for your help.

Please login to reply.