Software Archive
Read-only legacy content
17061 Discussions

nonadvancing I/O

Intel_C_Intel
Employee
884 Views
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:

  
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

0 Kudos
4 Replies
Intel_C_Intel
Employee
884 Views
What the blue blazes happened to my post? The subject line somehow took on what I wrote for my entire post.

Tom
0 Kudos
Steven_L_Intel1
Employee
884 Views
You used " and > in the text - this confuses the forum software. Try to remember to use " and > instead. I edited the post.

Steve
0 Kudos
Steven_L_Intel1
Employee
884 Views
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
0 Kudos
Intel_C_Intel
Employee
884 Views
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
0 Kudos
Reply