View previous topic :: View next topic |
Author |
Message |
alangr
Joined: 24 Oct 2016 Posts: 47 Location: Oxford,UK and Athens, Greece
|
Posted: Wed Dec 13, 2023 9:10 am Post subject: non-writable expression |
|
|
I have a problem with the following:
0095) 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? _________________ Alan |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Wed Dec 13, 2023 10:18 am Post subject: |
|
|
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? |
|
Back to top |
|
|
alangr
Joined: 24 Oct 2016 Posts: 47 Location: Oxford,UK and Athens, Greece
|
Posted: Wed Dec 13, 2023 10:33 am Post subject: |
|
|
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? _________________ Alan |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Wed Dec 13, 2023 11:20 am Post subject: |
|
|
Can you post a small program with all the necessary features to reproduce the error? |
|
Back to top |
|
|
alangr
Joined: 24 Oct 2016 Posts: 47 Location: Oxford,UK and Athens, Greece
|
Posted: Wed Dec 13, 2023 11:53 am Post subject: |
|
|
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. _________________ Alan |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Wed Dec 13, 2023 12:08 pm Post subject: |
|
|
Yes but the compiler does not know that VIEW is an array. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1897
|
Posted: Wed Dec 13, 2023 12:18 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
alangr
Joined: 24 Oct 2016 Posts: 47 Location: Oxford,UK and Athens, Greece
|
Posted: Wed Dec 13, 2023 1:11 pm Post subject: |
|
|
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. _________________ Alan |
|
Back to top |
|
|
|