.;		B L D . C M D
.;
.; THE FORMAT FOR INPUT INTO BLD.CMD IS AS FOLLOWS
.;
.;	@BLD.CMD FILENAME COMMAND-LINE SCILIB ADGRFLIB TCSLIB F4PLIB
.;
.; WHERE:
.;	FILENAME	=1-9 CHARACTER FILENAME WITH NO EXTENSIONS
.;	COMMAND-LINE	= TKB COMMANDLINE(TSK=OBJ1,OBJ2....)
.;	SCILIB		= Y or N DEPENDING ON WHETHER SCI.OLB IS TO BE INCLUDED
.;	ADGRFLIB	= Y or N DEPENDING ON WHETHER AG.OLB IS TO BE INCLUDED
.;	TCSLIB		= Y or N DEPENDING ON WHETHER TCS.OLB IS TO BE INCLUDED
.;	F4PLIB		= Y or N DEPENDING ON WHETHER OR NOT IS F4P TASK
.;	IF ANY OF SCILIB,ADGRFLIB, OR TCSLIB IS DEFINED, F4PLIB IS DEFINED 'Y'
.;	IF ADGRF IS DEFINED 'Y', THEN TCS IS DEFINED  'Y'
.;
.; EXAMPLE:
.;         @BLD FOO FOO.TSK;1/CP/FP=FOO N N N Y
.;
.; THIS WILL PRODUCE A COMMAND FILE:  FOO.BLD;1
.; WHICH LOOKS LIKE
.;		   FOO.TSK;1/CP/FP=FOO,
.;		   DK1:[1,1]F4POTS/LB
.;		   /
.;		   @FOO.OPT;1
.;		   //
.;
.;
	.ENABLE SUBSTITUTION
	.TEST COMMAN
	.IF <STRLEN> GT 79. 	.GOTO TOLONG
	.IF P1 EQ "" 		.GOTO NOFILE
	.TEST P1
	.IFF <ALPHAN> 		.GOTO NOEXTN
	.IF <STRLEN> GT 9. 	.GOTO BADNAM
	.SETN TOTLEN <STRLEN>
	.IF P2 EQ "" 		.GOTO NOCMD
	.SETS COMMA ""

	.SETF COMA
	.IF P3 EQ "Y" .SETT COMA
	.IF P4 EQ "Y" .SETT COMA
	.IF P5 EQ "Y" .SETT COMA
	.IF P6 EQ "Y" .SETT COMA
	.IFT COMA .SETS COMMA ","
	.OPEN 'P1'.BLD;1
	.DATA 'P2''COMMA'
	.IF P3 EQ "Y" .DATA LB1:[1,1]SCI/LB,
	.IF P3 EQ "Y" .SETS P6 "Y"
	.IF P4 EQ "Y" .DATA LB1:[1,1]AG/LB,
	.IF P4 EQ "Y" .SETS P5 "Y"
	.IF P4 EQ "Y" .SETS P6 "Y"
	.IF P5 EQ "Y" .DATA LB1:[1,1]TCS/LB,
	.IF P5 EQ "Y" .SETS P6 "Y"
	.IF P6 EQ "Y" .DATA DK1:[1,1]F4POTS/LB
	.DATA /
	.DATA @'P1'.OPT
	.DATA //
	.CLOSE
	.EXIT 1
.TOLONG:.DISABLE QUIET
	; ERROR(BLD.CMD) -- TOTAL COMMAND STRING IS TOO LONG
	.STOP 4
.NOFILE:.DISABLE QUIET
	; ERROR(BLD.CMD) -- FILE NAME NOT DEFINED
	.STOP 4
.NOEXTN:.DISABLE QUIET
	; ERROR(BLD.CMD) -- FILE NAME ONLY, NO EXTENSIONS
	.STOP 4
.BADNAM:.DISABLE QUIET
	; ERROR(BLD.CMD) -- FILE NAME TOO LONG(>9 CHARACTERS)
	.STOP 4
.NOCMD:	.DISABLE QUIET
	; ERROR(BLD.CMD) -- COMMAND LINE NOT PRESENT
	.STOP 4
