	character*80 gridarea
	integer		 max_nr,max_nc,mnr,mnc,nodatal,nodata,div
c	parameter	(max_nr= 11106,max_nc = 20573)
	parameter	(mnr= 126,mnc = 221,div = 1)
c	integer		 onearr(max_nr,max_nc)
	integer		 zone(mnr*div,mnc*div)
	

	gridarea = "gridarea.asc"
		
	nrl	=mnr
	ncl	=mnc
	lx0l=-457500
	ly0l=-1500500
	lsl	=Int(10000/div)
	lnodatal=-9999

	do i = 1, nrl
	do j = 1, ncl
			do ii =1 ,div
			do jj =1 ,div
				ix= (i-1)*div +ii
				iy= (j-1)*div +jj
				zone(ix,iy) = (i-1)*ncl +j
c				print *,i,j,ix,iy, zone(ix,iy)
			enddo
			enddo
	enddo
	enddo
	call writefile_int (gridarea,nrl*div,ncl*div,lx0l,ly0l,lsl,
     $	lnodatal,zone,mnr*div,mnc*div)



	END

	subroutine writefile_int(name,nr,nc,x0,y0,s,znodata,array,nnr,nnc)
	implicit none
      integer znodata,nc,nr
	integer nnr,nnc
	character*80  name
	integer array(nnr,nnc)
      integer x0,y0,s
	integer i,j
	
      open(1,file=name,status='unknown')
      write(1,'(A, i)') 'ncols',nc
      write(1,'(A, i)') 'nrows',nr
      write(1,'(A, i)') 'xllcorner',x0
      write(1,'(A, i)') 'yllcorner',y0
      write(1,'(A, i)') 'cellsize',s
      write(1,'(A, i)') 'NODATA_value',znodata
      do i=1,nr
      	do j=1,nc
      		write (1,'(f6.1,$)') 100.0
      	end do
		write (1,*)
      end do
      close(1)
	end