.;
.;
.;	MODULE DESCRIPTION:
.;
.;	TITLE:LABSTATION 23 GENERATION ROUTINE 
.;
.; This routine:
.;	1. copies the RSX11S distribution to the target device 
.;	3. initiates the system generation
.;	
.;
.;	The routine distinguishes between a VAX/VMS host and an PDP host
.;
.;
.;
.;	Version number: 1.0
.;	Author:		T.A.Turano
.;	Date:		1-November-1982
.;	Edit history:   none
.;
.;
	.ENABLE SUBSTITUTION
	.ENABLE ESCAPE
	.ENABLE GLOBAL
	.DISABLE LOWERCASE
.;
.; Host machine determination:
.;
	.SETN h$sys 4			! assume VAX/VMS
	.IF <system> = 1 .SETN h$sys 1	! 11M host
	.IF <system> = 6 .SETN h$sys 2	! 11M+ host
	.IF <system> = 5 .SETN h$sys 4  ! VAX/VMS host
.;	
	.IF <system> = 1 .SETS h$str "RSX-11M"	! 11M host
	.IF <system> = 6 .SETS h$str "RSX-11M+"	! 11M+ host
	.IF <system> = 5 .SETS h$str "VAX/VMS"	! VAX/VMS host
.;
	.SETS u$uic <uic>		! get the initial uic
;
;=====================================================
;	This is the LABSTATION 23 generation program.
;	               Version 1.0
;
;	    Generation begun '<DATE>' at '<TIME>'
;		on host system 'h$str'
;=====================================================
;
.;
.;	begin by getting the device information
.;
;=====================================================
;	Section 1:
;
;	LABSTATION 23 device information
;=====================================================
;
.;
.;	check system type, if VMS check logical assignment
.;
	.IF h$sys EQ 4 .GOTO rm001
.rm001:
	.SETS $RMLOC "'F$LOGICAL("SYS$LS23")'"
	.IF $RMLOC NE "" .GOTO td0015
.rm002:
	.ASKS logdev What is the device and UIC for LABSTATION 23
	.SETS chrchk logdev[<strlen>:<strlen>] ! check last character
	.IF chrchk EQ "]" .GOTO rm005 ! see if a UIC is included
;
;	There is no default for the LABSTATION 23 logical assignment.
;	You must specify both the device and UIC together. 
;	For example: DR0:[3,64]  The question must be answered.
;
	.GOTO rm002
.rm005:
	ASN 'logdev'=SYS$LS23
;
;=====================================================
;	Target device information section
;=====================================================
.;
.;	get the target device
.;
.td0015:
	.ASKS logtrg What is the target physical device
	.IF logtrg NE "" .GOTO td0020
;
;	There is no default for the target device. 
;	The question must be answered.
;
	.GOTO td0015
.;
.;	check the target device specified for validity
.;	and get its volume label
.;
.td0020:
	.SETS rmtarget "'f$logical(logtrg)'"
	.IF rmtarget EQ "" .SETS rmtarget logtrg
	.SETS chrchk rmtarget[<strlen>:<strlen>] ! check last character
	.IF chrchk EQ "]" .GOTO .td0025
	.IF chrchk NE ":" .SETS rmtarget "'rmtarget'"+":"!make last char :
	.GOTO td0030
.td0025:
;
;	A physical device was not specified. There can be NO UIC associated
;	with the device. Specify either a PHYSICAL DEVICE MNEMONIC OR A
;	LOGICAL REPRESENTING STRICTLY A PHYSICAL DEVICE.
	.GOTO td0015
.td0030:
.;
.;	check to see if it is mounted
.;
	.ASK answ Is the device mounted
	.IFT answ .GOTO td0200
.td0040:
	.ASKS[1:6] tarid What is the volume label for the target device
.;
.;	attempt to mount the device
.;
	.IF h$sys EQ 4	.GOTO td0045	! if its a vax may mount device shared
	.ONERR td0050			
	MOU 'rmtarget' 'tarid' 
	.GOTO td0200
.td0045:
	.ONERR td0050			
	MOU 'rmtarget' 'tarid' /shared
	.GOTO td0200			! target mounted successfully
.;
.td0050:
;
;	Unable to mount the target device either due to invalid
;	device or volume identification.
;
	.ASK answ Do you wish to specify another target device and continue
	.IFT answ .GOTO td0015
	.GOTO trm050
.td0200:
;=====================================================
;	Section 2:
;
;	SYSTEM distribution information section
;=====================================================
.;
.;	the part of the LABSTATION 23 generation invokes the
.;	system generation distribution
.;
;
;	This next segment of the LABSTATION 23 generation copies
;	the system distribution to the target disk.
;
.;
.;	system distribution information
.;
.rsx020:
.;
.; 	acquired information about the distribution
.;
	.ASKS rsxdis What device contains the system distribution
	.IF rsxdis NE "" .GOTO rsx030
;
;	There is no default for the distribution device on an 'h$str' system.
;	
	.GOTO rsx020
.;
.;	check for device name completeness
.;
.rsx030:
	.SETS chrchk rsxdis[<strlen>:<strlen>] ! check last character
	.IF chrchk NE ":" .SETS rsxdis "'rsxdis'"+":" ! make last char : if not
.;
.;	check if distribution is a tape drive with variable density
.;
	.SETS chrchk rsxdis[1:2]		
	.IF chrchk EQ "MF" .GOTO rsx040		! if TU78, TE16, TU45, or TU7 
	.IF chrchk EQ "MT" .GOTO rsx040		!   get the density
	.IF chrchk EQ "MS" .GOTO rsx045		! if it is TS11, density 1600
	.SETS chrchk rsxdis[1:1]		
	.IF chrchk EQ "D" .GOTO rsx100		! if not tape is it disk
;
;	The device specified is not valid for a distribution device.
;
	.GOTO rsx020
.;
.;	get the density for these tapes from the operator
.;
.rsx040:
	.ASKS[3:4] dens What is the density of the tape
	.GOTO rsx060
.rsx045:
	.SETS dens "1600"
	.GOTO rsx060
.;
.;	mount the tape distribution
.;
.rsx060:
;
;	Load the system distribution tape in the tape drive.
;	
	.ASK answ Is the tape loaded
	.IFF answ .GOTO rsx060
	.ONERR rsx125
	MOU 'rsxdis'/for/density='dens'
	.SETN r$dist 1
	.GOTO rsx200
.;
.;	mount the disk distribution
.;
.rsx100:
;
;	Load the system distribution in the disk drive.
;	
	.ASK answ Is the distribution loaded
	.IFF answ .GOTO rsx100
	.ONERR rsx125
	MOU 'rsxdis' mncrem
	.SETN r$dist 2
	.GOTO rsx200
.rsx125:
;
;	Unable to mount the distribution as specified.
;	
	.ASK answ Do you wish to specify another distribution device
	.IFT answ .GOTO rsx020
	.GOTO trm050
.rsx200:
.;
.;	copy the system generation distribution files
.;
	UFD 'rmtarget'[2,200]
	.IF r$dist EQ 2 .GOTO rsx205
	.ONERR rsx210
	FLX 'rmtarget'[2,200]/rs='rsxdis' [2,20] 11sgen.cmd,11sgen2.cmd/do
	PURGE 'rmtarget'[2,200]*.*
	.GOTO rsx220
.rsx205:
	.ONERR rsx210
	FLX 'rmtarget'[2,200]/rs='rsxdis' [2,20] 11sgen.cmd,11sgen2.cmd/rs
	PURGE 'rmtarget'[2,200]*.*
	.GOTO rsx220
.rsx210:
;
;	Unable to copy the files from the distribution to the target device.
;
	DMO 'rsxdis'
	.ASK answ Is the correct distribution loaded
	.IFF answ .GOTO rsx020
	.GOTO trm060
.rsx220:
.;
.;	copy the saved answer file from SYS$LS23 
.;	to UIC [2,200] of the target
.;
	PIP 'rmtarget'[2,200]/nv=sys$ls23:syssaved.cmd
	PURGE 'rmtarget'[2,200]*.*
.;
.;	dismount the tape so that 11sgen may remount it
.;
	DMO/NOUNLOAD 'rsxdis'
;
;=====================================================
;	Section 3:
;
;	RSX11S generation section
;=====================================================
;
.;
.;	invoke the system generation command files
.;
;
;	Begining the RSX11S system generation.
;            Generation begun at '<TIME>'
;
	.IF h$sys EQ 4 .GOTO rsx223
	ASN 'rmtarget'=SY:
	ASN 'rmtarget'=LB:
	.GOTO rsx224
.rsx223:
	SET DEF 'rmtarget'
.rsx224:
;
;   +=========================================================+
;   ||  REMEMBER TO PAUSE AT THE EOS BREAKPOINT FOLLOWING    ||
;   ||  THE CREATE EXECUTIVE BUILD FILE AND ISSUE THE        ||
;   ||  COMMAND @SYS$LS23:RMSGN1.CMD BEFORE CONTINUING 	     ||
;   +=========================================================+
;
	SET /UIC=[2,200]
	@11sgen.cmd
	.ASK answ Did the first part complete without error
	.IFF answ .GOTO rsx225

.;
.;	edit the BASMCR.MAC file
.;
	@sys$ls23:rmsgn2.cmd
.;
.;	invoke the second half of the system generation
.;
	.ERASE GLOBAL
	@11sgen2.cmd
	.ASK answ Did the second part complete without error
	.IFF answ .GOTO rsx225
	.GOTO rsx230
.rsx225:
;
;	Unrecoverable error encountered in one of the system generation
;	indirect command files
;
	DMO 'rsxdis'
	.GOTO trm060
.rsx230:
;
;	The RSX11S system generation for LABSTATION 23 is complete.
;	        Generation completed at '<TIME>'
;
.;
.;	copy the generated system files to SYS$LS23
.;
.;
.;
.;	determine what target device was used for the generation
.;
.rsx235:
	.ASKS rsxtar What device contains the system just generated
	.IF rsxtar EQ "" .GOTO rsx240
	.SETS chrchk rsxtar[<strlen>:<strlen>] ! check last character
	.IF chrchk NE ":" .SETS rsxtar "'rsxtar'"+":"!make last char :
.;
.;	find the group number for the system files
.;
.rsx240:

	.ASKN [1.:999.:1.] grpnum What is the group number of the system files
.;
.;	copy the system files to sys$ls23
.;
.rsx250:
	.ONERR rsx260:	
	COPY 'rsxtar'['grpnum',64]*.* sys$ls23:*.*
	COPY 'rsxtar'[1,1]*.* sys$ls23:*.*
	.GOTO ver001:
.rsx260:
;
;	UNABLE TO COPY THE SYSTEM FILES TO THE LABSTATION 23 DISK.
;	    THIS MUST BE DONE BEFORE CONTINUING. 
;	COPY THE FILES FROM THE UIC [1,1] AND [GROUPNUMBER,64]
;	MANUALLY FROM THE SYSTEM GENERATION TARGET DISK TO SYS$LS23.
;	THE PROCESS WILL PAUSE SO THAT THIS MAY BE DONE. AFTER COMPLETING
;	THIS TYPE:
;		           CONTINUE
;
	.PAUSE
.ver001:
;
;
;	The generation portion of LABSTATION 23 is completed.
;	Before proceeding install and verify REAL11S.
;	All the REAL11 files must be present in SYS$LS23.
;	The network may then be created.
;
	.GOTO trm100
.;
.;	termination information and error conditions
.;
.trm050:
;
;	This LABSTATION 23 generation is being terminated as per operator 
;	instruction.
;
	.GOTO trm100
.trm060:
;
;	This LABSTATION 23 generation is being terminated by an unrecoverable
;	error condition.
;
	.GOTO trm100
.trm100:
;
;
;====================================================================
;	LABSTATION 23 generation terminated '<date>' at '<time>'.
;====================================================================
;
.EXIT
