USE c:\kopi\baze\kalkstav ALIAS kalks1 SHARED IN 0
USE c:\2007\baze\kalkstav ALIAS kalkstav SHARED IN 0
SELECT kalks1
SET ORDER TO tag sifrob
GOTO top
SELECT kalkstav
GOTO top
DO WHILE !EOF()
IF brdok="000086"
	a=kalkstav.sifrob
	mnab=0
	SELECT kalks1
	GOTO top
	SEEK a
	DO WHILE !EOF()
	IF kalks1.sifrob<>a
		EXIT
	endif	
		IF kalks1.ncena<>0
			mnab=kalks1.ncena
		ENDIF
	SKIP
	ENDDO
	SELECT kalkstav
	replace kalkstav.ncena WITH mnab
endif
SKIP
ENDDO
RETURN
			