I have a fortran code which works good in Windows XP environment and new we migrated the code to intel visual fortran.
After migrating we have compiled using intel visual fortran and there was no error but we get a run time error while reading the file content.
the error code is severe (64): input conversion error.
We are getting exception when the read statement is exeuted.. but the same code works well in window XP Compaq visual fortran compiler..
The file content will look like as below,
As I am new to Fortran i couldnt resolve this issue.. can any one please help in.. this is a critical issue we are facing..
You are using a formatted direct-access file, why? By the looks of what you posted, it could simply be read as an ordinary text file, which will offer much less potential for this type of errors. The problem is that direct-access files have a fixed record length. In this case 8 units. The relevant unit is often a byte, but in the case of Intel Fortran it is a word (4 bytes). So what your program is reading is a lot more than eight bytes.
That way you will read a single value from a line, which may have zero or more spaces in front of it. This is called list-directed input and while it may occasionally cause unexpected input actions (the rules are somewhat involved), it may give you a better chance to read the file using CVF or IVF or any other compiler.
Thanks Markus for the reply..
In READ(4,200,rec=IPOS)IRATE, the IPOS is the line number of the file in that case how do i rewrite this line.
If you require reading from arbitrary positions, then you are stuck with direct-access. That is unfortunate. It also means you must be very careful to ensure the lines are always 8 characters long, that is: including the carriage-return new-line characters (if I am not mistaken).
If you read the file sequentially, i.e. IPOS increases by one after each read, then you need to do nothing.\
Should you be stuck with _formatted_ direct-access, then use the use the appropriate compiler option - /assume:byterecl. That turns the unit into bytes instead of words.