,      SUBROUTINE LIMIT (ITEST,LIM,IRESET,IR)EC_TITLE  LIMIT  Test  INTEGER*2 item against limits, optionally resetC_ARGUMENTS;	INTEGER*2 ITEST ! [I/O]  Item to be tested, possibly resetK	INTEGER*2 LIM(2)! [I]  Limit is  INTEGER*2 array (length 2) of (LIM1,LIM2)M	INTEGER IRESET  ! [I]  0=don't reset 1=Reset ITEST to limit (LIM1<LIM2 ONLY)*	INTEGER IR      ! [O]  IR is return code:4C    IF LIM1 < LIM2, -1 = LO, 0 = in-bounds, +1 = hiBC    IF LIM1 > LIM2, -1 = in-bounds, 0 = lo or hi (ext constraint)2C    In-bounds category is inclusive of end pointsGC_DESCRIPTION  The subroutine LIMIT will test an INTEGER*2 item against C limits, optionally reset them.DC_HISTORY  82April23  R.Mehlman   Temporary  FORTRAN IV plus versionC_END      LIM1=LIM(1)      LIM2=LIM(2)      KTEST=ITEST       IF (LIM1.GT.LIM2) GO TO 50C-----INTERNAL CONSTRAINT!      IF (KTEST.GE.LIM1) GO TO 10      KSAVE=LIM1      IR=-1      GO TO 30! 10   IF (KTEST.LE.LIM2) GO TO 20      KSAVE=LIM2
      IR=1      GO TO 30
 20   IR=0. 30   IF (IRESET.NE.0.AND.IR.NE.0) ITEST=KSAVE      RETURN$C-----EXTERNAL CONSTRAINT (NO RESET)3 50   IF (KTEST.GE.LIM2.AND.KTEST.LE.LIM1) GO TO 60
      IR=0      RETURN 60   IR=-1      RETURN	      END