<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_OPENFILE'><A href='../../html_code/tools/da_openfile.inc.html#DA_OPENFILE' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

subroutine da_openfile (kunit, cdfile, cdaccess, cdstatus, cdform),1

   !------------------------------------------------------------------------
   ! Purpose: open an file and rewind
   !
   !   method:
   !   ------
   !
   !   input:
   !   -----
   !      kunit:          logical unit
   !      cdfile:         name of file for output of discared obs.
   !      cda!ess:       a!ess (sequential or),
   !      cdstatus:       status (old, new or unknown)
   !      cdform:         form (formatted or unformatted)
   !
   !   output:
   !   ------
   !      opened file
   !
   !   common:                      no
   !   -------
   !   external:                    no
   !   --------
   !   references:                  no
   !   ----------
   !
   !   modifications:
   !   --------------
   !       original :  98-07 (f. vandenberghe)
   !       additions : 98-11 norm doctor (f. vandenberghe)
   !--------------------------------------------------------------------------

   implicit none

   integer, intent(in) :: Kunit
   character*(*), intent(in) :: CDFILE, CDACCESS, CDSTATUS, CDFORM

   integer :: iost

   ! 1.  open FILE
   ! -------------

   IOST = 0

   open (unit   = Kunit, &amp;
          FILE   = CDFILE, &amp;
          ACCESS = CDACCESS, &amp;
          STATUS = CDSTATUS, &amp;
          FORM   = CDFORM, &amp;
          ERR    =  2000, &amp;
          iostat = IOST       )
 
   rewind (Kunit)
 
   return
 
  ! 2.  ERROR PROCESSinG
   ! --------------------
 
2000 continue
   call da_error(__FILE__,__LINE__, &amp;
      (/"Cannot open file"//CDFILE/))

end subroutine da_openfile