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ZZZTI,I.
  .IF($REC$.EQ.$*$,MULTI)
    WHILE(.NOT.(FILE(ZZZZZTI,EOF).OR.FILE(ZZZZZTI,EOI)),NEXTREC)
.ENDIF(MULTI)
RETURN,ZZZZZTB,ZZZZZTC,ZZZZZTL.
TDUEX,I,ZZZZZTC,ZZZZZTL.
IF(FILE(ZZZZZTC,AS),TDUERR)
  .IF($L$.NE.$0$)IF(FILE(ZZZZZTL,AS))COPYBR,ZZZZZTL,L.
  COMPASS,#I=ZZZZZTC,#L=0,B=ZZZZZTB,A.
  LDSET,ERR=ALL.
  LOAD,ZZZZZTB.
  NOGO,ZZZZZTA.
  .IF($REC$.EQ.$*$,MULTI)
    COPYBR,ZZZZZTI,I.
    ENDW(NEXTREC)
  .ENDIF(MULTI)
  .IF(FILE(LIB,AS),REPLACE)
    ULIB,R,ZZZZZTA,LIB.
  .ELSE(REPLACE)
    ULIB,C,ZZZZZTA,LIB.
  .ENDIF(REPLACE)
  REWIND,LIB.
  RENAME,I=ZZZZZTI.
  .IF($RW$.NE.$NO$,REWIND)
    REWIND,I.
    .IF($L$.NE.$OUTPUT$.AND.$L$.NE.$0$)REWIND,L.
  .ENDIF(REWIND)
  .IF(CSET.EQ.NORMAL)CSET,NORMAL.
  RETURN,ZZZZZTA,ZZZZZTB,ZZZZZTC,ZZZZZTL.
  REVERT.  I --> LIB.
  EXIT.
ENDIF(TDUERR)
RENAME,I=ZZZZZTI.
.IF($L$.NE.$0$)IF(FILE(ZZZZZTL,AS))COPYBR,ZZZZZTL,L.
.IF($RW$.NE.$NO$,REWIND)
  REWIND,I.
  .IF($L$.NE.$OUTPUT$.AND.$L$.NE.$0$)REWIND,L.
.ENDIF(REWIND)
.IF(CSET.EQ.NORMAL)CSET,NORMAL.
RETURN,ZZZZZTA,ZZZZZTB,ZZZZZTC,ZZZZZTL.
REVERT,ABORT.  COMPILATION FAILED.
*WEOR