	Subroutine CloseSemBud(type,Sub_type,NumOfAcc,money)

	Character*52	rec_line
	Real*8		budget
	Character*12	type
	Character*12	Sub_type
	Character*24	Id_Key
	Integer*2	NumOfAcc
	Real		money

	Parameter (screen=1,sembud=2,Rec_S=52)

	Equivalence (rec_line(45:52),budget)

	Id_Key=type//Sub_type
	call str$Upcase(Id_Key,Id_Key)

	Open (unit=sembud,file='MAKACT_FILES:sembud.idx',
     +	status='old',Organization='indexed',access='keyed',
     +	RecordType='fixed',form='unformatted',shared,
     +	key=(1:24,37:38),recordsize=Rec_S,err=99)

	read (sembud,key=Id_Key,IOstat=IO_err) rec_line

	if (IO_err .ne. 0) then
		write (screen,*) '%%%%% ERROR in writing to SEMBUD'
	else
		budget=budget-(money*real(NumOfAcc))
		if (budget .le. 0) write (screen,10) Id_Key
10		format (' %%%%% Warning budget completely USED for ',
     +		1A24)
		rewrite (sembud) rec_line
	end if
	goto 900

99	write (screen,*) '%%%%% ERROR in opening SEMBUD from Close Sem'

900	close (sembud)
	end
