C-------------------------------------------------------------------------- subroutine ftclsx(iunit,keep,status) C low level routine to close a file C C iunit i Fortran I/O unit number C keep l keep the file? (else delete it) C status i returned error status (0=ok) C C written by Wm Pence, HEASARC/GSFC, Aug 1992 integer iunit,status logical keep C COMMON BLOCK DEFINITIONS:-------------------------------------------- integer nb,ne parameter (nb = 20) parameter (ne = 512) integer bufnum,chdu,hdutyp,maxhdu,hdstrt,hdend,nxthdr,dtstrt integer nxtfld logical wrmode common/ft0001/bufnum(199),chdu(nb),hdutyp(nb),maxhdu(nb), & wrmode(nb),hdstrt(nb,ne),hdend(nb),nxthdr(nb),dtstrt(nb),nxtfld integer buflun,currnt,reclen,bytnum,maxrec common/ftlbuf/buflun(nb),currnt(nb),reclen(nb), & bytnum(nb),maxrec(nb) C END OF COMMON BLOCK DEFINITIONS----------------------------------- integer ibuff ibuff=bufnum(iunit) if (ibuff .eq. 0)return C reset file common block parameters bufnum(iunit)=0 buflun(ibuff)=0 wrmode(ibuff)=.false. currnt(ibuff)=0 reclen(ibuff)=0 bytnum(ibuff)=0 if (keep)then close(iunit,err=900) else close(iunit,status='DELETE',err=900) end if return 900 continue C set error code, if it has not previous been set if (status .le. 0)status=110 end