simple close of a LUN. On error show message and stop (by default)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | lun | |||
integer, | intent(out), | optional | :: | ier |
subroutine fileclose(lun,ier)
integer,intent(in) :: lun
integer,intent(out),optional :: ier
character(len=256) :: message
integer :: ios
if(lun/=-1)then
close(unit=lun,iostat=ios,iomsg=message)
if(ios/=0)then
if(present(ier))then
ier=ios
else
call fpm_stop(4,'*fileclose*:'//trim(message))
endif
endif
endif
end subroutine fileclose