	program ice_comp
	parameter	(n = 1280*600)

	integer		Orig(n)
	integer		Pack(n)
	integer		Final(n)

	character	cFile*120
	character	cInfo*1000
	character	cFiles(2000)*120
	character	cSearch*80	/'*.nic'/

	logical		bReadNic

	include		'openfile.h'
	include		'filparts.h'

	call AskChar('searching',cSearch)

	iAct = OPN__STOP+OPN__REOPEN

	is = 1
	icount = 0
	do while (iSearch(is, cSearch, cFile) .eq. 1)
	    is = 0
	    if (icount .lt. 2000) then
		icount = icount+1
		cFiles(icount) = cFile
	    end if
	end do

	print *, icount, ' files'

	do jf=1, icount
	    cFile = cFiles(jf)
	
	    if (bReadNic(iAct, cFile, n, nX, nY, Orig, cInfo)) then
		print *, nX*nY
		call ArrI4GetMinMax(nX*nY, Orig, nmin, nmax)
		print *, nmin, nmax

		I = iSetFileSpec(cFile)
		I = iPutFileSpec(FIL__TYPE,FIL__TYPE,'.ice')
		I = iGetFileSpec(0,0,cFile)

		iFinal = n
		print *, iAct,iFinal, cFile(:itrim(cFile))
		I = ice_read(iAct, cFile, iFinal, Final, n, Pack, cInfo)
		print *, iFinal
		call ArrI4GetMinMax(iFinal, Final, nmin, nmax)
		print *, nmin, nmax
		
		if (iFinal .ne. nX*nY) stop 'wrong number of elements'

		do i=1,nX*nY
		    if (Orig(i) .ne. Final(i)) then
			print *, i, Orig(i), Final(i), cFile(:itrim(cFile))
			stop ' not the same '
		    end if
		end do

	    end if

	end do

	stop 'done'
	end
