      subroutine open_chose_number(ifil,name,status,form)
      character(*) name
      character(*) status,form
      logical y,yopen
      inquire(file=name,opened=yopen)
      if(yopen)print'(a,a,a)','***open_chose_number: Warning. File '
     *,name,' was already opened***'
      do ifil=9,99
         inquire(ifil,opened=y)
         if(.not.y) then
            open(ifil,file=trim(name),status=status,form=form)
            exit
         endif
      enddo
      end
