;* ***************************** MODULE HEADER *************************** *;
;*                                                                         *;
;*   MACHINE: B2xB3x                             OS: BTOSCTOS            *;
;*                                                                         *;
;*   DESCRIPTION:     CTOS Pascal install.jcl installation script          *;
;*                                                                         *;
;*   THIS MODULE CONTAINS THE INSTALLATION JOB USED TO INSTALL THE         *;
;*   CTOS PASCAL PRODUCT                                                   *;
;*                                                                         *;
;* HISTORY:                                                                *;
;*                                                                         *;
;* MMDDYY VVVVMM   PROGRAMMER    DESCRIPTION                           *;
;*                                                                         *;
;* 111292 070100   Tim Dooley    Changes for multifloppy installation *;
;*                                                                         *;
;* 111891 070001   Tim Dooley    Added ability to declare volume and   *;
;*								    directory for Pascal files when       *;
;*								    making installation private.		   *;
;*																		   *; 
;* 111391 070000   Tim Dooley    Created                               *;
;*                                                                         *;
;* TITLE:  CTOS Pascal 7.0.1                                               *;
;*                                                                         *;
;*             PROPRIETARY PROGRAM MATERIAL                                *;
;*                                                                         *;
;* THIS MATERIAL IS PROPRIETARY TO UNISYS CORPORATION AND IS NOT TO BE     *;
;* REPRODUCED, USED OR DISCLOSED EXCEPT IN ACCORDANCE WITH PROGRAM LICENSE *;
;* OR UPON WRITTEN AUTHORIZATION OF THE PATENT DIVISION OF UNISYS          *;
;* CORPORATION, DETROIT, MICHIGAN 48232, USA.                              *;
;*                                                                         *;
;* COPYRIGHT (C) 1992 UNISYS CORPORATION                                   *;
;*                                                                         *;
;* UNISYS BELIEVES THAT THE SOFTWARE FURNISHED HEREWITH IS ACCURATE AND    *;
;* RELIABLE, AND MUCH CARE HAS BEEN TAKEN IN ITS PREPARATION.  HOWEVER,    *;
;* NO RESPONSIBILITY, FINANCIAL OR OTHERWISE, CAN BE ACCEPTED FOR ANY      *;
;* CONSEQUENCES ARISING OUT OF THE USE OF THIS MATERIAL, INCLUDING LOSS OF *;
;* PROFIT, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES, THERE ARE NO       *;
;* WARRANTIES WHICH EXTEND BEYOND THE PROGRAM SPECIFICATION.               *;
;*                                                                         *;
;* THE CUSTOMER SHOULD EXERCISE CARE TO ASSURE THAT USE OF THE SOFTWARE    *;
;* WILL BE IN FULL COMPLIANCE WITH LAWS, RULES AND REGULATIONS OF THE      *;
;* JURISDICTIONS WITH RESPECT TO WHICH IT IS USED.                         *;
;*                                                                         *;
;* ************************* END OF MODULE HEADER ************************ *;

;  THIS IS AN INSTALLATION OF CTOS PASCAL USING THE INSTALLATION      
;  MANAGER.  INSTALLATION FROM FLOPPY AND SERVER ARE SUPPORTED.

$JOB PASINSTALL

$PauseOff

	; NATIONALIZABLE STRINGS
	DoneMsg        = 'Done.'
	CommandMsg     = 'Creating the Pascal Command ...................... '
	CopyMsg1	   = 'Copying First.Asm, Pascal8087.fls, '
	CopyMsg2	   = '                  Pascal8087.Lib, PascalFe.Run ... '
	CopyMsg3	   = 'Copying PascalLst.Run, PascalOpt.Run, '
	CopyMsg4	   = '                  PasMin.obj, First.Obj .......... '
	CopyMsg5	   = 'Copying Pascal.lib ............................... '
	CopyMsg6	   = 'Copying Linker.run ............................... '
	InstallMsg     = 'Installation complete.  '
	InstallMsg1    = 'Installation complete.  Remove and store diskettes.'
	InstallMsg2    = 'Resume Cluster if Disable Cluster was invoked.'
	InstallMsg4    = 'Press any key to finish.'
	TapeMsg		   = 'CTOS Pascal cannot be installed from Tape.'
    UserMsg1	   = 'The CTOS Pascal files may be installed to any valid'
	UserMsg2	   = 'Volume and Directory.  At the prompt, enter a Volume'
	UserMsg3	   = 'and Directory name and then press GO, or simply'
	UserMsg4	   = 'press GO to accept the default.'	
	UserMsg5	   = 'If the Volume name that you specify does not exist,'
	UserMsg6	   = 'this installation will fail.'
	UserPrompt	   = 'Press any key to continue.'
	EPrompt		   = 'Enter a Volume and Directory'
	Descript	   = 'Invoke the Pascal Compiler.'
	SF			   = 'Source File'
	OF			   = '[Object File]'
	LF			   = '[List File]'
	OLF			   = '[Object List File]'
	SelectY		   = 'Yes'
	LinkPrompt	   = 'Select YES to Copy Linker.run'	
	LMsg1		   = 'The installation process has detected a version of the'
	LMsg2		   = 'Linker.run which contains a version level that is less'
	LMsg3		   = 'than 12.1.  To properly use all features of CTOS Pascal,'
	LMsg4		   = 'a different version of Linker.run may be copied to your'
	LMsg5		   = 'system in the <Sys> directory.  Any existing version of'
	LMsg6		   = 'Linker.run will be copied to <Sys>Linker.runsave.  '
	LMsg7		   = 'At the prompt select Yes to overwrite the existing'
	LMsg8		   = 'Linker.run file.'
	LMsg9		   = 'Press any key to continue ...'
	
	;THE NEXT TWO LINES WILL BE CHANGED TO MATCH THE APPROPRIATE ENTRY
	;IN THE SYS.CMDS OR CLUSTER.CMDS FILE

	MCF			   = 'Merge Command Files'
	NC			   = 'New Command'	
	
	;IF THIS NEXT LINE IS TO BE NATIONALIZED THEN THE SAME FILE ON 
	;DISKETTE 2 MUST BE CHANGED TO MATCH THIS TEXT.

	Disk2of2	   = 'CTOS Pascal Diskette 2 of 2'
	
	; VARIABLE INITIALIZATION  DO NOT NATIONALIZE
	Floppy		 	= 0
	Tape  		 	= 1
	FromServer	 	= 2
	ClientVol       = '[Sys]'
	ServerVol       = '[Sys]'
	ClientSpec      = '[Sys]<Sys>'
	ServerSpec      = '[Sys]<Sys>'
	CopyPath		= '[B25PAS1]<sys>'
	ClstrCmds		= '[Sys]<Sys>Cluster.cmds'
	DiskType = FileVersion('[B25PAS1]<Sys>FDrive5.25')
	
	$IF Unattended AND (InstallType = Floppy)
		$DisplayLine
		$DisplayLine
		$Displayline('  AE Unattended mode is not supported on floppy installation.AA')
		$Displayline('  AE                                     Press <GO> to exit  AA')
		$DisplayLine
		$DisplayLine
		$DisplayAndWait
		$Cancel
	$ENDIF

	SvrSysType = FileVersion('[Sys]<Sys>SysImage.sys')
	ClstrSysType = FileVersion('[Sys]<Sys>SysImage.sys')

	$IF (InstallType = FromServer) AND (Public OR (SvrSysType = ClstrSysType))
		$DisplayLine
		$DisplayLine
		$Displayline('  AE Public installation from server is invalid.            AA')
		$Displayline('  AE                                    Press <GO> to exit  AA')
		$DisplayLine
		$DisplayLine
		$DisplayAndWait
		$Cancel
	$ENDIF

	;A VOLUME AND DIRECTORY PATH FOR THE CTOS PASCAL SOFTWARE,
	;IF IT IS A PUBLIC INSTALLATION WE WILL FORCE IT TO [SYS]<PASCAL>

	If Public
	   CmdFileTo 	= ClstrCmds
	   DefVol 		= ServerVol
	   InstallPath = ServerSpec
	   
	   CmdSpec = ConcatStrings(CopyPath, 'Install>English.cmds')
   	   ToCmdSpec = ConcatStrings(InstallPath, 'Install>English.cmds')
   	   CopyTo = '[Sys]<Installed>Pascal7.0.1>Install>English.cmds'

   	   Command Copy, CmdSpec, CopyTo, Yes
   	   
	   Run ([Sys]<Sys>CmdFileEditor.run, MCF, 'MC'), 
						CmdSpec,				 ;File From
						ToCmdSpec,			  	 ;FileTo
						No						 ;Overwrite

       ContinueOnError

	Else

	   PathDef 		= '[Sys]<sys>'
	   DefVol 		= ClientVol
	   
	   ContinueOnError

	   IF InstallType = FromServer
		  CopyPath = '[Sys]<Installed>Pascal7.0.1>'
       EndIf
		  
	   CmdSpec = ConcatStrings(CopyPath, 'Install>English.cmds')
   	   ToCmdSpec = ConcatStrings(PathDef, 'Install>English.cmds')

	   Run ([Sys]<Sys>CmdFileEditor.run, MCF, 'MC'), 
						CmdSpec,				 ;File From
						ToCmdSpec,			  	 ;FileTo
						No						 ;Overwrite
	
       ContinueOnError

	EndIf

	;SCROLL THE SCREEN 32 LINES
    Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah) 
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah) 
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah)

	;THE USERENTERVALUE CONSTRUCT WILL ALLOW THE ASSIGNMENT OF
	;A VOLUME AND DIRECTORY PATH FOR THE CTOS PASCAL SOFTWARE,
	;IF IT IS A PUBLIC INSTALLATION WE WILL FORCE IT TO [SYS]<PASCAL>
	If Public
	   CmdFileTo 	= ClstrCmds
	   DefVol 		= ServerVol
	   InstallPath  = '[Sys]<Pascal>' 

   	   Command 'Create Directory', InstallPath
	   
	Else
	   PathDef 		= '[Sys]<sys>'
	   DefVol 		= ClientVol
	   
	   DisplayLine(UserMsg1)
	   DisplayLine(UserMsg2)
	   DisplayLine(UserMsg3)
	   DisplayLine(UserMsg4)
	   DisplayLine
	   DisplayLine(UserMsg5)
	   DisplayLine(UserMsg6)
	   DisplayLine
	   DisplayAndWait(UserPrompt)
	   
	   InstallPath = UserEnterValue(EPrompt, PathDef)
	   
	   Command 'Create Directory', InstallPath

	   DisplayLine
	   DisplayLine

	EndIf

	If InstallType EQ FromServer
		InstallFrom = '[Sys]<Pascal>'
	Else
		InstallFrom = ConcatStrings(DeviceFrom, '<Unisys>')
	Endif

	If InstallType EQ Tape
		DisplayLine
		DisplayLine(TapeMsg)
		DisplayLine(InstallMsg4)
		DisplayAndWait
		Cancel
	Endif

	DisplayLine

	; COPY FILES FROM THE FLOPPIES
	DisplayLine
	DisplayLine(CopyMsg1)
	Display(CopyMsg2)
	
	Run [Sys]<Sys>LCopy.run, (First.Asm, Pascal8087.fls, 
							  Pascal8087.Lib, PascalFE.Run), 
				  InstallFrom, InstallPath,,y,n,n,y

	Displayline(DoneMsg)
	
	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)

    DisplayLine(CopyMsg3)
    Display(CopyMsg4)

	Run [Sys]<Sys>LCopy.run,(PascalLst.Run, PascalOpt.Run, PasMin.Obj,  
							  First.Obj), 
				  InstallFrom, InstallPath,,y,n,n,y

	DisplayLine(DoneMsg)

	DiskType = FileVersion('[B25PAS1]<Sys>fDrive>5.25')
	
	If DiskType = '255'
	
		;SCROLL THE SCREEN FOUR LINES
		Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)

		If  InstallType <> FromServer 
	  		NextFloppy(Disk2of2)
		EndIf
	EndIf

	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)

    Display(CopyMsg5)

	Run [Sys]<Sys>LCopy.run, Pascal.lib, 
				  InstallFrom, InstallPath,,y,n,n,y

    If Public
		Run [Sys]<Sys>LCopy.run, Linker.run, 
				  InstallFrom, InstallPath,,y,n,n,y
	EndIf
	
	DisplayLine(DoneMsg)
	
	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)

	Deassign(Disk2of2)
	Deassign(CopyMsg1)
	Deassign(CopyMsg2)
	Deassign(CopyMsg3)
	Deassign(CopyMsg4)
	Deassign(CopyMsg5)
	
	If Public
  		VerLev = FileVersion('[Sys]<Sys>Linker.run')
	Else
    	VerLev = FileVersion('[Sys]<Sys>Linker.run')
	EndIf
		
	VerString = '12.0'
	VerVar = SubString(VerString, VerLev)

	If VerVar <> 65535

	  ;SCROLL THE SCREEN 32 LINES
      Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah) 
	  Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah) 
	  Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	  Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah)

	  DisplayLine(LMsg1)
	  DisplayLine(LMsg2)
	  DisplayLine(LMsg3)
	  DisplayLine(LMsg4)
	  DisplayLine(LMsg5)
	  DisplayLine(LMsg6)
	  DisplayLine(LMsg7)
	  DisplayLine(LMsg8)
	  DisplayLine
	  DisplayAndWait(LMsg9)

	  Default = SelectY
	  LinkerYes = UserSelectYesNo(LinkPrompt, Default)
	  Deassign(LinkPrompt)

	  ;SCROLL THE SCREEN FOUR LINES
      Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah) 

	  If LinkerYes = 255

		Display(CopyMsg6)
		
	    If Public 
			Command Copy, [Sys]<Sys>Linker.run, [Sys]<Sys>Linker.runsave,y
			
			Run [Sys]<Sys>LCopy.run, Linker.Run, 
				  InstallFrom, [Sys]<Sys>,,y,n,n,y
		Else
			Command Copy, [Sys]<Sys>Linker.run, [Sys]<Sys>Linker.runsave,y

		  If InstallType = FromServer
		    Run [Sys]<Sys>LCopy.run, Linker.Run, 
				  [Sys]<Pascal>, [Sys]<Sys>,,y,n,n,y
		  Else
			Run [Sys]<Sys>LCopy.run, Linker.Run, 
				  InstallFrom, [Sys]<Sys>,,y,n,n,y
		  EndIf
			
		EndIf

		DisplayLine(DoneMsg)

	  ;SCROLL THE SCREEN FOUR LINES
      Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah) 
		
	  EndIf
	
	EndIf
	  
	; ADD PASCAL COMMAND
	Display(CommandMsg)

	InstFile = ConcatStrings(InstallPath, 'PascalFE.Run')
	
	If Public
	  PubCom = 'Y'
	Else
	  PubCom = 'N'
	EndIf
	
	Run ([Sys]<Sys>CmdFileEditor.run, NC, 'AC'), 
				Pascal,										;Command Name
				InstFile,									;Run File
				(SF, OF, LF, OLF),               		   ;Field Names
				Descript,									;Description	
				Yes,,									   ;Overwrite
				CmdFileTo,									;Command File
				PubCom,										;Public Command;

	DisplayLine(DoneMsg)

	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)

	If InstallType = FromServer
		DisplayLine(InstallMsg)
	Else
		DisplayLine(InstallMsg1)
	Endif

	DisplayLine(InstallMsg2)

	DisplayAndWait(InstallMsg4)
	DisplayLine
	DisplayLine
	PauseOn

End
 CmdSpec = ConcatStrings(CopyPath, 'Install>English.cmds')
   	   ToCmdSpec = ConcatStrings(PathDef, 'Install>English.cmds')

	   Run ([Sys]<Sys>CmdFileEditor.run, MCF, 'MC'), 
						CmdSpec,				 ;File From
						ToCmdSpec,			  	 ;FileTo
						No						 ;Overwrite
	
       ContinueOnError

	EndIf

	;SCROLL THE SCREEN 32 LINES
    Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\0Ah,\\