*
* $Id$
*
* $Log$
* Revision 1.1  1996/03/08 15:21:42  mclareni
* Initial revision
*
*
#include "epio/pilot.h"
      SUBROUTINE EPCLOS(LUNIT,IBUF,IERR)
C. ROUTINE TO CLOSE OUTPUT UNITS (WRITE EXISTING PHYSICAL
C. BUFFER OUT - WRITING MAY CONTINUE AFTERWARDS).
C. CLOSING AN INPUT UNIT HAS NO EFFECT.
C.
C. +++  MANDATORY AT END OF JOB FOR ALL OUTPUT UNITS +++
C. +++  OR A CALL TO EPEND  (EOF IN ADDITION)        +++
C.
C.
C. INPUT:
C.
C. LUNIT    LOGICAL UNIT NUMBER
C.
C. INPUT/OUTPUT:
C.
C. IBUF     USER PROVIDED UNIT BUFFER. MUST NOT BE TOUCHED BY USER.
C.
C. OUTPUT:
C.
C. IERR     ERROR FLAG. SEE SEPARATE LIST.
C.
#include "epio/epiocom.inc"
      DIMENSION IBUF(1)
      IERR = 0
C--- GET UNIT NUMBER
      IF(LUNIT.NE.LASTUT)  CALL EPUREF(LUNIT)
      IF(LREF.EQ.0)  GOTO 9901
C--- START-1 OF CONTROL WORDS
      IF(LIST(ISTART+14).EQ.0.OR.LIST(ISTART+16).NE.1)  GOTO 77777
      CALL EPBOUT(IBUF,IERR)
77777 RETURN
 9901 CONTINUE
C--- UNIT DOES NOT EXIST
      IERR=14
      CALL EPERRH(LUNIT,IERR)
      GOTO 77777
      END
