	SUBROUTINE SETEXIT
	INTEGER exit_status, SYS$DCLEXH
	CHARACTER string*12, original_user*31
	COMMON original_user
C
C	Declare exit string descriptor.
C
	STRUCTURE /descriptor/
	INTEGER size, address
	END STRUCTURE
	RECORD /descriptor/ EXIT_STRING
C
C	Declare exit handler descriptor.
C
	STRUCTURE /exit_descriptor/
	INTEGER link, addr, args /2/, status_addr, string_addr
	END STRUCTURE
	RECORD /exit_descriptor/ HANDLER
C
	EXTERNAL exit_handler
C
	string = original_user(1:12)
C
C	Setup decriptor.
C
	exit_string.size    = 12
	exit_string.address = %LOC (string)
C
C	Setup exit handler descriptor.
C
	handler.addr = %LOC (exit_handler)
	handler.status_addr = %LOC (exit_status)
	handler.string_addr = %LOC (exit_string)
C
C	Establish the exit handler.
C
	icode = SYS$DCLEXH(handler)
	if (.not.icode) CALL LIB$SIGNAL(%val(icode))
C
	return
	end
