| New Reply |
Error when reading list, Fortran 77 |
Share Thread |
| Jun21-12, 06:44 AM | #1 |
|
|
Error when reading list, Fortran 77
Hello,
I'm trying to run a simulation program, written in Fortran 77 for the g77 compiler ( I use gcc version 3.4.6). I get the following error message when running the program: invalid number: incomprehensible list input apparent state: unit 3 named combin.fig last format: list io lately reading sequential formatted external IO Aborted The error is for the following READ statement: Code:
READ(3,*) ((XPOS(J,IL),YPOS(J,IL),J=1,NABUR(IL)),IL=1,NL) -1, 0.625, 2, 0.625, 0, 1.625, 1, 1.625, -1, -0.375, 0, -0.375, 1, -0.375, 2, -0.375 -1, 0.375, 2, 0.375, 0, -0.625, 1, -0.625, -1, 1.375, 0, 1.375, 1, 1.375, 2, 1.375 Maybe I should also give you the values of the variables: NABUR = 8 8 0 0 NL = 2 I'm not very experienced in Fortran (or programming) so please keep it simple. My OS is 64-bit Ubuntu 11.10 Oneric, but I compile in a chroot (32-bit Ubuntu 10.04 Natty) because the program doesn't compile in a 64-bit OS. Normally I can run the program in both systems. Thanks |
| Jun21-12, 07:51 PM | #2 |
Recognitions:
|
Assuming XPOS and YPOS are real (or double precision) variables, I can't see anything wrong here.
This type of error message almost always means what it says. So if the data that you SHOULD be reading here is in the correct format (which it seems to be), that leaves the possibility that you are actually reading a different part of the file which really IS in the wrong format. That would mean the error happened earlier, when some other part of the program read either too much or too little data. I would work backwards. Start by printing out the data that was read by the READ statement before this one, and check if it is right. If it's wrong, keep working backwards till you find the problem. |
| Jun21-12, 08:28 PM | #3 |
|
|
yeah, that part is fine. I checked reading that data with this program:
Code:
program impdo integer i,j,nabur(4) real x(8,4),y(8,4) data nabur/8, 8, 0, 0/ read(*,*) ((x(i,j),y(i,j),i=1,nabur(j)), j=1,4) write(*,'(8(1x,f6.3))') ((x(i,j), y(i,j), i=1,nabur(j)), j=1,4) end Try reading and writing back out as soon as you read something to confirm what you are reading...you will realize immediately where your problem is. There is a trick, though. Fortran will not write out whenever you ask with a simple write...it will do it when there is enough data in the queue...but it may never get there if it fails before then...to force a write, follow it with a flush. |
| New Reply |
Similar discussions for: Error when reading list, Fortran 77
|
||||
| Thread | Forum | Replies | ||
| Summer reading list | Academic Guidance | 2 | ||
| Fortran 77 help making an empty array (or blank list if they exist in fortran) | Programming & Comp Sci | 5 | ||
| Reading list for self study in QM+QFT-> Beyond SM | Science Textbook Discussion | 0 | ||
| NOW I have a reading list... | General Math | 2 | ||
| reading list for someone out of high school | Academic Guidance | 4 | ||