SET DEFAULT TO \\sandra\d\robno\baze
OPEN DATABASE belcar SHARED
USE lomstav ALIAS lomstav IN 0
USE kalkstav ALIAS kalkstav IN 0
SELECT kalkstav 
SET ORDER TO tag sifrob1
GOTO top

SELECT lomstav
GOTO top
DO WHILE !EOF()
a1=lomstav.sifrob
a2=lomstav.datum
mpce=lomstav.pcena
SELECT kalkstav
GOTO top
SET NEAR ON
SEEK  a1
SET NEAR OFF
DO WHILE !EOF()
	IF a1<>kalkstav.sifrob
		EXIT
	ENDIF
		
	IF kalkstav.datum>a2
		SKIP
		LOOP
	ENDIF
	mpce=kalkstav.pcena
	EXIT
SKIP
ENDDO
SELECT lomstav
replace lomstav.pcena WITH mpce
SKIP
ENDDO
RETURN
	