	.SETF DBG
	.SETS CHR1 P1[1:1]
	.IF CHR1 EQ "/" .GOTO PARS
	.IF P1 NE "" .SETS P7 "/F4P"
	.GOTO 5
.PARS:	.PARSE P1 "/" DUMMY SWTCH1 SWTCH2 SWTCH3
	.IF SWTCH1 EQ "DBG" .OR .IF SWTCH2 EQ "DBG" .SETT DBG
	.SETS P1 ""
	.IF SWTCH1 EQ "F4P" .OR .IF SWTCH2 EQ "F4P" .SETS P1 "/F4P"
	.IF SWTCH1 EQ "F77" .OR .IF SWTCH2 EQ "F77" .SETS P1 "/F77"
	.IF P1 EQ "" .SETS P1 "/F4P"
	.SETS P9 P1
	.SETS P1 P2
	.SETS P2 P3
	.SETS P3 P4
	.SETS P4 P5
	.SETS P5 P6
	.SETS P6 P7
	.SETS P7 P9
.5:	.IF P1 EQ "" PAGE
	.IF P1 NE "" .GOTO 10
	;		C M D B L D . C M D
	; This file will create a batch assembly and taskbuild files
	; using all default values for F4P and F77 programs.
	;
	;
	; If TSKNAM = Task name of file to build, then the file TSKNAM.PRC;1
	; will exist when this procedure is finished.
	;
	;     ALL tasks,object modules and source files will be purged.
	;
	;	P1 = /switches - If defined, decode switches, rotate other
	;			 parameters, P2->P1, P3->P2... etc.
	;			 Switches now allowed:
	;				/F77, /F4P, /DBG
	;	P1 = TASKNAME -- IF DEFINED, DO NOT ERASE SCREEN OR PROMPT
	;			 FOR TASKNAME.
	;	P2 = (NO)LIST -- IF DEFINED, DO NOT PROMPT FOR LISTING ANSWER.
	;			 IF NOT DEFINED ASK.
	;	P3 = (NO)BUILD - IF DEFINED, DO NOT ASK IF TASKBUILD DESIRED.
	;			 IF DEFINED, DO NOT BUILD WITH ANY OF THE 
	;			 OPTIONAL LIBRARIES.
	;	P4 = (NO)MAP  -- IF DEFINED TO NOT ASK WHETHER MAP DESIRED
	;	P5 = (NO,YES) -- IF = YES, BUILD WITH UIC=[200,200]
	;	P6 = (NO,YES) -- IF = YES, BUILD WITH AN ODL FILE
	;	P7 = "/F77"   -- If building a program with /F77 syntax
	;	   = "/F4P"   -- If building a program with /NOF77 syntax
	;
	.SETF NAME
.10:	.SETF LST
	.SETF MAP
	.SETF NOSRC
	.SETF NOOBJ
	.SETT SCI
	.SETF MLTUSR
	.SETF OVRLAY
	.IF P7 EQ "/F4P" .SETF F77
	.IF P7 EQ "/F77" .SETT F77
	.SETS $MP ""
	.SETS $LST ""
	.SETS SCIANS "N"
	.SETS TCSANS "N"
	.SETS AGANS "N"
	.SETS F4PANS "Y"
	.SETS F77ANS "N"
	.SETS OVLANS "N"
	.SETS YES "Y"
	.SETS NO "N"
	.SETS CR ""
	.SETS BLD ""
	.SETS MAXBUF ""
	.SETS ACTFIL ""
	.SETS FMTBUF ""
	.SETS UNITS ""
	.ONERR 20

.20:	.IF P1 EQ "" .ASKS P1 What is the Fortran program name
.22:	.IF P1 EQ CR .GOTO XIT
	.TEST P1
	.DISABLE QUIET
	.IFF <ALPHAN> ; File name only -- omit file name extension
	.IF <STRLEN> >9. ; Names longer than 9 characters are not allowed
	.ENABLE QUIET
	.IFF <ALPHAN> .OR .IF <STRLEN> >9. .SETS P1 ""
	.IFF <ALPHAN> .OR .IF <STRLEN> >9. .GOTO 20
	.SETS REPORT P1+".FTN"
	.TESTFILE 'REPORT'
	.IF <FILERR> NE 1 .SETT NOSRC
	.IFF NOSRC .GOTO 22A
	.SETF NOSRC
	.DISABLE QUIET
	; No source file with given name, try again!
	.ENABLE QUIET
	.SETS P1 ""
	.GOTO 20
.22A:	.SETS UIC <UIC>
	.SETS GRP UIC[2:4]
	.SETS MEM UIC[6.:8.]
	.IF P2 EQ "LIST" .SETT LST
	.IF P2 EQ "NOLIST" .SETF LST
	.IF P2 EQ "" .ASK LST   Do you want a listing
	.IF P7 EQ "" .ASK F77   Use the /F77 compiler switch
	.IF P7 EQ "" .ASK DBG   Debug the program    
	.IFT LST .SETS $LST ",TI:/LI:1"
.26:	.SETS DBGS ""
	.IFT DBG .SETS DBGS "/DE"
	.OPEN 'P1'.PRC;1
	.DATA $NOTRACE
	.DATA $EOW
	.IFF F77 .DATA F4P 'P1'.OBJ;1'$LST'='P1'.FTN/TR:ALL/CO:25./NOF77'DBGS'
	.IFT F77 .DATA F4P 'P1'.OBJ;1'$LST'='P1'.FTN/TR:ALL/CO:25./F77'DBGS'
	.SETS BLD P3
	.IF BLD EQ "BUILD" .OR .IF BLD EQ "NOBUILD" .SETF SCI
.30:	.IF P3 EQ "" .ASKS BLD Taskbuild [Y,N,TCS,ADGRF,OVRLAY]
	.IF BLD EQ "OVRLAY" .SETT OVRLAY
	.IFT OVRLAY .SETS BLD "Y"
	.IFT OVRLAY .SETS OVLANS "Y"
	.IF BLD EQ CR .SETS BLD "N"
	.IF BLD EQ "BUILD" .SETS BLD YES
	.IF BLD EQ "NOBUILD" .SETS BLD "N"
	.IF BLD EQ "N" .GOTO 40
	.SETS TKBLDR "TKB"
	.SETF TKBTYP
	.IF P3 EQ "" .ASK TKBTYP Use the fast taskbuilder (FTB)
	.IFT TKBTYP .SETS TKBLDR "FTB"	
	.IF P3 EQ "" .ASK OPTS Build with special options
	.IFT OVRLAY .SETF SCI
	.IFT SCI .ASK SCI Build with the scientific subroutine package
	.IF BLD NE "TCS" .AND .IF BLD NE YES .AND .IF BLD NE "ADGRF" .GOTO 30
	.IF P4 EQ "MAP" .SETT MAP
.33:	.IF P4 EQ "" .ASK MAP Do you want a map from the taskbuilder
	.IF TKBLDR EQ "FTB" .GOTO 38
	.IF P5 EQ "YES" .SETT MLTUSR
.35:	.IF P5 EQ "" .ASK MLTUSR Build a multiuser task
.38:	.IFT MAP .SETS $MP ",TI:"
	.IFT SCI .SETS SCIANS "Y"
	.IF BLD EQ "ADGRF" .SETS AGANS "Y"
	.IF BLD EQ "TCS" .OR .IF BLD EQ "ADGRF" .SETS TCSANS "Y"
	.SETS IN P1
	.IFT OVRLAY .SETS IN P1+"/MP"
	.IFT OVRLAY .SETS F4PANS "N"
	.SETS ANSR SCIANS+" "+AGANS+" "+TCSANS+" "+F4PANS+" "+OVLANS
	.SETS SPCOPT ""
	.IFF OPTS .GOTO 39
	.ASKS MAXBUF MAXBUF =
	.IF MAXBUF NE "" .SETS SPCOPT SPCOPT+" MAXBUF="+MAXBUF
	.ASKS ACTFIL ACTFIL =
	.IF ACTFIL NE "" .SETS SPCOPT SPCOPT+" ACTFIL="+ACTFIL
	.ASKS UNITS UNITS =
	.IF UNITS NE "" .SETS SPCOPT SPCOPT+" UNITS="+UNITS
	.ASKS FMTBUF FMTBUF =
	.IF FMTBUF NE "" .SETS SPCOPT SPCOPT+" FMTBUF="+FMTBUF
.39: 
	.SETS TYP ""
	.DATA @LB1:[1,5]BLD/-LI 'P1' 'P1'.TSK;1/CP/FP'$MP'='IN' 'ANSR'
.;	.SETS OPTNS "CLSTR=F4PRES,FCSRES:RO "
	.IF TKBLDR EQ "TKB" .SETS OPTNS "CLSTR=F4PRES,FCSRES:RO "
	.IF TKBLDR EQ "FTB" .SETS OPTNS "LIBR=F4PRES:RO LIBR=FCSRES:RO "
	.IFT MLTUSR .SETS OPTNS OPTNS+"UIC=[200,200]"
	.DATA @LB1:[1,5]OPT/-LI 'P1' 'OPTNS''SPCOPT'
	.DATA 'TKBLDR' @'P1'.BLD
.40:	.DATA PIP 'P1'.OBJ;*/DE/NM,'P1'.BLD;*,'P1'.OPT;*
	.DATA PIP 'P1'.FTN/PU
	.DATA PIP 'P1'.FTN/TR
	.DATA $TRACE
	.CLOSE
 
	PIP 'P1'.PRC;1/TR
	;
	;
.;	.ASKS PASWRD ENTER LOGON PASSWORD
.;	.IF PASWRD EQ "" .GOTO XIT0
.;	.XQT SUB 'GRP'/'MEM'/'PASWRD' 'P1'
.;	PRINT MCRQUE:='P1'.PRC
	.XQT PIN 'P1'.PRC
.XIT0:	.DISABLE QUIET
	;[1;1H[2J
	.ENABLE QUIET
.XIT:;
