      SUBROUTINE SETARY(LAG,MEND1,NEND1,JEND1)
      INTEGER*4 LAG(MEND1,NEND1)
C
      L=0
      DO 100 N=1,NEND1
       MMAX=MIN(MEND1,JEND1+1-N)
      DO 100 M=1,MMAX
       L=L+1
       LAG(M,N)=L
  100 CONTINUE
C
      RETURN
      END SUBROUTINE SETARY

