	.ENABLE GLOBAL
	.ENABLE SUBSTITUTION
	;
	;	Building TERCOM tasks and WHO
	;
	.SETF SRCDEV
	.IFNDF $TKB .SETS $TKB "TKB"
	.IFDF $SRC .GOTO SRCOK
	.SETS $SRC COMMAN
	.PARSE $SRC " " $SRC DUMMY
	.PARSE $SRC "/" $SRC DUMMY
	.PARSE $SRC "." $SRC EXT
	.IF EXT EQ "" .SETS EXT "CMD"
	.TESTFILE '$SRC'.'EXT'
	.PARSE <FILSPC> ":" $SRC TEMP
	.TESTFILE SY:
	.PARSE <FILSPC> ":" SYDEV TEMP
	.IF $SRC EQ SYDEV .SETT SRCDEV
	.SETS $SRC $SRC+":"
.SRCOK:	.SETF Q
	.IFDF $LST .AND .IFDF $MP .GOTO CHKMP
	.ASK Q Generate listings
	.IFT Q .SETS $LST ""
	.IFF Q .SETS $LST "NL:"
	.SETF Q
	.ASK Q Generate maps
	.IFT Q .SETS $MP ""
	.IFF Q .SETS $MP "NL:"
.CHKMP:	.IFNDF $NTERM .ASKN [1.:63.] $NTERM How many terminals do you have including the console
	.OPEN TERCOM.MAC
	.DATA 	.TITLE	TERCOM - RESIDENT TERMINAL INFORMATION COMMON
	.DATA ;WRITTEN BY J. NEELAND
	.DATA ;LAST MODIFIED 780815.
	.DATA ;
	.DATA ;DEFINE RECORD COUNTS:
	.DATA 	NTT='$NTERM'.			;NUMBER OF TERMINALS ON SYSTEM
	.DISABLE SUBSTITUTION
	.DATA 	NVT=1			;0 'WORKING' VIRTUAL TERMINAL
	.DATA 	NBS=0			;0 NON-EXISTENT BATCH TERMINAL SO FAR
	.DATA ;
	.DATA 	.PSECT	TERCOM,RW,D,OVR,GBL
	.DATA ;
	.DATA TERCOM::			;REFERENCE LABEL
	.DATA 	.WORD	NTT		;# TT'S IN SYSTEM
	.DATA 	.WORD	NVT		;# VT'S IN SYSTEM
	.DATA 	.WORD	NBS		;# BS'S IN SYSTEM
	.DATA 	.BLKW	32.-3		;FILL OUT BALANCE OF THIS RECORD W/ ZEROS
	.DATA 	.BLKW	<NTT+NVT+NBS>*32. ;SPACE FOR REQUIRED # RECORDS
	.DATA 	.END
	.CLOSE
	.ENABLE SUBSTITUTION
	MAC TERCOM,'$LST'TERCOM/-SP=TERCOM
	PIP TERCOM.MAC;*/DE
	.OPEN TERCOMTKB.CMD
	.DATA TERCOM/-HD/PI,'$MP'TERCOM/-SP,SY:TERCOM=TERCOM
	.DATA /
	.DATA PAR=TERCOM:160000:20000
	.DATA STACK=0
	.DATA //
	.CLOSE
	'$TKB' @TERCOMTKB
	PIP TERCOMTKB.CMD;*/DE
	PIP TERCOM.OBJ;*/DE
	MAC TLOGGR,'$LST'TLOGGR/-SP='$SRC''<UIC>'TLOGGR
	.OPEN TLOGGRTKB.CMD
	.DATA TLOGGR/SL/PR:0,'$MP'TLOGGR/-SP=TLOGGR
	.DATA /
	.DATA UNITS=5
	.DATA ASG=TT0:1,NL:2,TI:5
	.DATA PRI=120
	.DATA TASK=TLOGGR
	.DATA WNDWS=1
	.DATA STACK=20
	.DATA RESCOM=TERCOM/RW
	.DATA //
	.CLOSE
	'$TKB' @TLOGGRTKB
	PIP TLOGGRTKB.CMD;*/DE
	PIP TLOGGR.OBJ;*/DE
	;
	;	We will now build modified versions of HELLO and BYE
	;	The modifications consist of user subroutines that will 
	;	cause task TLOGGR to log info into TERCOM whenever logins 
	;	or logoffs occur. The file names will be HELLOTCM.TSK and 
	;	BYETCM.TSK with task names of ...HEL and ...BYE.
	;
	MAC USESB,'$LST'USESB/-SP='$SRC''<UIC>'USESB
	MAC USRSB,'$LST'USRSB/-SP='$SRC''<UIC>'USRSB
	.OPEN HELTCMTKB.CMD
	.DATA ;
	.DATA ; TKB BUILD FILE FOR HEL
	.DATA ; ON A MAPPED RSX-11M SYSTEM
	.DATA ;
	.DATA HELLOTCM/-FP/AL/PR/-IP/MM,'$MP'HELLOTCM/-SP=
	.DATA HELTCMBLD/MP
	.DATA ;
	.DATA TASK=...HEL
	.DATA STACK=64
	.DATA UNITS=7
	.DATA ASG=TI:1:7
	.DATA ASG=SY:2,CO:3
	.DATA PAR=GEN:0:0
	.DATA GBLDEF=HELP$P:101		; OCTAL PRIORITY OF "HELP"
	.DATA GBLDEF=$DNTSB:0		; ADDRESS OF DECNET SUBROUTINE (0=NOT USED)
	.DATA ; The following was commented out to allow inclusion
	.DATA ;   of a user supplied subroutine to HELLO
	.DATA ;GBLDEF=$USESB:0		; ADDRESS OF USER SUBROUTINE (0=NOT USED)
	.DATA GBLDEF=ENCRPT:0		; ADDRESS OF PASSWORD ENCRYPTION ROUTINE (0=NOT USED)
	.DATA GBLDEF=TIMOUT:20		; SECONDS BEFORE TIMEOUT ON PROMPTS
	.DATA GBLREF=$DIV	
	.DATA GBLREF=$MUL	
	.DATA /
	.CLOSE
	.OPEN HELTCMBLD.ODL
	.DATA ;
	.DATA ; TKB ODL FILE FOR HELLO/HELP
	.DATA ; ON A MAPPED RSX-11M SYSTEM
	.DATA ;
	.DATA 		.ROOT	A-'<UIC>'USESB-*(HELO,HELP),FCS
	.DATA A:	.FCTR	MLTUSR/LB:HELROT-MCR/LB:ACTFIL-A2
	.DATA A2:	.FCTR	LB:[1,1]SYSLIB/LB:CAT5:CATB:CBTA:CDDMG:SAVR1-LIB1
	.DATA HELO:	.FCTR	MLTUSR/LB:HELLO-LIB2-LIB1
	.DATA HELP:	.FCTR	MLTUSR/LB:HLP-*(STTAB,SUB)
	.DATA LIB1:	.FCTR	LB:[1,54]RSX11M.STB/SS-LB:[1,1]EXELIB/LB/SS
	.DATA LIB2:	.FCTR	MCR/LB:COLOG:FMTDV:GNBLK:GETNUM
	.DATA STTAB:	.FCTR	MLTUSR/LB:HSTTAB-LB:[1,1]SYSLIB/LB:.TPARS-LIB1
	.DATA SUB:	.FCTR	MLTUSR/LB:HLPSUB
	.DATA ;
	.DATA ; 
	.DATA ;
	.DATA ;
	.DATA ;	THIS IS THE COMMON FCS CODE
	.DATA ;
	.DATA FCS:	.FCTR	FCSRT-*(FCSB1,FCSB2,FCSB3,FCSB4)
	.DATA ;
	.DATA FCSR1A:	.FCTR	LB:[1,1]SYSLIB/LB:XQIOU:XQIOI:WAITI:COMMON:DARITH:ASSLUN:UDIREC:PPNASC
	.DATA FCSR1B:	.FCTR	LB:[1,1]SYSLIB/LB:BKRG:DIRECT:ANSPAD:BIGBUF:RWFSR2
	.DATA FCSR1C:	.FCTR	LB:[1,1]SYSLIB/LB:RETADR:RDWAIT:WTWAIT:RWBLK:RQLCB:OD2CT
	.DATA FCSR1D:	.FCTR	LB:[1,1]SYSLIB/LB:EOFCHK:WATNOD:WATSET:CKALOC
	.DATA FCSR1F:	.FCTR	LB:[1,1]SYSLIB/LB:EDTMG:PARSE
	.DATA ;
	.DATA ;	BUILD THE FCS CO-TREE
	.DATA ;
	.DATA 		.NAME	FCSROT
	.DATA FCSRT:	.FCTR	FCSR1A-FCSR1B-FCSR1C-FCSR1D-FCSR1F
	.DATA ;
	.DATA ;	THIS IS THE OPEN LEG
	.DATA ;
	.DATA 		.NAME	FCSBR1
	.DATA FCSB1:	.FCTR	FCSB1A-FCSB1B
	.DATA ;
	.DATA FCSB1A:	.FCTR	LB:[1,1]SYSLIB/LB:OPEN:FINIT
	.DATA FCSB1B:	.FCTR	LB:[1,1]SYSLIB/LB:.CSI1
	.DATA ;
	.DATA ; THIS IS THE "GET/PUT" LEG
	.DATA ;
	.DATA 		.NAME	FCSBR2
	.DATA FCSB2:	.FCTR	LB:[1,1]SYSLIB/LB:GET:GETSQ:PUT:POSIT:POSREC:PNTMRK:EXTEND
	.DATA ;
	.DATA ; THIS IS THE CLOSE LEG
	.DATA ;
	.DATA FCSB3:	.FCTR	LB:[1,1]SYSLIB/LB:CLOSE
	.DATA ;
	.DATA ; THIS IS THE CSI2 LEG
	.DATA ;
	.DATA FCSB4:	.FCTR	LB:[1,1]SYSLIB/LB:.CSI2
	.DATA ;
	.DATA .END
	.CLOSE
	.OPEN BYETCMTKB.CMD
	.DATA BYETCM/PR/MM/-FP,'$MP'BYETCM/-SP=MCR/LB:BYE,USRSB
	.DATA MCR/LB:NETSUB:COLOG:FMTDV
	.DATA LB:[1,54]RSX11M.STB/SS,[1,1]EXELIB/LB
	.DATA /
	.DATA UNITS=7
	.DATA ASG=TI:1:7
	.DATA ASG=CO:3
	.DATA TASK=...BYE
	.DATA PAR=GEN:0:0
	.DATA STACK=100
	.DATA PRI=70
	.DATA ; The following was commented out to allow inclusion
	.DATA ;   of a user supplied subroutine to BYE
	.DATA ;GBLDEF=$USRSB:0		;ADDRESS OF USER SUBROUTINE (0=NOT USED)
	.DATA GBLDEF=$MALSB:0		; ADDRESS OF MAIL NOTIFICATION SUBROUTINE (0=NOT USED)
	.DATA GBLDEF=INDTIM:12		; TIMEOUT FOR INDIRECT (SECONDS)
	.DATA GBLDEF=ABOTIM:0		; TIMEOUT FOR ABORT AST (SECONDS)
	.DATA /
	.CLOSE
.HELTKB:
	'$TKB' @HELTCMTKB
	PIP HELTCMTKB.CMD;*/DE
	PIP HELTCMBLD.ODL;*/DE
	PIP USESB.OBJ;*/DE
	'$TKB' @BYETCMTKB
	PIP BYETCMTKB.CMD;*/DE
	PIP USRSB.OBJ;*/DE
	;
	;	We will now build the WHO program which works in conjunction
	;	with the TERCOM tasks.
	;
	MAC WHO,'$LST'WHO/-SP=LB:[1,1]EXEMC/ML,[11,10]RSXMC/PA:1,SY:'<UIC>'WHO
	.OPEN WHOTKB.CMD
	.DATA WHO/PR/CP/MM/-FP,'$MP'WHO/-SP=WHO
	.DATA MCR/LB
	.DATA LB:[1,1]EXELIB/LB
	.DATA LB:[1,54]RSX11M.STB
	.DATA /
	.DATA RESCOM=TERCOM/RO
	.DATA STACK=40
	.DATA ASG=TI:1
	.DATA UNITS=1
	.DATA PRI=150
	.DATA TASK=...WHO
	.DATA //
	.CLOSE
	'$TKB' @WHOTKB
	PIP WHOTKB.CMD;*/DE
	PIP WHO.OBJ;*/DE
