- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
Code is
OPEN(4,file='C:\APPDATA\PCALC\test1',status='OLD',
& access='DIRECT',form='FORMATTED',recl=8,err=998)
READ(4,200,rec=IPOS)IRATE
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,
131072
35
35
36
36
37
37
38
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..
Thanks
Shrinivassan
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
Try:
OPEN(4,file='C:\APPDATA\PCALC\test1',status='OLD', err=998)
READ(4,*)IRATE
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
Thanks
Shrinivassan
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The default, when you don't set byterecl, is intended to be compatible with CVF.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
How is it possible to discuss an "input conversion error" without having a look to the 200 FORMAT statement ?
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The 200 is,
200 FORMAT(I8)

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora