! call openewq(lun,file,err,recl) !open to append, but create if not exist yet ! int, char, logical ! ALSO open for UNFORMATTED io ! If lun <= 0, then lunget will be called for it ! This is the same as openap, but it doesn't print out and error message ! if the file doesn't exist, and then will open new file subroutine openewq(ll,file,er,recl) use cesr_utils implicit none integer ll,ierr,recl character*(*) file character*256 filex logical er filex = ' ' call fullfilename(trim(file),filex,er) if (ll <= 0) ll = lunget() open(unit=ll,file=trim(filex),action='write',position='append',form='unformatted',iostat=ierr) if(ierr.ne.0) then !append failed , open anew open(unit=ll,file=trim(filex),action='write',status='new',form='unformatted',iostat=ierr) endif er=ierr.ne.0 return end subroutine openewq