Does anyone know much about nonadvancing I/O? I am trying to read an input record without knowing how many values are on the line beforehand. It seems to me that this should work similar to an END= statement when reaching the end of a file.
However, when I implement a read statement with ADVANCE="NO" and using an implied DO loop where the ending loop counter is > the number of inputs for a record, no transfer occurs to a statement label when reaching the end of record. Additionally, all the values in the array from 1 to the ending value of the DO loop counter have taken on values. In other words, I am looping from 1 to 9, but there are only 3 values of 12 in the record. After executing the statement in the debugger, the array has 12 assigned to the first 9 values rather than just the first 3 and the error condition is never met. Here is the code:
The documentation is minimal at best in the help system and refers me to the programmer's guide for more information. Any help would be appreciated.
Tom
However, when I implement a read statement with ADVANCE="NO" and using an implied DO loop where the ending loop counter is > the number of inputs for a record, no transfer occurs to a statement label when reaching the end of record. Additionally, all the values in the array from 1 to the ending value of the DO loop counter have taken on values. In other words, I am looping from 1 to 9, but there are only 3 values of 12 in the record. After executing the statement in the debugger, the array has 12 assigned to the first 9 values rather than just the first 3 and the error condition is never met. Here is the code:
JS = 1 JE = 9 DO WHILE (.TRUE.) READ (CON,'(8X,9I8)',ADVANCE="NO",EOR=1) (NPPP(J),J=JS,JE JS = JS+9 JE = JE+9 END DO 1 CONTINUE
The documentation is minimal at best in the help system and refers me to the programmer's guide for more information. Any help would be appreciated.
Tom
链接已复制
4 回复数
I tried reproducing this with a program based on your code fragment, but couldn't. It seemed to work as you expect. How about posting a small but complete program and a sample data file. You may want to change the format so it doesn't need quite so much room.
Steve
Steve
Steve,
Somehow my post for answering the problem didn't get posted. It was pilot error - I made changes to the input file but didn't save them before I ran the code. It works as advertised - sorry to have wasted your time.
Tom
Somehow my post for answering the problem didn't get posted. It was pilot error - I made changes to the input file but didn't save them before I ran the code. It works as advertised - sorry to have wasted your time.
Tom
