next up previous contents index
Next: Unit Identifier Up: Input/Output Facilities Previous: INQUIRE Statement

READ and WRITE Statements

   

The READ statement reads information from one or more records on a file into a list of variables, array elements, etc. The WRITE statement writes information from a list of items which may include variables, arrays, and expressions and produces one or more records on a file. Each READ or WRITE statement can only transfer one record on an unformatted file but on formatted files, including internal files, more than one record may be transferred, depending on the contents of the format specification.

The two statements have the same general form:
READ( control-list ) data-list
WRITE( control-list ) data-list
The control-list must contain a unit identifier; the other items may be optional depending on the type of file. The data-list is also optional: if it is absent the statement transfers one record (or possibly more under the control of a format specification).



 

Helen Rowlands
8/27/1998