      SUBROUTINE RESUTL(NRM,K2I,IZW,IZ,IDBG)
C 
C  RESET ENCLOSURE ARRAYS TO REDUCE STORAGE 
C 
C  INPUTS 
C    NRM  ZONE NO.
C    K2I  POSITION IN NENC(NRM,K2I) ARRAY 
C    IZW  OLD IZW 
C    IZ   NEW CONSOLIDATED IZW
C 
C  OUTPUTS
C    IZ   FEASIBLE IZ 
C 
C - - - CONSTANTS 
CMDK NWL
CMDK NWN
CMDK NWZN
CMDK NZN
CMDK NZW
C 
C - - - COMMON BLOCKS 
CMDK ENCBK1
CMDK ENCBLK
CMDK IZPART
CMDK IZZQ
CMDK SURFAR
CMDK WNDBLK
C 
    8 IF(IDBG.NE.0)WRITE(60,502)K2I,IZW,IZ 
      IF(IZW.LT.IZ)THEN 
          IF(IDBG.NE.0)WRITE(60,507)IZW,IZ 
          NENC(NRM,K2I)=IZW 
          IZ=IZ-1 
          GO TO 40
          ENDIF 
      IF(IZW.EQ.IZ)THEN 
          IF(IDBG.NE.0)WRITE(60,503)IZW
          NENC(NRM,K2I)=IZ
          GO TO 40
          ENDIF 
C  LOOK FOR SIMILAR IZW VALUES IN OTHER ZONES 
C                           WHICH ARE SET BY MIRROR IMAGES
      IF(NRM.LT.NROOMS)THEN 
          NRM1=NRM+1
          DO 20 JT=NRM1,NROOMS
          NRMQ=NRMA(JT) 
          IF(NRMQ.EQ.0)GO TO 20 
          N2Q=NWALLA(NRMQ)
          IF(N2Q.EQ.0)GO TO 20
          IF(IDBG.NE.0)WRITE(60,508)NRMQ 
          DO 10 K2Q=1,N2Q 
C   IN OTHER ZONES, COMPARE WITH ALL IZW S
          IZWQ=NENC(NRMQ,K2Q) 
          IF(IDBG.NE.0)WRITE(60,504)NRMQ,K2Q,IZWQ,IZ 
          IF(IZ.EQ.IZWQ)THEN
              IZ=IZ+1 
              IF(IDBG.NE.0)WRITE(60,506)NRMQ,IZWQ
              GO TO 8 
              ENDIF 
   10     CONTINUE
          IF(IDBG.NE.0)WRITE(60,509)NRMQ 
   20     CONTINUE
          ENDIF 
   22 WRITE(60,500)NRM,IZW,IZ
      NENC(NRM,K2I)=IZ
      IDEXP(IZ)=IDEXP(IZW)
      NZNC(IZ)=NZNC(IZW)
      KONSTA(IZ)=KONSTA(IZW)
      HGTA(IZ)=HGTA(IZW)
      XLENA(IZ)=XLENA(IZW)
      WDLEAK(IZ)=WDLEAK(IZW)
      HGTLEAK(IZ)=HGTLEAK(IZW)
      HNPL(IZ)=HNPL(IZW)
      WALLFI(IZ)=WALLFI(IZW)
      WALLFO(IZ)=WALLFO(IZW)
      NWNDA(IZ)=NWNDA(IZW)
      OHANGA(IZ)=OHANGA(IZW)
      HHANGA(IZ)=HHANGA(IZW)
      AWALLA(IZ)=AWALLA(IZW)
      ID=IDEXP(IZW) 
      IF(ID.LE.4)THEN 
          N4=NWNDA(IZW) 
          IF(N4.EQ.0)GO TO 32 
          DO 30 K4=1,N4 
          NIWND(IZ,K4)=NIWND(IZW,K4)
   30     CONTINUE
          ENDIF 
C  CHANGE ANY IZW FOR MIRROR IMAGES IF ANY ARE = IZW RESET ABOVE
   32 IF(NIZWS.EQ.0)GO TO 40
      DO 34 IQ=1,NIZWS
      IF(IZSET(IQ).EQ.IZW)IZSET(IQ)=IZ
      IF(IZWSS(IQ).EQ.IZW)IZWSS(IQ)=IZ
   34 CONTINUE
C *    *     *    *   *   *  BOTTOM OF MAIN LOOP!!!!
   40 CONTINUE
C  SET NO. OF ENCLOSURE ELEMENTS AT END OF THIS ZONE
      IZT=IZ
      RETURN
  500 FORMAT(20X,'FOR ZONE ',I4,' ENCLOSURE NO.(IZW) ',I3,
     +'  CHANGED TO ',I4) 
  502 FORMAT(10X,'BEGIN SEARCH FOR FEASIBLE IZ; K2I,IZW,IZ= ',3I5)
  503 FORMAT(12X,'IZW=IZ, SO NO NEED TO RESET;IZW= ',I3)
  504 FORMAT(15X,'NRMQ,K2Q,IZWQ,IZ= ',4I5)
  506 FORMAT(15X,'FOUND IZW IN ZONE ',I3,' THAT = IZ, SO ', 
     +'INCREMENT IZ;IZW FOUND= ',I3)
  507 FORMAT(15X,'FOUND IZW TO BE LT IZ, SO DONT RESET IT;IZW,IZ= ',
     +2I5)
  508 FORMAT(15X,'LOOKING FOR EXISTING IZW=IZ IN ZONE ',I4) 
  509 FORMAT(15X,'   **DIDNT FIND AN EXISTING IZW=IZ IN ZONE ',I4)
  510 FORMAT(20X,'LOOKING FOR K2 AT ORIG IZW=NEW IZ') 
  511 FORMAT(20X,'  K2J,IZWQ,IZ= ',3I4) 
      END 
