      PROGRAM DEMOS2
          IMPLICIT NONE
          INTEGER i, j, n, m, mexp, isuppz,
     *            lwork, lrwork, liwork, iwork, info
          REAL*8 w, work, rwork
          COMPLEX*16 a, z
          PARAMETER (n = 6)
          PARAMETER (mexp = 3)
          PARAMETER (lwork = 12, lrwork = 144, liwork = 60)
          DIMENSION a(n, n), z(n, mexp), w(n)
          DIMENSION isuppz(12)
          DIMENSION work(lwork), rwork(lrwork), iwork(liwork)
          DATA isuppz/111111, 222222, 333333, 444444, 555555, 666666,
     *                777777, 888888, 999999, 101010, 101101, 102102/
          DO i = 1, n
              DO j = 1, n
                  IF ( i .EQ. j ) THEN
                      a(i, j) = (1d0, 0d0)
                  ELSE
                      a(i, j) = (0d0, 0d0)
                  END IF
              END DO
          END DO
          CALL zheevr('V',                      ! jobz
     *                'I',                      ! range
     *                'L',                      ! uplo
     *                n, a,
     *                n,                        ! lda
     *                0d0,                      ! vl, not referenced
     *                1d0,                      ! vu, not referenced
     *                3, 5,                     ! il and iu
     *                0d0,                      ! abstol
     *                m, w, z,
     *                n,                        ! ldz
     *                isuppz,
     *                work, lwork, rwork, lrwork, iwork, liwork, info)
          PRINT*, "m:", m
          PRINT*, 'isuppz:'
          PRINT*, (isuppz(i), i = 1, 12)
      END PROGRAM
