      SUBROUTINE Y_READLUT(LUS,START,NSTEP,ISIGN,R,G,B)
C
C----------------------------------------------------------------------
C.IDENTIFICATION: Subroutine Y_READLUT
C.LIBRARY:        GRAPHSERV
C.AUTHOR:         L.Chiappetti - IFCTR Milano
C.VERSIONS:       0.0 - 25 Jun 93 - Prototype
C.                0.1 - 02 Jun 94 - added ISIGN argument
C.                0.1a- 19 Jul 94 - using stream I/O (ddf)
C.                0.2 - 17 Aug 94 - officialized + common clientside.inc
C.                0.3 - 22 Aug 94 - VMS prefers (*) in dimensions
C.PURPOSE:        send opcode to read image LUT      
C.SYNTAX:         CALL Y_READLUT(LUS,START,NSTEP,R,G,B)
C.PARAMETERS:     INTEGER start    the start location of the LUT
C                 INTEGER nstep    number of locations (to be) returned
C                 INTEGER isign    +1 or -1 for relative or absolute locations
C                 REAL    r,g,b    red green and blue values (0-1)  
C----------------------------------------------------------------------
C                                                
      INTEGER LUS(2),ISIGN
      INTEGER IERR,START,NSTEP,IS,INS,NBYTES,i
C0.2  REAL R(NSTEP),G(NSTEP),B(NSTEP)
      REAL R(*    ),G(*    ),B(*    )
      INCLUDE 'clientside.inc'
      OPCODE=13
*     WRITE(LUS(1),IOSTAT=IERR)OPCODE,START,ISIGN*NSTEP
      IBUF(2)=START
      IBUF(3)=ISIGN*NSTEP
      CALL Z_WRITE_STREAM(LUS(1),IBUF,12)
*     READ(LUS(2),IOSTAT=IERR)IS,INS,R,G,B
*0.1a CALL Z_READ_STREAM(LUS(2),IBUF,8)
*0.1a IS=IBUF(1)
*0.1a INS=IBUF(2)
*0.1a NBYTES=NSTEP*4
*0.1a CALL Z_READ_STREAM(LUS(2),R,NBYTES)
*0.1a CALL Z_READ_STREAM(LUS(2),G,NBYTES)
*0.1a CALL Z_READ_STREAM(LUS(2),B,NBYTES)
      NBYTES=NSTEP*3*4+8
      CALL Z_READ_STREAM(LUS(2),IBUF,NBYTES)
      IS=IBUF(1)
      INS=IBUF(2)
C-->  shall this loop go to NSTEP or INS steps ?
      DO 1 I=1,NSTEP
      R(i)=RBUF(2+i)
      G(i)=RBUF(2+i+NSTEP)
      B(i)=RBUF(2+i+NSTEP*2)
 1    CONTINUE
C-->  return the actual number or locations ? or not ?
*     WRITE(*,*)' RETURNED START STEP ',IS,INS  
      NSTEP=INS
      RETURN
      END
