.;
.;----------------------------------------------------------------------------
.;
.; CMD-file:	P U P
.;
.; Author:	Jan Belgraver	18-NOV-80
.;
.; Date:	18-NOV-80
.;
.; Version:	1.9	2-Sep-86
.;
.; Modified by:	Jan H. Belgraver	1-SEP-82	JB01	V1.1
.; 		Added check on PIP exit status to abort program flow
.; 		in case of error, e.g. NO SUCH FILE.
.; 		Added undocumented command line input parameter option
.; 			@FILE P1 P2 P3 P4 P5 P6 P7 P8
.; 		P1,P2,....P8 transfer data to parameters P1,P2,....P8
.; 		inside command file.
.; 		New will be that file to protected is entered as 
.; 		part of command line submitted to MCR.
.; 		e.g.
.; 		MCR>PUP FILE.CMD
.;
.; 		Jan H. Belgraver	28-JAN-83	JB02	V1.2
.; 		For compatibility with DCL.
.;
.; 		Jan H. Belgraver	30-MAY-84	JB03	V1.3
.; 		Made it to loop around until an <ESC> is entered.
.;
.; 		Jan H. Belgraver	13-JUN-84	JB04	V1.4
.; 		Disabled display of @ <EOF>.
.;
.; 		Jan H. Belgraver	27-SEP-85	JB05	V1.5
.; 		Truncate file.
.;
.; 		Jan H. Belgraver	 1-OCT-85	JB06	V1.6
.;		Disabled display of setting protection and truncation.
.;
.; 		Jan H. Belgraver	25-APR-86	JB07	V1.7
.;		Purge using SRD
.;
.; 		Jan H. Belgraver	16-May-86	JB08	V1.8
.;		1. Don't stop if SRD finds nothing to purge.
.;		2. Disabled modification JB06
.;		3. Added /HD to SRD
.;
.; 		Jan H. Belgraver	2-Sep-86	JB09	V1.9
.;		For test on correct exit status of SRD on "No Such File(s)"
.;----------------------------------------------------------------------------
.;

.enable	substitution
.enable	quiet								! JB01
.enable	escape								! JB03
	.SETF	DCL							! JB02
	.IF	<CLI> EQ "DCL"	.SETT	DCL				! JB02
.;	If current CLI is DCL reset to MCR				! JB02
	.IFT	DCL	SET TERMINAL/MCR				! JB02
	.disable	quiet						! JB06
	.TEST	P1			! Check on empty string		! JB01
	.IF <STRLEN> EQ 0	.GOTO	INPUT				! JB01
	.SETS	FILNAM	P1
	.GOTO	PURGE							! JB01
.INPUT:									
;
	.ASKS	FILNAM	Enter file spec. [<ESC> = Exit] 
	.IFT	<ESCAPE>	.GOTO	FINISH				! JB03
.PURGE:									
;	Working . . .
.enable	quiet								! JB01
	PIP	'FILNAM';*/PR:0
	.IF	<EXSTAT> NE 1	.GOTO	INPUT				! JB01
	SRD	'FILNAM'/PU/HD						! JB08
	.IF	<EXSTAT> gt 2	.GOTO	INPUT				! JB09
	PIP	'FILNAM'/PR:104210
	.if	<EXSTAT> NE 1	.GOTO	INPUT				! JB06
	PIP	'FILNAM'/TR						! JB05
	.GOTO	INPUT							! JB03
.FINISH:
	.enable		QUIET						! JB02
	.disable	DISPLAY						! JB04
.;	If user CLI was DCL reset terminal.				! JB02
	.IFT	DCL	SET /DCL=TI:
.EXIT
