*
* $Id$
*
* $Log$
* Revision 1.1  1996/03/08 12:01:13  mclareni
* Initial revision
*
*
#include "zbook/pilot.h"
      SUBROUTINE ZEPEX1
C
C    EXAMPLE 10:  - USAGE OF ZEPOUT TO WRITE BANKS IN MACHINE
C                   INDEPENDENT FORMAT
C
      COMMON/ZEPCMM/Z(1),ID1,ID2(3),ID3,WS(1)
      DIMENSION IZ(10000),IWS(1)
      EQUIVALENCE (IZ(1),Z(1)), (IWS(1),WS(1))
C
      DIMENSION KEYO(3)
C
      DATA KEYO,LUNO,LREC/1000, 2000, 3000,    2,    0/
C
      CALL ZINIT (IZ,WS,10000)
C
      CALL ZEPKEY (IZ,ID1,1000,  1,11,IERR)
      CALL ZEPKEY (IZ,ID2,2000,  3,12,IERR)
      CALL ZEPKEY (IZ,ID3,3000,  1,13,IERR)
C
      CALL ZEPDEF (IZ,LUNO,LREC,IERR)
      IF (IERR.NE.0)                             GO TO 999
C
C    LOOP ON EVENTS
C
      DO  30 IEVENT = 1,5
C
      CALL ZBOOKN (IZ,ID1,10,0,3HID1,1)
      CALL ZBOOKN (IZ,ID3,10,1,3HID3,1)
      CALL ZBOOKN (IZ,IZ(ID3-1),7,0,3HID3,11)
C
      DO  10 I = 1,3
   10 CALL ZBOOKN (IZ,ID2(I),10,0,3HID2,I)
C
      ID31   = IZ(ID3 - 1)
      CALL VFILL (IZ(ID1+1),10,-17+IEVENT)
      CALL VFILL (IZ(ID3+1),10,-57.)
      CALL VFILL (IZ(ID31+1),7,99.)
C
      DO  20 I = 1,3
      ID2I   = ID2(I)
   20 CALL VFILL (IZ(ID2I+1),10,-200000-IEVENT)
C
      CALL ZEPOUT (IZ,LUNO,KEYO(1),1,1,IERR)
      CALL ZEPOUT (IZ,LUNO,KEYO(2),1,2,IERR)
      CALL ZEPOUT (IZ,LUNO,KEYO(3),1,3,IERR)
      CALL ZEPOUT (IZ,LUNO,KEYO(1),3,123,IERR)
C
   30 CALL ZAGAIN (IZ,ID1)
C
      CALL ZEPEND(IZ,0,IERR)
C
  999 RETURN
      END
