      PROGRAM TEMVOL
************************************************************************
* Program to read temperatures and volumes from two different files    *
* containing time, temperature, pressure, and volume readings made by  *
* some monitoring device and display the temperature and volume        *
* measurements in tabular form.  Format specifiers for these files     *
* are entered during execution.  Variables used are:                   *
*     FNAME   : name of data file                                      *
*     EOF     : end-of-file indicator                                  *
*     FORM    : input format specifier                                 *
*     TEMP    : temperature recorded                                   *
*     VOLUME  : volume recorded                                        *
*                                                                      *
* Input (files):    Collection of temperature and volume readings      *
* Input (keyboard): Format specifiers                                  *
* Output (screen):  Table of readings                                  *
************************************************************************

      CHARACTER*50 FORM, FNAME*20
      INTEGER EOF
      REAL TEMP, VOLUME

* Open the file as unit 15, read the input format,
* and print the table heading.

      PRINT *, 'ENTER NAME OF DATA FILE:'
      READ '(A)', FNAME
      OPEN (UNIT = 15, FILE = FNAME, STATUS = 'OLD')
      PRINT*, 'ENTER INPUT FORMAT FOR ', FNAME
      READ '(A)', FORM
110   FORMAT(1X, A11, A10)
120   FORMAT(1X, F8.1, F12.1)
      PRINT *
      PRINT 110, 'TEMPERATURE', 'VOLUME'
      PRINT 110, '===========', '======'
     
* While there is more data, read temperatures and volumes,
* displaying each in the table.

      READ (UNIT = 15, FMT = FORM, IOSTAT = EOF) TEMP, VOLUME
10    IF (EOF .GE. 0) THEN
          PRINT 120, TEMP, VOLUME
          READ (UNIT = 15, FMT = FORM, IOSTAT = EOF) TEMP, VOLUME
      GO TO 10
      END IF

      CLOSE (15)
      END

