*
* $Id$
*
* $Log$
* Revision 1.1  1996/03/08 12:01:13  mclareni
* Initial revision
*
*
#include "zbook/pilot.h"
      SUBROUTINE ZEXAM4
C
C   EXAMPLE  4:  - INITIALISATION OF A DYNAMIC STRUCTURE
C                - CREATION OF A TREE STRUCTURE:
C                  2 DATA BANKS LINKED TO A MOTHER BANK.
C                  THE MOTHER BANK CONTAINS LINKS AND DATA.
C
      COMMON/ZCOMM/Z(1),ID1,ID2,ID3,WS(1)
      DIMENSION IZ(1000),IWS(1)
      EQUIVALENCE (IZ(1),Z(1)), (IWS(1),WS(1))
C
C   INITIALISATION
C
      CALL ZINIT (Z,WS,1000)
C
C   CREATION OF THE MOTHER BANK
C
      NDATA     = 5
      NLINKS = 2
C
      CALL ZBOOKN (Z,ID2,NDATA,NLINKS,'ZEX4',1)
      IF (ID2.EQ.0)                              GO TO 999
C
C   FILL MOTHER BANK
C
      DO  10 I = 1,NDATA
   10 IZ(ID2 + I) = I
C
C   CREATION OF THE OTHER BANKS (THE BRANCHES OF THE TREE)
C
      CALL ZBOOKN (Z,IZ(ID2-1),NDATA,0,'ZEX4',11)
      CALL ZBOOKN (Z,IZ(ID2-2),NDATA,0,'ZEX4',12)
C
      J1     = IZ(ID2 - 1)
      J2     = IZ(ID2 - 2)
      IF (J1.EQ.0.OR.J2.EQ.0)                    GO TO 999
C
      CALL VFILL (Z(J1+1),NDATA,5.)
      CALL VFILL (Z(J2+1),NDATA,6.)
C
      CALL ZPRINT (Z,ID2,12HMOTHER BANK$,1HF,0,0)
      CALL ZPRINT (Z,J1,9HBRANCH 1$,1HF,0,0)
      CALL ZPRINT (Z,J2,9HBRANCH 2$,1HF,0,0)
C
  999 RETURN
      END
