.;  RMCONFIG.CMD
.;
.;  LABSTATION 23 data base configuration procedure
.;
.;  Copyright (C) 1982 by
.;  Digital Equipment Corporation, Maynard, Mass.
.;
.;  MODULE DESCRIPTION
.;
.;  This procedure establishes entries in the host DECnet 
.;  permanent database, updates the host loader table file,
.;  and creates a host node list that VNP can use to update
.;  image files.
.;
.;  The following are required:
.;
.;    The LABSTATION 23 sysgen/netgen procedures must have been run
.;    to create the system image named RMMAST.SYS,.STB.  This file
.;    is tested for.
.;
.;    Under VMS, the network must be running, since NCP is used to
.;    get and update database information.
.;
.;    This procedure assumes it is being run by the System Manager
.;    and therefore has all privileges.
.;
.;  
.;  LDP Development Group
.;
.;  Created  9-Sep-1982 	R.H.Bauman
.;
	.ENABLE GLOBAL
	.ENABLE ESCAPE
	.ENABLE SUBSTITUTION
	.DISABLE LOWERCASE
.;
.;
.;  Print preliminary text information
.;
     ;
     ; ===========================================================
     ;        LABSTATION 23 Network Configuration Procedure
     ;           Started at '<TIME>' on '<DATE>'
     ; ===========================================================
     ;
     ;
     ;  One moment please, scanning your system...
     ;
     ;
.;
.;
.;  Determine host (use DECnet/RSX codes)
.;
	.SETN $TSYS 4
	.IF <SYSTEM> = 1 .SETN $TSNUM 1		! Host is 11M
	.IF <SYSTEM> = 6 .SETN $TSNUM 2		! Host is 11M+
	.IF <SYSTEM> = 5 .SETN $TSNUM 4		! Host is VAX/VMS
.;
	.IF $TSNUM = 1 .SETS $TSSTR "RSX-11M"
	.IF $TSNUM = 2 .SETS $TSSTR "RSX-11M+"
	.IF $TSNUM = 4 .SETS $TSSTR "VAX/VMS"
.;
	.SETF $RSX
	.SETF $VMS
	.IF $TSNUM = 1 .SETT $RSX
	.IF $TSNUM = 2 .SETT $RSX
	.IF $TSNUM = 4 .SETT $VMS
.;
	.IFT $VMS .GOTO I004
     ;
     ;
     ;  Sorry, this procedure does not run under '$TSSTR'.
     ;
     ;
	.GOTO X994
.I004:
	.IFF $VMS .GOTO X015
.;
.;  Extract host node name
.;
	.SETS NODNAM "'F$LOGICAL("SYS$NODE")'"
	.TEST NODNAM
	.IF <STRLEN> NE 0 .GOTO I007
     ;
     ;  DECnet is not currently active on your VAX/VMS host.
     ;  This procedure requires DECnet information.  Please start
     ;  DECnet on your host and then re-run this procedure.
     ;
	.GOTO X994
.I007:
	.PARSE NODNAM "_:" N1 $HOST N2
.X015:
.;
.;  Extract the host node number
.;
	.OPEN #1 HSTNODE.TMP
	.IFT $VMS .DATA #1 RUN SYS$SYSTEM:NCP
	.DATA #1 SHOW EXECUTOR CHARACTERISTICS
	.DATA #1 EXIT
	.CLOSE #1
	.IFT $VMS @HSTNODE.TMP/OUTPUT=HSTNODE.DAT
.;
.;
	.OPENR #2 HSTNODE.DAT
.;
	.SETS SUBSTR "node ="
.L10:
	.READ #2 LINE
	.IF <FILERR> NE 1 ;ERROR WHILE SEARCHING FOR HOST NODE ADDRESS
.;
	.IFT $VMS .SETN X 'F$LOCATE(SUBSTR,LINE)
	.TEST LINE
	.IF <STRLEN> EQ X .GOTO L10
.;
.;  We have the node line. Extract the number and name.
.;
	.SETS LINE LINE[X+7:<STRLEN>]
	.TEST LINE
	.SETN X 1.
.L30:
	.IF X GT <STRLEN> ; ERROR WHILE SEARCHING FOR HOST NODE NUMBER
	.SETS CHAR LINE[X:X]
	.IF CHAR NE " " .GOTO L40
	.INC X
	.GOTO L30
.;
.L40:
.;
.;  X points to first digit of node number.
.;

	.SETS LINE LINE[X:<STRLEN>]
	.PARSE LINE " " $HTNUM REST
.;
.;  Get the max address for the host.
.;
	.SETS SUBSTR "Maximum address"
.L50:
	.READ #2 LINE
	.IF <FILERR> NE 1 ;ERROR WHILE SEARCHING MAX ADDRESS
.;
	.IFT $VMS .SETN X 'F$LOCATE(SUBSTR,LINE)
	.TEST LINE
	.IF <STRLEN> EQ X .GOTO L50
.;
.;  We have the max address line. Extract the number.
.;
	.SETS SUBSTR "="
	.IFT $VMS .SETN X 'F$LOCATE(SUBSTR,LINE)
	.TEST LINE
	.SETS LINE LINE[X+2.:<STRLEN>]
	.TEST LINE
	.SETN X 1.
.L55:
	.IF X GT <STRLEN> ; ERROR WHILE SEARCHING FOR MAX ADDRESS
	.SETS CHAR LINE[X:X]
	.IF CHAR NE " " .GOTO L60
	.INC X
	.GOTO L55
.;
.L60:
.;
.;  X points to first digit of maximum address.
.;

	.SETS LINE LINE[X:<STRLEN>]
	.PARSE LINE " " $MXADR REST
.;
	.CLOSE #2
.;
.;
.;  Find out number of host DMP's
.;
	.OPEN #1 DMP.TMP
	.IFT $VMS .GOTO X020
.X020:
.;
.;  Under VMS, use SHO DEV to get device mnemonics for DMP's (XDxx)
.;
	.DATA #1 SHO DEV XD
	.CLOSE #1
	@DMP.TMP/OUTPUT=DMP.DAT
.;
.;  Parse the output and find the number of DMP's
.;
	.SETN DMPCNT 0
	.OPENR #1 DMP.DAT
.L010:
	.READ #1 LINE
	.IF <FILERR> NE 1 .GOTO L020
	.PARSE LINE "XD0" N1 N2 CONTR N3
	.TEST CONTR
	.IF <STRLEN> <> 0 .INC DMPCNT
	.GOTO L010
.L020:
	.CLOSE #1
.;
.;
	.IF DMPCNT NE 0 .GOTO X040
     ;
     ;  No DMP devices were found.  You must have installed a DMP11
     ;  on your VMS system to use LABSTATION 23. DMP11 devices have
     ;  the VMS device mnemonic XDx0.  These should appear on the 
     ;  display from a SHO DEVICES XD command.
     ;
	.GOTO X992
.X040:
.;
.;
.;  Print results from system scanning
.;
     ;
     ;   Host system is '$TSSTR'.
     ;   Node name is '$HOST'.
     ;   Node address is '$HTNUM'.
     ;   Maximum node address is '$MXADR'.
	.IF DMPCNT EQ 1 ;   1 DMP device is installed.
	.IF DMPCNT GT 1 ;   'DMPCNT' DMP devices are installed.
     ;
.;
.;  Give the user any preliminary comments
.;
     ;
     ;
     ;  This procedure establishes the DECnet database and system
     ;  files on the host system for LABSTATION 23 nodes.
     ;
     ;  To continue with this procedure, you must have completed the
     ;  the sysgen and netgen phases of LABSTATION 23 installation.
     ;
	.ASK Q Have you completed sysgen and netgen phases
	.IFF Q .GOTO X992
     ;
     ;   During the following dialog, you may obtain additional 
     ;   information by typing ESC in response to any question.
     ;
.;
.;  Check for necessary tasks (RSX only, PIP)
.;
	.IFT $VMS .GOTO X010
.X010:
.;
.;  General database parameters setup
.;
     ;
     ; ==========================================================
     ;     Section 1:
     ;
     ;                 Preliminary information
     ; ==========================================================
.;
	.IFF $VMS .GOTO I010
.;
.;  Decode the device and UIC where the LABSTATION 23 system files
.;  resides.
.;
	.SETS $RMDIR "'F$LOGICAL("SYS$LS23")'"
	.IF $RMDIR NE "" .GOTO X020
     ;
     ;  The location of the LABSTATION 23 system files is not defined
     ;  with the logical name SYS$LS23 Please assign the
     ;  location to this logical name and rerun this procedure.
     ;
	.GOTO X992
.;
.X020:
	.PARSE $RMDIR ":" $RMDEV $RMUIC
	.SETS $RMDEV "'$RMDEV'"+":"
	.GOTO X007
.I010:
     ;
     ;  During the sysgen and netgen procedures for LABSTATION 23,
     ;  you specified a target device and UIC for the generated 
     ;  system files.
     ;
	.ASKS [3:3] RMDEV What was the target device during sysgen and netgen
	.IFT <ESCAPE> .GOTO I010
	.ASKS RMUIC What was the UIC specified
	.IFT <ESCAPE> .GOTO I010
.;
	.TEST RMDEV
	.SETS CHAR RMDEV[<STRLEN>:<STRLEN>] 
	.IF CHAR NE ":" .SETS RMDEV "'RMDEV'"+":"
	.TESTFILE 'RMDEV''RMUIC'RMMAST.SYS
	.IF <FILERR> EQ 1 .GOTO X005
.;
.;  Here if error detected while looking for image file.
.;
     ;
     ;  An error was detected while trying to access needed files
     ;  on 'RMDEV''RMUIC'.
     ;
     ;  These files in the requested location are required
     ;  for this procedure.  Please confirm the location requested
     ;  in the following question.
     ;
	.GOTO I010
.X005:
	.SETS $RMDEV "'RMDEV'"
	.SETS $RMUIC "'RMUIC'"
	.SETS $RMDIR "'RMDEV''RMUIC'"
.X007:
.;
     ;
     ;  Most networks establish transmit and receive passwords
     ;  that are interchanged between systems when connections 
     ;  are initialized.  For convenience, the transmit password
     ;  is the same as the receive password.  The password may be
     ;  up to 8 characters in length.
     ;
	.SETS PWD ""
	.ASKS [0:8.] PWD What is the transmit/receive password
     ;
     ;
     ;  Your host node should have privileged and nonprivileged
     ;  accounts established that allow nodes to default access 
     ;  control information.  This allows LABSTATION 23 nodes to
     ;  request tasks to be downline loaded.
     ;
	.ASKS [0.:15.] PRIVU What is the privileged account username
	.ASKS [0.:15.] PRIVP What is the privileged account password
     ;
	.ASKS [0.:15.] NPRIVU What is the nonprivileged account username
        .ASKS [0.:15.] NPRIVP What is the nonprivileged account password
     ;
     ;
     ;
     ; ===========================================================
     ;		Section 2:
     ;
     ;            LABSTATION 23 - host configuration
     ; ===========================================================
     ;
     ;
.;
.; Establish DECnet permanent database configuration file
.;
	.SETN MAXDMP DMPCNT-1
	.SETN DMPCNT 0
.;
	.OPEN #1 RMCONF.CMD
	.IFT $VMS .DATA #1 RUN SYS$SYSTEM:NCP
.;
	.OPEN #2 NODES.DAT		! used later to update HLD.DAT
.X050:
     ;
	.ASK Q Should DMP-'DMPCNT' be configured as a LABSTATION 23 controller
     ;
	.IFF <ESCAPE> .GOTO I055
     ;
     ;  DMP11's that will control LABSTATION 23's must be configured as
     ;  multipoint masters.  Answering yes to this question will 
     ;  establish the needed operational parameters for DMP-'DMPCNT'.
     ;
	.GOTO X050
.I055:
	.IFF Q .GOTO X060
.I060:
     ;
	.ASKN [1.:12.:1.] NUMSTA How many stations are connected to DMP-'DMPCNT'
     ;
	.IFF <ESCAPE> .GOTO I065
     ;
     ;  This question establishes the number of circuits necessary 
     ;  to connect to each of the LABSTATION 23 nodes from the host 
     ;  via device DMP-'DMPCNT'.  
     ;
	.GOTO I060
.I065:
.;
.;  Define the line parameters
.;
	.DATA #1 !
	.DATA #1 PURGE LINE DMP-'DMPCNT' ALL
	.IFT $VMS .DATA #1 DEFINE LINE DMP-'DMPCNT' PROTOCOL DDCMP CONTROL -
	.IFT $VMS .DATA #1 RECEIVE BUFFERS 8 SERVICE TIMER 3000 -
	.IFT $VMS .DATA #1 DEAD TIMER 10000 RETRANSMIT TIMER 200 -
	.IFT $VMS .DATA #1 SCHEDULING TIMER 50 STREAM TIMER 1000
	.DATA #1 DEFINE LINE DMP-'DMPCNT' DUPLEX FULL STATE ON
.;
.;
.;  This is the beginning of node/circuit definition loop.
.;
	.SETN STACNT 1.
.X080:
.;
.;  Establish database entry for the node
.;
.I067:
     ;
	.ASKN [1.:'$MXADR'] NODNUM What is the node number of DMP-'DMPCNT', station 'STACNT'
     ;
	.IFF <ESCAPE> .GOTO I070
     ;
     ;  Each node in your network (host + LABSTATION 23 stations +
     ;  other machines connected via DECnet) must have a 
     ;  unique node number.  Enter a number in the range 1 to 255.
     ;
	.GOTO I067
.I070:
	.ASKS [1:6] NODNAM What is the node name of DMP-'DMPCNT', station 'STACNT'
	.IFF <ESCAPE> .GOTO I080
     ;
     ;  Each node in your network (host + LABSTATION 23 stations +
     ;  other machines connected via DECnet) has a unique name by 
     ;  which other nodes may reference it.  Enter a one to six
     ;  character name.
     ;
	.GOTO I070     
.I080:
.;
.;  Calculate the tributary address
.;
	.SETN TRIB (12.*DMPCNT)+STACNT
.;
.;  Create the system image load file name
.;
	.SETS TRBSTR "'TRIB'"
	.IF TRIB < 10. .SETS TRBSTR "0"+TRBSTR
	.SETS SYSIMG "RM'DMPCNT''TRBSTR'"
.;
.;  Create the service password
.;
	.SETS HEX "0123456789ABCDEF"
	.SETN X 'TRIB'.
	.SETN D1 X/16.
	.SETN D2 X-(16.*D1)
	.SETS H1 HEX[D1+1:D1+1]
	.SETS H2 HEX[D2+1:D2+1]
	.SETS SERPWD "'H1''H2''H1''H2''H1''H2''H1''H2'"
.;
.;
.;  Define the circuit parameters.  One circuit per LABSTATION 23
.;  station.
.;
	.DATA #1 !
	.DATA #1 PURGE CIRCUIT DMP-'DMPCNT'.'STACNT' ALL
	.IFT $VMS .DATA #1 DEFINE CIRCUIT DMP-'DMPCNT'.'STACNT' COST 1 -
	.IFT $VMS .DATA #1 SERVICE ENABLED TRIBUTARY 'TRIB'
	.DATA #1 DEFINE CIRCUIT DMP-'DMPCNT'.'STACNT' STATE ON
.;
.;  Define the node parameters.
.;
	.DATA #1 !
	.DATA #1 PURGE NODE 'NODNUM' ALL
	.DATA #1 DEFINE NODE 'NODNUM' NAME 'NODNAM'
	.IFT $VMS .DATA #1 DEFINE NODE 'NODNUM' CPU PDP11 -
	.IFT $VMS .DATA #1 LOAD FILE '$RMDIR''SYSIMG'.SYS -
	.IFT $VMS .DATA #1 SECONDARY LOADER SECDMV TERTIARY LOADER TERDMV -
	.IFT $VMS .DATA #1 RECEIVE PASSWORD 'PWD' TRANSMIT PASSWORD 'PWD' -
	.TEST NPRIVU
	.IFT $VMS .IF <STRLEN> NE 0 .DATA #1 NONPRIVILEGED USER 'NPRIVU' -
	.TEST NPRIVP
	.IFT $VMS .IF <STRLEN> NE 0 .DATA #1 NONPRIVILEGED PASSWORD 'NPRIVP' -
	.TEST PRIVU
	.IFT $VMS .IF <STRLEN> NE 0 .DATA #1 PRIVILEGED USER 'PRIVU' -
	.TEST PRIVP
	.IFT $VMS .IF <STRLEN> NE 0 .DATA #1 PRIVILEGED PASSWORD 'PRIVP' -
	.IFT $VMS .DATA #1 SERVICE CIRCUIT DMP-'DMPCNT'.'STACNT' -
	.IFT $VMS .DATA #1 SERVICE PASSWORD 'SERPWD'
.;
.;  We will need to update the LABSTATION 23 images with updated copies
.;  of the host node list.  But first we must update the list with these
.;  new nodes.  So save information needed for later in a file.
.;
	.DATA #2 'NODNAM' 'NODNUM' 'TRIB' 'SYSIMG'
.;
.;  If there are more stations on this DMP, go process them.
.;
	.INC STACNT
	.IF STACNT LE NUMSTA .GOTO X080
.;
.X060:
.;
.;  If there are more DMP's, go process them.
.;
	.INC DMPCNT
	.IF DMPCNT LE MAXDMP .GOTO X050
	.CLOSE #1
	.CLOSE #2
.;
.;
.;  End of node specification loop.
.;
.;
     ;
     ;
     ;  All LABSTATION 23 nodes have been defined.  The network 
     ;  database will now be updated and the system images for the 
     ;  LABSTATION 23 nodes will be created.
     ;
	.ASK Q Are you ready to continue
	.IFF Q .GOTO X992
.;
.;  At this point, we update the DECnet permanent data base on the 
.;  host with the node information for LABSTATION 23's.
.;
     ;
     ;  Updating the host DECnet permanent data base...
     ;
	@RMCONF.CMD
.;
.;  Now we have an up to date database of system nodes 
.;  + new LABSTATION 23 nodes.  Create a node list for use 
.;  by VNP to update the system images.
.;
.;
.;  Get node list from the host
.;
	.OPEN #1 HSTNODES.TMP
	.IFT $VMS .DATA #1 RUN SYS$SYSTEM:NCP
	.DATA #1 LIST KNOWN NODES
	.DATA #1 EXIT
	.CLOSE #1
	.IFT $VMS @HSTNODES.TMP/OUTPUT=RMNODES.TMP
.;
.;  Extract the node numbers and names and put them in VNP command 
.;  format.
.;
	.OPEN #1 RMNODES.CMD
	.OPENR #2 RMNODES.TMP
	.SETS SUBSTR "node ="
.L210:
	.READ #2 LINE
	.IF <FILERR> NE 1 .GOTO L300
	.SETS NUMSTR ""
	.SETS NODNAM ""
.;
	.IFT $VMS .SETN X 'F$LOCATE(SUBSTR,LINE)
	.TEST LINE
	.IF <STRLEN> EQ X .GOTO L210
.;
.;  We have a node line. Extract the number and name.
.;
.L222:
	.SETS LINE LINE[X+7:<STRLEN>]
.;
	.TEST LINE
	.SETN X 1.
.L230:
	  .IF X GT <STRLEN> .GOTO L250
	.SETS CHAR LINE[X:X]
	.IF CHAR NE " " .GOTO L240
	.INC X
	.GOTO L230
.;
.L240:
.;
.;  X points to first digit of node number.
.;

	.SETS LINE LINE[X:<STRLEN>]
	.PARSE LINE " " NUMSTR REST
.;
.;  now extract the node name delimited by parenthesis
.;
	.PARSE REST "()" N1 NODNAM REST
.;
.L250:	.DATA #1 SET NODE 'NUMSTR' NAME 'NODNAM'
	.GOTO L210

.L300:
	.CLOSE #1
	.CLOSE #2
.;
.;  We are now ready to complete the system images for each of the
.;  LABSTATION 23 nodes.
.;
.;  Assign logicals for this part of the process
.;
	.SETS SAVDIR "'<UIC>'"
	.IFT $VMS .SETS SAVDEV "'F$LOGICAL("SYS$DISK")'"
	.IFT $VMS .SETS SAVUIC "'F$USER()'"
	ASN '$RMDEV'=SY:
	ASN '$RMDEV'=SY0:
	ASN '$RMDEV'=LB:
	ASN '$RMDEV'=LB0:
	SET DEF '$RMDIR'
	SET UIC '$RMUIC'
.;
.;  The sysgen/netgen procedure supplied all task images and symbol tables
.;  in the LABSTATION 23 location.  Create the master system image.
.;
     ;
     ;  Creating the master LABSTATION 23 system image.
     ;
.;
	.IFT $VMS ASN '$RMDIR'11MVMR.TSK = VMR
	.TESTFILE RMMAST.SYS
	.IF <FILERR> NE 1 .GOTO X90
	DEL RMMAST.SYS;0,RMMAST.STB;0
.X90:
	COPY /CONTIGUOUS /ALLOC:386. RSX11S.TSK RMMAST.SYS
	COPY RSX11S.STB RMMAST.STB
.;
.;  Create the VMR command file. Note that any tasks not "FIXed" here
.;  must appear in the generalized task section update later in this 
.;  procedure.
.;
	.OPEN #1 RMVMR.TMP
.ENABLE DATA #1
RMMAST
!
!  This section contains all the 11S components.
!
SET /MAIN=CEXPAR:737:41:COM
SET /POOL=*
SET /MAIN=TTPAR:*:157:TASK
LOA TT:
SET /MAIN=EXCOM1:*:200:COM
INS EXCOM1
SET /MAIN=EXCOM2:*:200:COM
INS EXCOM2
SET /MAIN=SYSPAR:*:32.:TASK
INS TKN
FIX TKTN
SET /MAIN=MCRPAR:*:96.:TASK
INS BASMCR
FIX MCR...
SET /MAIN=GEN:*:*:SYS
INS RSDV1H/CKP=NO/PAR=GEN
SET /MAIN=KPAGE:7600:200:DEV
INS KPAGE
SET /VT100=TT0:
SET /LOWER=TT0:
!
!  This section contains all the DECnet/11S components.
!
SET /NETUIC='$RMUIC'
INS NTINIT
FIX NTINIT
INS NETACP
FIX NETACP
INS RMHACP/CKP=NO
FIX RMHACP
INS EVP
FIX EVP...
INS SLD
FIX LDR...
LOA OV:
LOA HT:
LOA NM:
INS EVC
FIX EVC...
!
!  Install any network tasks that do not need to be resident.
!
INS NCP/TASK=NCP/CKP=NO/PAR=GEN
INS MIR/CKP=NO/PAR=GEN
INS NICE/CKP=NO/PAR=GEN
!
!INS RMT/TASK=RMT/PAR=GEN
!INS RMTACP/CKP=NO/PAR=GEN
!
!  Install any generalized tasks here.
!
INS SETTD	! Set time and date task.
!
.DISABLE DATA #1
.;
	.CLOSE #1
.;
.;  Suppress VMR informational messages and invoke VMR.
.;
;	.IFT $VMS ASN NL:=SYS$OUTPUT
	VMR @RMVMR.TMP
	.SETN STATUS '<EXSTAT>'
	.IFT $VMS ASN TT:=SYS$OUTPUT
	DEL RMVMR.TMP;0
	.IF STATUS EQ 0 .GOTO X98	! Warnings are expected.
	.IF STATUS EQ 1 .GOTO X98
     ;
     ;  An error was detected during VMR of the master system image.
     ;
	.GOTO X990
.;
.;
.;  We need to create an image for each of the nodes listed in NODES.DAT.
.;
.X98:
	.OPENR #1 'SAVDEV''SAVDIR'NODES.DAT
.X100:
	.READ #1 LINE
	.IF <FILERR> NE 1 .GOTO X150
.;
	.PARSE LINE "   " NODNAM NODNUM TRIB SYSIMG
     ;
     ;  Creating a system image file for node 'NODNAM'.
     ;
.;
.;  First create a copy from the template image with the correct name
.;
	.TESTFILE 'SYSIMG'.SYS
	.IF <FILERR> NE 1 .GOTO X110
	DEL 'SYSIMG'.SYS;*,'SYSIMG'.STB;*
.X110:	COPY RMMAST.SYS 'SYSIMG'.SYS 
	COPY RMMAST.STB 'SYSIMG'.STB 
	.IFT $VMS SET PROT=WORLD:RWE 'SYSIMG'.SYS,'SYSIMG'.STB
.;
.;  Modify the executor using CFE
.;
	.OPEN #3 CFE.TMP
	.DATA #3 ASN NL:=SYS$OUTPUT
	.DATA #3 RUN '$RMDIR'CFE.TSK
	.DATA #3 CETAB.MAC
.;
.; DEBUG
.; The following system parameters are added to tune the LABSTATION 23 image.
.;
	.DATA #3 DEFINE EXEC MAX LOGICAL LINKS 15
	.DATA #3 DEFINE SYS MAX CONTROL BUFFERS 16
	.DATA #3 DEFINE SYS MAX SMALL BUFFERS 16
	.DATA #3 DEFINE SYS MAX LARGE BUFFERS 16
	.DATA #3 DEFINE SYS POOL BYTE AREA 1000
 	.DATA #3 DEFINE SYS MINIMUM RECEIVE BUFFERS 4
.;
.;
	.DATA #3 DEFINE EXEC ADDR 'NODNUM' NAME 'NODNAM' HOST '$HTNUM'
	.DATA #3 DEFINE EXEC MAX ADDRESS '$MXADR'
	.DATA #3 DEFINE CIRC DMV-0 TRIBUTARY 'TRIB' STATE ON
	.DATA #3 EXIT
	.CLOSE #3
	@CFE.TMP
	DEL CFE.TMP;0
.;
.;  Use VNP to set the network in the image
.;
	.OPEN #3 VNP.TMP
	.DATA #3 ASN NL:=SYS$OUTPUT
	.DATA #3 RUN '$RMDIR'VNP.TSK
	.DATA #3 'SYSIMG'.SYS
	.DATA #3 SET SYSTEM
	.DATA #3 EXIT
	.CLOSE #3
	@VNP.TMP
	DEL VNP.TMP;0
.;
.;
.;  Now use VNP to establish the node list and 
.;  set the network on in the image.
.;
	.OPEN #3 VNP.TMP
	.DATA #3 ASN NL:=SYS$OUTPUT
	.DATA #3 RUN '$RMDIR'VNP.TSK
	.DATA #3 'SYSIMG'.SYS
	.IF PWD NE "" .DATA #3 SET EXEC TRANS PASS 'PWD' REC 'PWD'
.;
.;  Copy the node list into the VNP file
.;
	.OPENR #2 'SAVDEV''SAVDIR'RMNODES.CMD
.X120:	
	.READ #2 LINE
	.IF <FILERR> NE 1 .GOTO X130
	.DATA #3 'LINE'
	.GOTO X120
.X130:	.CLOSE #2
.;
	.DATA #3 SET EXEC STA ON
	.DATA #3 EXIT
	.CLOSE #3
	@VNP.TMP
	DEL VNP.TMP;0
.;
.;
	.GOTO X100
.X150:
.;
.;  Here for end of nodes processing on the system images
.;
	.CLOSE #1
	ASN TT:=SYS$OUTPUT
	SET UIC 'SAVUIC'
	SET DEF 'SAVDEV''SAVDIR'
.;
.;
.;  We now need to update the host loader tables with new entries 
.;  for the LABSTATION 23 nodes.
.;
.;  Create a file with the known generalized tasks every node can
.;  use.
.;
	.OPEN #1 GENTSK.DAT
.ENABLE DATA #1
HTASK$ NCP,<'$RMDIR'NCP.TSK>,LUN
HTASK$ NIC...,<'$RMDIR'NICE.TSK>,LUN
HTASK$ MIR...,<'$RMDIR'MIR.TSK>,LUN
HTASK$ RSDV1H,<'$RMDIR'RSDV1H.TSK>,LUN
HTASK$ SETTD,<'$RMDIR'SETTD.TSK>,LUN
.DISABLE DATA #1
	.CLOSE #1
.;
.;  If the loader tables do not exist, then we create them.
.;
	.TESTFILE SYS$SYSTEM:HLD.DAT
	.IF <FILERR> NE 1 .GOTO X300
     ;
     ;
     ;  Updating the host loader tables...
     ;
.;
.;  Create a SLP file to update the host loader table.
.;
	.OPEN #3 RMSLP.TMP
	.IFT $VMS .DATA #3 SYS$SYSTEM:HLD.DAT/-AU=SYS$SYSTEM:HLD.DAT
	.DATA #3 -/HLDTB$/
.;
.;  For each of the generalized tasks, see if the host loader table
.;  already knows about them as generalized tasks.  If not, put it in 
.;  the SLP file.
.;
	.OPENR #1 GENTSK.DAT
.L400:
	.READ #1 TSKLIN
	.IF <FILERR> NE 1 .GOTO L450
	.PARSE TSKLIN " ," N1 TSKNAM REST
	.SETF FOUND
.L410:
	.IFT $VMS .OPENR #2 SYS$SYSTEM:HLD.DAT
.L420:
	.READ #2 LINE
	.IF <FILERR> NE 1 .GOTO L440
.;
.;  if we encounter a node specification, we are done with the generalized
.;  task section.
.;
	.IFT $VMS .SETN X 'F$LOCATE("HNODE$",LINE)
	.TEST LINE
	.IF <STRLEN> NE X .GOTO L440
.;
.;  Is it a task definition line?
.;
	.IFT $VMS .SETN X 'F$LOCATE("HTASK$",LINE)
	.TEST LINE
	.IF <STRLEN> EQ X .GOTO L420
.;
.;  Yes. Extract the task name.
.;
	.PARSE LINE " ," N1 OLDTSK REST
	.IF TSKNAM NE "'OLDTSK'" .GOTO L420
.;
.;  Task name matches.
.;
	.SETT FOUND
.L440:
	.CLOSE #2
	.IFF FOUND .DATA #3 'TSKLIN'
	.GOTO L400
.L450:
.;
.;  Done searching for generalized tasks.
.;
	.CLOSE #1
.;
.;  Prepare to add new nodes to the end of the host loader table.
.;
	.DATA #3 -/.END/,.
.;
.;  Now search the host loader tables looking for the node new node
.;  names.  If they don't exist, add them to the SLP file.
.;
	.OPENR #1 NODES.DAT
.;
.L100:
	.READ #1 LINE			! GET THE NEWLY DEFINED NODE NAME
	.IF <FILERR> NE 1 .GOTO L200
	.PARSE LINE " " NEWNOD REST
.;
	.IFT $VMS .OPENR #2 SYS$SYSTEM:HLD.DAT
	.SETF FOUND
.;
.L110:
	.READ #2 LINE			! IS THIS A NODE DEFINITION LINE?
	.IF <FILERR> NE 1 .GOTO L190
	.IFT $VMS .SETN X 'F$LOCATE("HNODE$",LINE)
	.TEST LINE
	.IF <STRLEN> EQ X .GOTO L110
.;
.;  It is a node definition line.  Is our current node name there?
.;
	.IFT $VMS .SETN X 'F$LOCATE(NEWNOD,LINE)
	.IF <STRLEN> EQ X .GOTO L110
.;
.;  Yes. Indicate it was found.
.;
	.SETT FOUND
.;
.L190:
	.CLOSE #2
	.IFT $VMS .IFF FOUND .DATA #3 HNODE$ 'NEWNOD'
	.GOTO L100
.L200:
	.CLOSE #1
.;
.;  Any new nodes not found in the host loader tables have been added
.;  to the SLP file.  We can now close the SLP file and update the 
.;  host loader table.
.;
	.DATA #3 .END
	.DATA #3 /
	.CLOSE #3
	SLP @RMSLP.TMP
	DEL RMSLP.TMP;0
	.IFT $VMS SET PROT=WORLD:RWE SYS$SYSTEM:HLD.DAT
	.GOTO X990
.;
.X300:
.;
.;  Here for creating a new host loader table.
.;
;
;  Creating host loader table...
;
.;
	.IFT $VMS .OPEN #3 SYS$SYSTEM:HLD.DAT
	.DATA #3 HLDTB$
.;
.; Add the generalized tasks
.;
	.OPENR #1 GENTSK.DAT
.L500:
	.READ #1 TSKLIN
	.IF <FILERR> NE 1 .GOTO L550
	.DATA #3 'TSKLIN'
	.GOTO L500
.L550:
	.CLOSE #1
.;
.;  Add new nodes to the host loader table.
.;
	.OPENR #1 NODES.DAT
.;
.L570:
	.READ #1 LINE			! GET THE NEWLY DEFINED NODE NAME
	.IF <FILERR> NE 1 .GOTO L600
	.PARSE LINE " " NEWNOD REST
.;
	.DATA #3 HNODE$ 'NEWNOD'
	.GOTO L570
.L600:
	.CLOSE #1
.;
.;  All tasks and nodes have been added to the host loader table.
.;
	.DATA #3 .END
	.CLOSE #3
	.IFT $VMS SET PROT=WORLD:RE SYS$SYSTEM:HLD.DAT
.;
.;
.X990:
.;
.;  All processing is complete.  Clean up unneeded files.
.;
.;
.;  The nodes data file is used by the development procedure.
.;
	COPY NODES.DAT '$RMDIR'RMNODES.DAT
	.IFT $VMS SET PROT=WORLD:R '$RMDIR'RMNODES.DAT
	.IFT $VMS PURGE '$RMDIR'RMNODES.DAT /KEEP=3
	.IFT $VMS DELETE NODES.DAT;0
.;
	.IFT $VMS PURGE '$RMDIR'CETAB.MAC /KEEP=3
	.IFT $VMS PURGE SYS$SYSTEM:HLD.DAT /KEEP=3
	DEL RMNODES.CMD;0,RMNODES.TMP;0,HSTNODES.TMP;0
	DEL GENTSK.DAT;0
	DEL RMCONF.CMD;0
     ;
     ;
     ;  When the command procedure is finished, stop then restart
     ;  DECnet on the host system.  New parameters in permanent 
     ;  database will then take effect.
     ;
.X992:
	DEL DMP.DAT;0,DMP.TMP;0
	DEL HSTNODE.DAT;0,HSTNODE.TMP;0
.X994:
.;
.;  Entry point for scanning errors or negatively answered questions.
.;
     ;
     ; ===============================================================
     ;    End of LABSTATION 23 configuration procedure at '<TIME>'.
     ; ===============================================================
     ;
	.EXIT
