      SUBROUTINE Y_OPENPLOT(LUS,CODE,N)
C
C----------------------------------------------------------------------
C
C.IDENTIFICATION: Subroutine Y_OPENPLOT
C.LIBRARY:        GRAPHSERV
C.AUTHOR:         L.Chiappetti - IFCTR Milano
C.VERSIONS:       0.0 - 25 Jun 93 - Prototype
C.PURPOSE:        Initialize connection with a graphics server
C.METHOD:         calls ZX_GET_PARAMETER and uses global variables
C.SYNTAX:         CALL Y_OPENPLOT(lus,code,n)
C.PARAMETERS:     INTEGER   lus(2)   a couple of logical units
C                 CHARACTER code*2   the type of server wished
C                 INTEGER   n        (1-9) the n-th instance of server
C.RESTRICTIONS:
C.NOTES:          provisional error handling (none)
C
C     Attention: all other routines in this library have an
C     abbreviated documentation header .....
C
C.FILES:          
C.REFERENCES      CONNECTSERVER (so far in pipelib)
C
C----------------------------------------------------------------------
C
      INTEGER I,IERR,N,LUS(2)
      CHARACTER SERVER*3,CODE*2,CCODE*2
C
      CCODE=CODE
      I=N
C
C     in case no server is defined take "default plotter"
C
      IF(CCODE.EQ.'  ')THEN
         CALL GET_GLOBAL_DEFAULT('PLOTTER','xw1',SERVER)
         READ(SERVER,1,IOSTAT=IERR)CCODE,I
 1       FORMAT(A2,I1)
      ENDIF
C-->  must also set_global plotter to the new server for future clients ?
      CALL LOWCASE(CCODE)
C
C     open the two logical units needed for the communication
C
      CALL CONNECTSERVER(CCODE,I,LUS(1),LUS(2),IERR)
C-->  provisionally crash on error
      IF(IERR.NE.0)CALL Z_EXIT(1)               
      write (*,*)' connection to server established'
      RETURN
      END
