      SUBROUTINE WHENEQI(N,IARRAY,INC,ITARGET,INDEX,NVAL)
C
C     * F. MAJAESS APR 26/96.
C     * SIMILAR TO WHENEQ EXCEPT IT IS USED ON INTEGER ARRAYS.
C     * FORTRAN EQUIVALENT OF INTRINSIC CRAY SUBROUTINE.
C     * SEARCHES ARRAY "IARRAY" FOR VALUE "ITARGET" AND
C     * STORES ALL INDICES OF "IARRAY" CONTAINING THIS
C     * ITARGET VALUE IN THE ARRAY "INDEX". 
C
C     * DESCRIPTION OF PARAMETERS:
C
C     * N       NUMBER OF ELEMENTS TO BE SEARCHED.
C     * IARRAY  FIRST ELEMENT OF THE INTEGER ARRAY TO BE SEARCHED.
C     * INC     SKIP DISTANCE BETWEEN ELEMENTS OF THE SEARCHED ARRAY.
C     * ITARGET INTEGER VALUE SEARCHED FOR IN THE ARRAY.
C     * INDEX   INTEGER ARRAY CONTAINING THE INDEX OF THE FOUND ITARGET
C     *         IN THE ARRAY.
C     * NVAL    NUMBER OF VALUES PUT IN THE INDEX ARRAY.
C
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      INTEGER IARRAY(N),INDEX(N)
C ----------------------------------------------------------------------
      IF(INC.LE.0)  CALL XIT('WHENEQI',-1) 
      NVAL=0
      DO 100 I=1,N,INC
        IF(IARRAY(I).EQ.ITARGET)                    THEN
           NVAL=NVAL+1
           INDEX(NVAL)=I
        ENDIF
 100  CONTINUE
      RETURN
      END
