PDA

View Full Version : what does this mean?


cnma
10-06-2003, 04:28 AM
i'm new in fortran language...i would like to know what this line means :

read(20, 1511) NATT, IREL

as far as i know, this line means that we read from something, e.g: a file...but the program that i compiled had an error at this line...but i don't know how to fix it...

i hope everybody understand my question...

tzeis
10-06-2003, 06:14 PM
The line in question will cause data to be read from (most likely) a disk file. The part in parentheses indicates where and how the data should be read. The number "20" indicates that the data should be read from unit number 20. This implies that somewhere in your code, you have an open statement that opens unit number 20. The number "1511" refers to a format statement at line number 1511. If you are receiving a compile time error, it is most likely because this line number does not exist. If the error is occurring at runtime, there could be a variety of reasons, and I would need to see the error message. The last part of the statement are the data items for which values will be read.

cnma
10-07-2003, 03:03 AM
thank you for your answer..

1) does this mean that it must have an open statement in my coding?

2) may i know what is the meaning of this: ENDFILE(31)

thank you again.

tzeis
10-07-2003, 05:42 PM
Some compilers use default filenames if a file unit was not opened with an OPEN statement. For unit 20, our compiler would use a name like "fort.20". So an open statement is not absolutely necessary, but I would expect that you should have one.
The ENDFILE statement is writing an end of file record to the file connected on unit 31.
For basic descriptions of particular language statements, you should refer to the Language reference.