      program b2a

      implicit real*8(a-h,o-z)
      real*4 data(100000)
      real*8 glamn,glomn,dla,dlo
      integer*4 nla,nlo,ikind
      character*88 fname

      write(6,1)
    1 format(' program b2a -- Converts .b (binary) to ',
     * '.asc (ASCII) grid')
      write(6,2)
    2 format('      Enter .b input grid file name: ',$)
      read(5,'(a)')fname
      open(1,file=fname,status='old',form='unformatted')
      write(6,3)
    3 format('      Enter .asc output grid file name: ',$)
      read(5,'(a)')fname
      open(2,file=fname,status='new',form='formatted')
      
      read(1)glamn,glomn,dla,dlo,nla,nlo,ikind
      write(2,*)glamn,glomn,dla,dlo,nla,nlo,ikind
      
      do 10 i=1,nla
        read(1)(data(j),j=1,nlo)
        write(2,*)(data(j),j=1,nlo)
   10 continue
      end
