C   07/06/96 606071850  MEMBER NAME  IBN      (S4)          FORTG1
      FUNCTION IBN(X,XA,DX,NB)
C     PURPOSE
C        OBTAIN INDEX FROM X IN A EQUIDISTANT SCALE WITH
C        XA = LOWEST CHANNEL LEFT EDGE
C        DX = BIN WIDTH
C        NB = MAX NR OF BINS
C
C     USAGE
C        INDEX=IBN(X,XA,DX,NB)
C
C     REMARK
C        INDEX = 0     FOR X LT XA
C              = NB+1  FOR X GE XA+NB*DX
C
      N=(X-XA)/DX+1.0
      N=MAX0(0,N)
      IBN=MIN0(N,NB+1)
      RETURN
      END
