The I/O system of Fortran is relatively powerful, flexible, and well-defined. Programs can be portable and device-independent even if they make extensive use of input/output facilities: this is difficult if not impossible in many other high-level languages. The effects of the hardware and operating system cannot, of course, be ignored entirely but they usually only affect fairly minor matters such as the forms of file-name and the maximum record length that can be used.
The READ and WRITE statements are most common and generally look like this:
READ(UNIT=*, FMT=*) NUMBER WRITE(UNIT=13, ERR=999) NUMBER, ARRAY(1), ARRAY(N)The pair of parentheses after the word READ or WRITE encloses the control-list: a list of items which specifies where and how the data transfer takes place. The items in this list are usually specified with keywords. The list of data items to be read or written follow the control-list.
Other input/output statements have a similar form except that they only have a control-list. There are the file-handling statements OPEN, CLOSE, and INQUIRE, as well as the REWIND and BACKSPACE statements which alter the currently active position within a file.
Before covering the these statements in detail, it is necessary to explain some of the concepts and terminology involved.