Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

EOF handling in IVF vs. DVF

salbruce
Beginner
853 Views
I recently converted from DVF to IVF and have had few problems, but here is one that has come up.

I'm reading a series of 8-byte strings from a text file, one string per line in the file. The list ends with an EOF mark (character 26). For example, consider the input file:

XXXXXXXX
[EOF]

In DVF the following code gives i=1, but in recompiling in IVF I get i=2 and ALIST(2) gets the EOF mark. Is there a compiler switch that will make IVF behave like DVF in this regard?

CHARACTER*8 ALIST(N) ! N is passed from calling routine
I=0
1 DO WHILE (I.LE.N-1)
READ (14,'(A8)',END=2,ERR=3) ALIST(I+1)
I=I+1
END DO

Thanks in advance.
0 Kudos
1 Solution
Steven_L_Intel1
Employee
853 Views
Ok, I understand now. Yes, that's an ENDFILE record in there and I can see a difference from CVF. You can get the behavior you want by adding the /vms switch, though this should not, I think, be required. I'll let the developers know about this.

View solution in original post

0 Kudos
4 Replies
Steven_L_Intel1
Employee
853 Views

I can think of at least two different things that may be at work here, but without a full test case I'm not sure what it might be. You also don't say which "DVF" you're using.

First, early versions of DVF did not properly handle data files where the last record didn't end in a newline. That was fixed at some point fairly early in the product. Second, and I don't remember when this change was made, an end-of-file condition is not supposed to trigger an ERR= branch, though since you also have END= that may not matter.

Can you show a small but complete program that illustrates the problem?

There is no compiler switch controlling this behavior.
0 Kudos
salbruce
Beginner
853 Views
Here is a small complete example (attached, and reproduced below), along with an example input file.
I was previously using DVF6.
Thanks.

I can think of at least two different things that may be at work here, but without a full test case I'm not sure what it might be. You also don't say which "DVF" you're using.

First, early versions of DVF did not properly handle data files where the last record didn't end in a newline. That was fixed at some point fairly early in the product. Second, and I don't remember when this change was made, an end-of-file condition is not supposed to trigger an ERR= branch, though since you also have END= that may not matter.

Can you show a small but complete program that illustrates the problem?

There is no compiler switch controlling this behavior.

0 Kudos
Steven_L_Intel1
Employee
854 Views
Ok, I understand now. Yes, that's an ENDFILE record in there and I can see a difference from CVF. You can get the behavior you want by adding the /vms switch, though this should not, I think, be required. I'll let the developers know about this.
0 Kudos
Steven_L_Intel1
Employee
853 Views
This will be fixed in the next major release, due out late this year.
0 Kudos
Reply