	Subroutine Del_Sembud

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

	Logical*1	Exists
	Character*52	rec_line
	Character*24	Id_Key
	Character*12	Type
	Character*12	Sub_type
	Character*12	disk
	Integer*2	group
	Integer*2	login_Q
	Integer*2	logout_Q
	Real*8		budget
	Integer*2	rate
	Integer*2	length
	Integer*2	IO_err
	Character*1	answer


	Equivalence (rec_line(25:36),disk)
	Equivalence (rec_line(37:38),group)
	Equivalence (rec_line(39:40),login_Q)
	Equivalence (rec_line(41:42),logout_Q)
	Equivalence (rec_line(43:44),rate)
	Equivalence (rec_line(45:52),Budget)

	Inquire (File='MAKACT_FILES:sembud.idx',exist=Exists)
	If (Exists) then 
		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)
	else
		write (screen,*) '%%%%% No SemBud to Delete From'
		goto 9999
	end if

1	format (Q,A)

5	type='            '
	write (screen,10)
10	format (1x,'Type of Account     > ',$)
	read (screen,1,err=9999) length,type
	if (length .eq. 0) goto 5

15	Sub_type='            '
	write (screen,20)
20	format (1x,'Sub-Type of Account > ',$)
	read (screen,1,err=5) length,Sub_type
	if (length .eq. 0) goto 15

	call str$upcase(type,type)
	call str$upcase(Sub_type,Sub_type)

	if ((type .eq. 'THSS ').OR.(type .eq. 'PROF ')) then
		if (index(Sub_type,'_') .eq. 0) then
			Sub_type(length+1:length+1 )='_'
			length=length+1
		end if
	end if

	Id_Key=type//Sub_type

	read (sembud,key=Id_Key,keyid=0,IOstat=IO_err) rec_line
	if (IO_err .eq. 36) then
		write (screen,25) Id_Key
25		format (1x,'%%%%% Classification ',1A24,' NOT found')
		goto 15
	end if
	if ((IO_err .ne. 0).AND.(IO_err .ne. 36)) then
		write (screen,30)
30		format (1x,'%%%%% ERROR in the SemBud File')
		call Exit(IO_err)
	end if

	write (screen,40) Type,Sub_type,disk,group,login_Q,logout_Q,
     +			  rate,budget
40	format (/,1x,'Type',13x,'Sub-Type',9x,'User Disk   ',
     +		'     UIC Group',/,
     +		1x,'------------     ------------     ------------',
     +		'     ------------',/,
     +		1x,1A12,5x,1A12,5x,1A12,5x,1O12,/,/,
     +		1x,'Permquota        ','Overdraft        ',
     +		'PACS Rate        ','Budget',/,
     +		1x,'------------     ------------     ------------',
     +		'     ------------',/,
     +		1x,1I12,2I17,1F17.2,/,/,
     +		1x,'Delete Entry    [N] > ',$)
	read (screen,1) length,answer
	call str$Upcase(answer,answer)

	if (answer .eq. 'Y') then
		delete(sembud)
	end if

	write (screen,*) ' '
	goto 15

9999	close(sembud)
	end
