copyright (C) 2001  MSC-RPN COMM  %%%MC2%%%
*

      subroutine out_sfileb (stepno,is,nis,js,jn,njs, 1,2
     $                              iw,ie,niw,jw,njw)
      implicit none
*
      integer stepno,is,nis,js,jn,njs,iw,ie,niw,jw,njw
*
#include "lcldim.cdk"
#include "cdate.cdk"
#include "partopo.cdk"
#include "yomdyn1.cdk"
#include "sor.cdk"
#include "rec.cdk"
#include "levels.cdk"
*
      character*15 datev
      character*512 filen
      integer i,k,ind_o(gnk+1)
      real*8 dayfrac,sec_in_day
      parameter ( sec_in_day=86400.0d0 )
*
*------------------------------------------------------------------
*
      if (out_unfc.gt.0) return
*
      out_unfc = 79
      if (myproc.eq.0) then
         dayfrac = dble(stepno) * dble(grdt) / sec_in_day
         call incdatsd (datev,gcrunstrt,dayfrac)
c         filen= '../../output/casc_n/bcs_'//datev
         filen= '../../output/casc/bcs_'//datev
         open (out_unfc,file=filen,access='SEQUENTIAL',
     $                               form='UNFORMATTED')
         call wrgeocasb ( 
     $         xpx(is+hx-1),nis+1,ypx(js+hy-1),ypx(jn+hy-1),njs+1,
     $         xpx(iw+hx-1),xpx(ie+hx-1),niw+1,ypx(jw+hy-1),njw+1,
     $                         zt,htop,iscal,gnk,nvardyn,out_unfc )
      endif
*
*------------------------------------------------------------------
      return
      end
*

      subroutine wrgeocasb ( xps,nis,yps,ypn,njs, 1
     $                       xpw,xpe,niw,ypw,njw,
     $                       zt,htop,iscal,nk,ntr,unf )
      implicit none
*
      integer nis,njs,niw,njw,nk,iscal(2),ntr,unf
      real zt(nk), htop
      real*8 xps(nis), yps(njs), ypn(njs), xpw(niw), xpe(niw), ypw(njw)
*
*------------------------------------------------------------------
      write (unf) '>>^^',nis,njs,niw,njw,ntr
      write (unf) xps,yps,ypn,xpw,xpe,ypw
      write (unf) 'HTHT',nk,iscal,htop
      write (unf) zt
*
*------------------------------------------------------------------
      return
      end