;* ***************************** MODULE HEADER *************************** *;
;*                                                                         *;
;*   MACHINE: B2xB3x                             OS: BTOSCTOS            *;
;*                                                                         *;
;*   DESCRIPTION:     CTOS COBOL2 Compiler install.jcl installation       *;
;*					  script for 3.5 and 5.25 inch floppies     		   *;
;*                                                                         *;
;*   THIS MODULE CONTAINS THE INSTALLATION JOB USED TO INSTALL THE         *;
;*   CTOS COBOL2 COMPILER PRODUCT                                         *;
;*                                                                         *;
;* HISTORY:                                                                *;
;*                                                                         *;
;* MMDDYY VVVVMM   PROGRAMMER    DESCRIPTION                           *;
;*                                                                         *;
;* 102092 010200   Ned Bader     Fixed displays          nb03          *;
;* 101592 010203   Tim Dooley    Move RTS>LinkerConfig.sys to last disk*;
;* 100792 010200   Ned Bader     Fix install from server nb02          *;
;* 100692 010200   Ned Bader     Grammer Fixes           nb01          *;
;* 100192 010200   Tim Dooley    Created                               *;
;*                                                                         *;
;* TITLE:  CTOS COBOL2 Compiler                                           *;
;*                                                                         *;
;*             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 THE CTOS COBOL2 COMPILER USING INSTALLATION 
;  MANAGER.  INSTALLATION FROM FLOPPY AND SERVER ARE SUPPORTED.

JOB COBOLINSTALL

PauseOff
CancelOnError

	;NATIONALIZABLE STRINGS

	Inst1		   = 'Installation of the COBOL2 Compiler software will'
	Inst2		   = 'result in the removal of the <COBOL2> directory if'
	Inst3		   = 'it exists.  If you wish to save any files in the'
	Inst4		   = '<COBOL2> directory, select NO at the prompt to abort'
	Inst5		   = 'the installation, save the files, then restart'
	Inst6		   = 'the installation process.'	
	YNPrompt	   = 'Select Yes to continue with Installation'	
	Blank		   = '         '
	DoneMsg		   = 'Done.'
	CommandMsg	   = 'Creating the COBOL2 Compiler Commands ... '
	DevTools1	   = 'The CTOS COBOL2 Compiler must have the Language'
	DevTools2	   = 'Development Software level 3.0.1 or greater installed.'
	DevTools3	   = 'If this system does not have the correct level of the'
	DevTools4	   = 'Language Development software, select NO at the prompt'
	DevTools5	   = 'to cancel this installation.'
	CopyMsg1	   = 'Copying COBOL2 files from [B25COB1] .... '
	CopyMsg1A	   = 'Copying needed files from [Sys]<Cobol2> . '
	CopyMsg2	   = 'Copying COBOL2 files from [B25COB2] .... '
	CopyMsg3	   = 'Copying COBOL2 files from [B25COB3] .... '
	CopyMsg4	   = 'Copying COBOL2 files from [B25COB4] .... '
	RemDir		   = 'Removing existing <COBOL2> directory ..... '
	CrDir		   = 'Creating <COBOL2> directory .............. '
	LinkerMsgA	   = 'Copying Linker file ...................... '
	LinkerMsg1	   = 'Installation of CTOS COBOL2 Compiler software'
	LinkerMsg2	   = 'requires <Sys>Linker.run release 12.2 or'
	LinkerMsg3	   = 'greater.  Select Yes to overwrite any existing'
	LinkerMsg4	   = 'version of <sys>Linker.run.'
	LinkerMsg5	   = 'Select YES to overwrite'
	InstallMsg	   = 'Installation complete.  '
	InstallMsg1	   = 'Installation complete.  Remove and store diskettes.'
	InstallMsg2	   = 'Resume Cluster if Disable Cluster was invoked.'
	InstallMsg3	   = 'Press any key to finish.'
	TapeMsg		   = 'The COBOL2 Compiler cannot be installed from Tape.'
	FlopInst	   = 'Unattended mode is not supported on floppy installation.'
	SelectY		   = 'Yes'
	PressGo		   = '              Press <GO> to exit.'
	PubInst		   = 'Public installation from server is invalid.'

	;THE NEXT LINE WILL BE CHANGED TO MATCH THE APPROPRIATE ENTRY
	;IN THE SYS.CMDS OR CLUSTER.CMDS FILE

	MCF			   = 'Merge Command Files'
	
	;IF THE NEXT FOUR LINES ARE TO BE NATIONALIZED THEN THE SAME FILES ON 
	;THE INSTALLATION FLOPPIES4 MUST BE CHANGED TO MATCH THIS TEXT.

	Disk2of5	   = 'CTOS COBOL2 Diskette 2 of 5'
	Disk3of5	   = 'CTOS COBOL2 Diskette 3 of 5'
	Disk4of5	   = 'CTOS COBOL2 Diskette 4 of 5'
	Disk2of2	   = 'CTOS COBOL2 Diskette 2 of 2'

	;NATIONALIZATION OF THIS SCRIPT ENDS HERE
	
	;VARIABLE INITIALIZATION  DO NOT NATIONALIZE

	Floppy			= 0
	Tape			= 1
	FromServer		= 2
	ClientVol		= '[Sys]'
	ServerVol		= '[Sys]'
	ClientSpec		= '[Sys]<Sys>'
	ServerSpec		= '[Sys]<Sys>'
	CopyPath		= '[B25COB1]<sys>'	
	ClstrCmds		= '[Sys]<Sys>Cluster.cmds'

	If (OSRelease >= 12)
	  OSVar = 1
	Else
	  OSVar = 0
	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)

	Display(Blank)
	DisplayLine(Inst1)
	Display(Blank)
	DisplayLine(Inst2)
	Display(Blank)
	DisplayLine(Inst3)
	Display(Blank)
	DisplayLine(Inst4)
	Display(Blank)
	DisplayLine(Inst5)
	Display(Blank)
	DisplayLine(Inst6)

	YNRes = UserSelectYesNo(YNPrompt, SelectY)

	If (YNRes = 0)
	   Cancel
	EndIf

	Deassign(Inst1)	
	Deassign(Inst2)	
	Deassign(Inst3)	
	Deassign(Inst4)	
	Deassign(Inst5)	
	Deassign(Inst6)	

	;NATIONALIZABLE STRINGS

	LastDisk1	   = 'The files on the last diskette, in the <COBOL> directory'
	LastDisk2	   = 'of the COBOL2 Compiler package enable the user to'
	LastDisk3	   = 'build a customized COBOL2 Runtime System.  They are'
	LastDisk4	   = 'not part of the COBOL2 compiler installation.  These'
	LastDisk5	   = 'files must be manually copied if they are to be used.'	
	UserPrompt	   = 'Press any key to continue.'


	;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)


	;DISPLAY MESSAGE TO ABORT IF 3.0.1 OR GREATER DEV TOOLS IS NOT PRESENT
		
	Display(Blank)
	DisplayLine(DevTools1)
	Display(Blank)
	DisplayLine(DevTools2)
	Display(Blank)
	DisplayLine(DevTools3)
	Display(Blank)
	DisplayLine(DevTools4)
	Display(Blank)
	DisplayLine(DevTools5)
		
	YNRes = UserSelectYesNo(YNPrompt, SelectY)

	If (YNRes = 0)
		Cancel
	EndIf

	Deassign(DevTools1)	
	Deassign(DevTools2)	
	Deassign(DevTools3)	
	Deassign(DevTools4)	
	Deassign(DevTools5)	

	
	;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)
	
	IF Unattended AND (InstallType = Floppy)
		
		DisplayLine
		DisplayLine
		DisplayLine('  AE ', FlopInst, ' AA')
		Displayline('  AE ', PressGo,'                         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 ', PubInst, ' AA')
		Displayline('  AE ', PressGo, '           AA')
		DisplayLine
		DisplayLine
		DisplayAndWait
		
		Cancel
		
	ENDIF

	Deassign(SvrSysType)
	Deassign(ClstrSysType)
	Deassign(PubInst)
    Deassign(PressGo)
	Deassign(FlopInst)

	If Public
	   CmdFileTo 	= ClstrCmds
	   
	   If (OSVar = 1)
	   	 DefVol = VolumeTo
	   Else
	     DefVol = ServerVol
	   EndIf

	   Temp = ConcatStrings(DefVol, '<COBOL2>')	
	   
	   InstallPath = Temp
	   LinkerPath  = ServerSpec

	   ;  added next lcopy to copy the at file list 
	   ;  for install from server    nb02

	   Run [Sys]<Sys>LCopy.run, Cobol1.2.0>Cobol.fls, 
					 [B25COB1]<Sys>, 
					 '[Sys]<Installed>',,y,n,n,y
 
	   Run [Sys]<Sys>LCopy.run, COBOL2.cmds, 
					 [B25COB1]<Sys>, 
					 '[Sys]<Installed>COBOL2>1.2.0>',,y,n,n,y
 	   
	   CmdSpec = ConcatStrings(CopyPath, 'Install>English.cmds')
   	   ToCmdSpec = ConcatStrings(ServerSpec, 'Install>English.cmds')

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

	   ;REMOVE THE OLD COBOL2 DIRECTORY

		ContinueOnError
	
		;SCROLL THE SCREEN FOUR LINES
		Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
		
		Display(RemDir)
	
		Command 'Remove Directory', Temp, , Yes, N

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

		;  changed next line to clean up display	nb02nb03
		;  DisplayLine
				
		Command 'Create Directory', Temp, 15, 100

		;  added next line for display              nb03
		DisplayLine(DoneMsg)
	   
		CancelOnError

	Else
	  
	   	PathDef 		= '[Sys]<sys>'
	   
	   	If (OSVar = 1)
	     DefVol = VolumeTo
	   	Else
	     DefVol = ClientVol
	   	EndIf

		Temp = ConcatStrings(DefVol, '<COBOL2>')		   

	   	InstallPath	= Temp	   
	   	LinkerPath	= ClientSpec
	   
	   	ContinueOnError

	   	IF InstallType = FromServer
			  CopyPath = ServerSpec
       	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
	
	   ;REMOVE THE OLD COBOL2 DIRECTORY

		ContinueOnError

		;SCROLL THE SCREEN FOUR LINES
		Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
		Display(RemDir)	
		Command 'Remove Directory', Temp, , Yes, N

		DisplayLine(DoneMsg)
		
		;SCROLL THE SCREEN FOUR LINES
		Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
		
		Display(CrDir)
		
		Command 'Create Directory', Temp, 15, 100
	   
		DisplayLine(DoneMsg)

		;SCROLL THE SCREEN FOUR LINES
		Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
			
		CancelOnError
 	   
	EndIf
    
	Deassign(CmdSpec)
	Deassign(ToCmdSpec)

	If InstallType EQ Floppy
		InstallFrom = ConcatStrings(DeviceFrom, '<Unisys>')
	Endif

	If InstallType EQ FromServer
		InstallFrom = ServerSpec
	Endif

	Deassign(ServerSpec)

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

	Deassign(TapeMsg)
	Deassign(Tape)

	;CREATE THE COBOL2 COMMANDS
	
	Display(CommandMsg)
	Deassign(CommandMsg)
	
	If Public
       ToCmdSpec  = ClstrCmds
       DestVol    = DefVol
    Else
       ToCmdSpec  = '[Sys]<sys>Sys.cmds'
       DestVol    = DefVol
    EndIf
    
    If (InstallType = FromServer)

	  Run ([Sys]<Sys>CmdFileEditor.run, MCF, 'MC'),	
				   '[Sys]<Installed>COBOL2>1.2.0>COBOL2.cmds',
				   ToCmdSpec,						 ;FileTo
				   Yes,								 ;Overwrite
				   DestVol							  ;Destination Volume

	Else

	   Run ([Sys]<Sys>CmdFileEditor.run, MCF, 'MC'),	
				   [B25COB1]<Sys>COBOL2.cmds,		 ;File From
				   ToCmdSpec,						 ;FileTo
				   Yes,								 ;Overwrite
				   DestVol							  ;Destination Volume

    EndIf

	DisplayLine(DoneMsg)				   
	Deassign(DestVol)			   

	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
	;COPY FILES FROM THE FLOPPIES OR FROM SERVER


	Temp = ConcatStrings(InstallFrom, '*')

	If  InstallType <> FromServer 

		VerLev = FileVersion('[B25COB1]<Sys>FDrive>3.5')

		Display(CopyMsg1)

		Run [Sys]<Sys>LCopy.run, Temp, , InstallPath,,y,n,n,y
	
	Else
	
		Display(CopyMsg1A)

		; modified next line   nb02

		Run [Sys]<Sys>LCopy.run, @[Sys]<Installed>Cobol1.2.0>Cobol.fls,
								[sys]<cobol2>,InstallPath,,y,n,n,y

	EndIf
	
	DisplayLine(DoneMsg)

	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
	
	
	If  InstallType <> FromServer 

		If (VerLev = '0')

	  		NextFloppy(Disk2of5)
			
		Else
		
			NextFloppy(Disk2of2)
			
		EndIf
		
	EndIf ;This If will check to see if we have a 3.5 floppy drive.  The
		  ;3.5 floppy will have a file called FDrive>3.5 the 5.25 won't.
		  ;This is really very simple, isn't it?

	Deassign(Disk2of5)
	Deassign(Disk2of2)

	;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)
	
	Display(Blank)
	DisplayLine(LinkerMsg1)	
	Display(Blank)
	DisplayLine(LinkerMsg2)	
	Display(Blank)
	DisplayLine(LinkerMsg3)	
	Display(Blank)
	DisplayLine(LinkerMsg4)	

	YNRes = UserSelectYesNo(LinkerMsg5, SelectY)
	
	;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)
	
	If (YNRes = 255)
	
	  ;SCROLL THE SCREEN FOUR LINES
	  Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
	  Display(LinkerMsgA)
	  
	  If InstallType = FromServer

		Run [Sys]<Sys>LCopy.run, 
		[Sys]<Sys>Linker.run,, LinkerPath, , y, n, n, y

	  Else

		Run [Sys]<Sys>LCopy.run, 
		[B25COB2]<Sys>Linker.run,, LinkerPath, , y, n, n, y

	  EndIf

	  DisplayLine(DoneMsg)
	  	  
	EndIf
	

	If InstallType <> FromServer

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

		Run [Sys]<Sys>LCopy.run, Temp, , InstallPath,,y,n,n,y
	
		Displayline(DoneMsg)

	EndIf

	;SCROLL THE SCREEN FOUR LINES
	Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
	
	If  InstallType <> FromServer 

		If (VerLev = '0')

	  		NextFloppy(Disk3of5)
		
			Deassign(Disk3of5)

			;SCROLL THE SCREEN FOUR LINES
			Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
			DisplayLine
		
			Display(CopyMsg3)
	
			Run [Sys]<Sys>LCopy.run, Temp, , InstallPath,,y,n,n,y
	
			Displayline(DoneMsg)
		
			;SCROLL THE SCREEN FOUR LINES
			Display(\\0Ah,\\0Ah,\\0Ah,\\0Ah)
	
	  		NextFloppy(Disk4of5)

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

			Display(CopyMsg4)
	
			Run [Sys]<Sys>LCopy.run, Temp, , InstallPath,,y,n,n,y
	
			Displayline(DoneMsg)
			
		EndIf
	
	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)
	
	Deassign(CopyMsg1)
	Deassign(CopyMsg2)
	Deassign(CopyMsg3)
	Deassign(CopyMsg4)

	DisplayLine(LastDisk1)
	DisplayLine(LastDisk2)
	DisplayLine(LastDisk3)
	DisplayLine(LastDisk4)
	DisplayLine(LastDisk5)

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

	If InstallType = FromServer
	
		DisplayLine(InstallMsg)
		
	Else
		
		DisplayLine(InstallMsg1)
		
	EndIf
	
	Deassign(InstallMsg1)
	Deassign(InstallMsg)
	DisplayLine(InstallMsg2)
	Deassign(InstallMsg2)
	DisplayAndWait(InstallMsg3)
	Deassign(InstallMsg3)

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

	PauseOn

End
