1	SUB SMG_POS_CLEAR(LONG Row,LONG Column,BYTE Entity,BYTE Portion, &
		BYTE Vir_disp_num)

	!---------------------------------------------------------------&
	!								&
	!			  SMG_POS_CLEAR				&
	!								&
	!		Creation Date:  3-July-1985			&
	!		Author:		Ken Messer			&
	! 		Purpose:        Position the cursor, then clear	&
	!				a specified portion of a	&
	!				virtual display			&
	!								&
	!		Modification history				&
	!								&
	!	Date	Description of change(s)			&
	!								&
	!---------------------------------------------------------------&
	!								&
	! Copyright (c) 1985 -	Ken Messer, Allied Electronics, Inc.,	&
	!			401 E. 8th St., Ft. Worth, TX  76102	&
	!								&
	! This software may be copied and distributed freely to anyone	&
	! for non-commerical use provided that this copyright notice is &
	! included.							&
	!---------------------------------------------------------------&

	OPTION TYPE = INTEGER, SIZE = INTEGER LONG

	%include "SYS$MANAGER:SMG.DFN"


	DECLARE LONG				RS

	EXTERNAL LONG CONSTANT			SS$_Normal

	EXTERNAL LONG FUNCTION			SMG$Erase_line,		&
						SMG$Erase_display,	&
						SMG$Set_cursor_abs

	EXTERNAL STRING FUNCTION	Get_Error_Message(LONG)

	!---------------------------------------------------------------&
	!								&
	!		M a i n   P r o g r a m   L o g i c		&
	!								&
	!---------------------------------------------------------------&

	! Position the cursor

100	RS = SMG$Set_cursor_abs(Display_id(Vir_disp_num),Row,Column)

	IF RS AND SS$_Normal = 0   THEN
		PRINT Get_Error_Message(RS)
		STOP
	END IF

	! Determine what portion to clear

200	SELECT ENTITY

	   CASE 0	! clear the screen

		SELECT Portion

		   CASE 0	! cursor to end of screen

			RS = SMG$Erase_display(Display_id(Vir_disp_num), &
				Row,Column,,)

		   CASE 1	! cursor to beginning of screen

			RS = SMG$Erase_display(Display_id(Vir_disp_num), &
				1,1,Row,Column)

		   CASE 2	! entire screen

			RS = SMG$Erase_display(Display_id(Vir_disp_num),,,,)

		   CASE ELSE

			GOTO Done

		END SELECT

	   CASE 1	! clear the line

		SELECT Portion

		   CASE 0	! cursor to end of line

			RS = SMG$Erase_line(Display_id(Vir_disp_num),,)

		   CASE 1	! cursor to beginning of line

			RS = SMG$Erase_display(Display_id(Vir_disp_num), &
				Row,1,Row,Column)

		   CASE 2	! entire line

			RS = SMG$Erase_line(Display_id(Vir_disp_num),Row,1)

		   CASE ELSE

			GOTO Done

		END SELECT

	END SELECT

	IF RS AND SS$_Normal = 0   THEN
		PRINT Get_Error_Message(RS)
		STOP
	END IF

 Done:

32767	SUBEXIT

	END SUB
