home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
w
/
wr06015.zip
/
WR06015.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-01-27
|
18KB
|
481 lines
/****************************************************************************
Module Name = WR06015.CMD
Descriptive Name = SelectPak 15 (Database PC DOS Requester)
install tool
Copyright = 04G1049 (C) Copyright IBM Corp. 1988, 1991.
All rights reserved.
US Government Users Restricted Rights -
Use, duplication or disclosure restricted by
GSA ADP Schedule Contract with IBM Corp.
Licensed Materials - Property of IBM
Function = Installation tool for SelectPak 015
Operating System = OS/2 Extended Services
****************************************************************************/
signal on halt /* call HALT: routine on CTRL-BREAK */
"echo off"
/*************************************************/
/* Read in command line arguements if they exist */
/*************************************************/
parse upper arg Base_Drive Update_Drive Backed .
/***********************************************************/
/* Verify that the Database SelectPak message file exists */
/***********************************************************/
MSG_FILE = stream('WR06DBM.MSG' , 'c' , 'query exists')
if MSG_FILE = "" then
do
say " ERROR: could not find message file WR06DBM.MSG "
signal End
end
/***************************************************/
/* Read the message file into an array of messages */
/***************************************************/
do while lines(MSG_FILE) \= 0 /* While not at EOF */
text_of_message = MSG_Parse(linein(MSG_FILE))
MSG.message_number = text_of_message
end /* End of While loop */
/**************************************/
/* Close the message file */
/**************************************/
RC = stream('WR06DBM.MSG' , 'c' , 'close')
start:
"cls"
/****************************************/
/* One possible input parameter is '?' */
/* Display the help panel in this case */
/****************************************/
if Base_Drive = "?" then signal syntax
/*************************/
/* Introductory panel */
/*************************/
say
say
say centre(MSG.50,50)
say centre(Create_MSG(MSG.01,'015'),50)
say centre(MSG.02,50)
say
say
/***************************************************/
/* The Base Drive letter is the Drive letter that */
/* contains the Base Operating System. */
/***************************************************/
get_Base_Drive:
if Base_Drive \= "" then signal got_Base_Drive
call charout ," "MSG.03" "
parse upper linein Base_Drive
if Base_Drive = "" then
do
say " "MSG.04
signal get_Base_Drive
end
got_Base_Drive:
/*************************************************/
/* Verify that the \OS2\INSTALL directory exists */
/* on the drive specified by the user */
/*************************************************/
"dir "Base_Drive":\OS2\INSTALL > NUL 2>>&1"
if RC \= 0 then
do
say
say " "Create_MSG2(MSG.05,Base_Drive,'\OS2\INSTALL')
say " "Create_MSG(MSG.06,'\OS2\INSTALL')
say " "MSG.07
parse linein ignore
Base_Drive = ""
signal get_Base_Drive
end
/***************************************************/
/* The log varible will contain the full path name */
/* of the output log. The output log will contain */
/* any error messages from this installation */
/***************************************************/
LOG = ""Base_Drive":\OS2\INSTALL\WR06015.LOG"
say
say " "Create_MSG(MSG.08,LOG)
say
say
/******************************************************/
/* The Update Drive letter is the letter of the Drive */
/* containing the Database system directory that */
/* you wish to upgrade. */
/******************************************************/
get_Update_Drive:
if Update_Drive \= "" then signal got_Update_Drive
call charout ," "MSG.09" "
parse upper linein Update_Drive
if Update_Drive = "" then
do
say " "MSG.04
signal get_Update_Drive
end
got_Update_Drive:
/*************************************************/
/* Verify that the \DBDRQLIB directory exists */
/* on the drive specified by the user */
/*************************************************/
"dir "Update_Drive":\DBDRQLIB > NUL 2>>&1"
if RC \= 0 then
do
say
say " "Create_MSG2(MSG.05,Update_Drive,'\DBDRQLIB')
say " "Create_MSG(MSG.06,'\DBDRQLIB')
say " "MSG.07
parse linein ignore
Update_Drive = ""
signal get_Update_Drive
end
/***********************************************************/
/* Display to the user, the directory that will be updated */
/***********************************************************/
say
say " "Create_MSG2(MSG.12,Update_Drive,'DBDRQLIB')
say
Backup:
/***********************************************************/
/* Ask the user if they would like the old files to be */
/* backed up to the current directory. */
/***********************************************************/
say
say " "Create_MSG(MSG.13,'0.69')
call charout , " "Create_MSG(MSG.14,Backed)
if Backed \= "" then signal got_Backup
parse upper linein Backed
got_Backup:
if Backed = "0" then signal verify
if Backed \= "1" then /* Only 0 and 1 are acceptable inputs */
do
say
say " "MSG.15
Backed = ""
signal Backup
end
verify:
/*************************************************/
/* Ask for verification of the input parameters. */
/* This is done even if the user is using the */
/* command line interface. */
/*************************************************/
say
say
call charout ," "MSG.16" "
parse upper linein Verified
if Verified = "0" then /* If the user answers NO to verification */
do /* then reset all of the input parameters */
Base_Drive = "" /* and go back to the start. */
Update_Drive = ""
Backed = ""
Verified = ""
signal start
end
if Verified \= "1" then /* Only 0 and 1 are acceptable inputs */
do
say
say " "MSG.15
Verified = ""
signal verify
end
say
/*****************************************************************************/
/* */
/* Set up the following variables: */
/* PDRLEVEL: The fully qualified path name of the SYSLEVEL file for DOS REQ */
/* WDCLEVEL: The fully qualified path name of the SYSLEVEL file for WIN REQ */
/* DBD_PATH: The fully qualified path name of the DBDRQLIB directory */
/* */
/*****************************************************************************/
DBD_PATH = Update_Drive":\DBDRQLIB"
PDRLEVEL = DBD_PATH"\SYSLEVEL.PDR"
WDCLEVEL = DBD_PATH"\SYSLEVEL.WDC"
/*******************************************************************/
/* Check to see that the customer has WR06000 or WR06010 installed */
/* by reading the syslevel file. As well, a customer can have */
/* DOS Requester and/or Windows Requester. */
/*******************************************************************/
PDR_EXIST = stream(PDRLEVEL , 'c' , 'query exists')
WDC_EXIST = stream(WDCLEVEL , 'c' , 'query exists')
/*******************************************************************/
/* If neither DOS requester, nor Windows Requestor is installed */
/* then notify the user and exit. */
/*******************************************************************/
if PDR_EXIST = "" & WDC_EXIST = "" then
do
say
say MSG.51
say MSG.52
say
signal End
end
/************************************************************/
/* If Dos Requester is installed then read the syslevel */
/* file check to see if the proper service level is there */
/************************************************************/
if PDR_EXIST \= "" then
do
firstline = linein(PDRLEVEL)
level = substr(firstline,45,7)
if level \= 'WR06010' & level \= 'WR06000' then
do
say
say MSG.53
say MSG.54
say MSG.55
say
signal End
end
end
/************************************************************/
/* If Windows Requester is installed then read the syslevel */
/* file check to see if the proper service level is there */
/************************************************************/
if WDC_EXIST \= "" then
do
firstline = linein(WDCLEVEL)
level = substr(firstline,45,7)
if level \= 'WR06010' & level \= 'WR06000' then
do
say
say MSG.56
say MSG.57
say MSG.58
say
signal End
end
end
/******************************************************/
/* Close the syslevel files so that it can be updated */
/******************************************************/
RC = stream(PDRLEVEL , 'c' , 'close')
RC = stream(WDCLEVEL , 'c' , 'close')
"echo. >> "LOG" 2>>&1"
"echo " centre(MSG.50,50) " >> "LOG" 2>>&1"
"echo " centre(Create_MSG(MSG.01,'015'),50) " >> "LOG" 2>>&1"
"echo. >> "LOG" 2>>&1"
"echo. >> "LOG" 2>>&1"
"echo. >> "LOG" 2>>&1"
/***********************************************************************/
/* If the user had chosen to backup the old version of the files, */
/* then copy the files that will be changing from the SQLLIB directory */
/* to the current directory. */
/***********************************************************************/
if Backed = "0" then signal skip_Backup
"echo "MSG.20 DBD_PATH"\PCDRDLL.DLL >>"LOG" 2>>&1"
"copy "DBD_PATH"\PCDRDLL.DLL >>"LOG" 2>>&1"
/*********************************************/
/* Back up the any syslevel files that exist */
/*********************************************/
if PDR_EXIST \= "" then
do
"echo "MSG.20 PDRLEVEL " >>"LOG" 2>>&1"
"copy "PDRLEVEL" SYSLVOLD.PDR >>"LOG" 2>>&1"
end
if WDC_EXIST \= "" then
do
"echo "MSG.20 WDCLEVEL " >>"LOG" 2>>&1"
"copy "WDCLEVEL" SYSLVOLD.WDC >>"LOG" 2>>&1"
end
"echo "MSG.20 DBD_PATH"\PCDRSTAT.LIB >>"LOG" 2>>&1"
"copy "DBD_PATH"\PCDRSTAT.LIB >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLENV_.H >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLENV_.H >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLLOGF2.EXE >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLLOGF2.EXE >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLLOGN2.EXE >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLLOGN2.EXE >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPEXP.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPEXP.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPGSI.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPGSI.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPICI.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPICI.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPICT.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPICT.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPIWI.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPIWI.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPMPM.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPMPM.BND >>"LOG" 2>>&1"
"echo "MSG.20 DBD_PATH"\SQLUPXPM.BND >>"LOG" 2>>&1"
"copy "DBD_PATH"\SQLUPXPM.BND >>"LOG" 2>>&1"
skip_Backup:
/***************************************************************************/
/* Unzip the SQLLIB files -n means only unzip newer files */
/* -d means create directories stored in ZIP file */
/***************************************************************************/
"PKUNZIP2 -n -d WR06015.SPK "DBD_PATH"\ >>"LOG" 2>>&1"
if RC = 0 then signal Zip_Done1
if RC = 11 then /* Make a note in the log if no files were unziped */
do
say
say " "Create_MSG(MSG.21,DBD_PATH)
signal Zip_Done1
end
/****************************************************************************/
/* If there were any errors then tell the user that there were problems. */
/****************************************************************************/
say " "MSG.22
say " "Create_MSG(MSG.23,LOG)
say " "
say " "MSG.07
parse linein ignore
Zip_Done1:
/***********************************************************************/
/* Update the SYSLEVEL fileS to indicate a SelectPak has been applied */
/***********************************************************************/
"echo "MSG.59" >>"LOG" 2>>&1"
if WDC_EXIST \= "" then
do
"attrib -r "WDCLEVEL " > NUL 2>>&1"
"copy "DBD_PATH"\SYSLEVEL.WD1 "WDCLEVEL " >>"LOG" 2>>&1"
"attrib +r "WDCLEVEL " > NUL 2>>&1"
end
if PDR_EXIST \= "" then
do
"attrib -r "PDRLEVEL " > NUL 2>>&1"
"copy "DBD_PATH"\SYSLEVEL.PD1 "PDRLEVEL " >>"LOG" 2>>&1"
"attrib +r "PDRLEVEL " > NUL 2>>&1"
end
"del "DBD_PATH"\SYSLEVEL.WD1 > NUL 2>>&1"
"del "DBD_PATH"\SYSLEVEL.PD1 > NUL 2>>&1"
Done:
/**************************************************************/
/* The installation is now complete, inform the user and exit */
/**************************************************************/
say
say centre(Create_MSG(MSG.25,'WR06015'),50)
say
signal End
/***********************************************************/
/* This routine will be called if the user uses CTRL-BREAK */
/***********************************************************/
HALT:
say
say
say MSG.26
say MSG.27
say
signal End
/* Help panel */
syntax:
say
say " "Create_MSG(MSG.28,'WR06015')
say
say " "MSG.29
say " "MSG.30
say " "Create_MSG(MSG.31,'\OS2\INSTALL')
say " "MSG.32
say " "Create_MSG(MSG.31,'\DBDRQLIB')
say " "MSG.34
say " "Create_MSG(MSG.35,'0.69')
say " "MSG.36
say " "MSG.37
say
say
say " "Create_MSG(MSG.38,'WR06015')
say " WR06015 C C 1 "
say " "MSG.39
say
say
signal End
/*****************************************************************/
/* This routine will take a message and a variable and place the */
/* variable in the proper position in the string. */
/*****************************************************************/
Create_MSG:
parse arg MESSAGE,VARIABLE
PART1 = SUBSTR(MESSAGE,1,POS('%1',MESSAGE)-1)
PART2 = SUBSTR(MESSAGE,POS('%1',MESSAGE)+2)
RETURN PART1 || VARIABLE || PART2
/*********************************************************************/
/* This routine will take a message and two variables and place the */
/* variables in their proper positions in the string. */
/*********************************************************************/
Create_MSG2:
parse arg MESSAGE,VARIABLE1,VARIABLE2
POS1 = POS('%1',MESSAGE)
POS2 = POS('%2',MESSAGE)
PART1 = SUBSTR(MESSAGE,1,POS1-1)
PART2 = SUBSTR(MESSAGE,POS1+2,POS2-POS1-2)
PART3 = SUBSTR(MESSAGE,POS2+2)
RETURN PART1 || VARIABLE1 || PART2 || VARIABLE2 || PART3
/*******************************************************************/
/* This routine will take a message line from the message file */
/* and parse it into a message number and a text string */
/*******************************************************************/
MSG_Parse:
parse arg MESSAGE
TEXT = SUBSTR(MESSAGE,POS(' ',MESSAGE)+1)
message_number = SUBSTR(MESSAGE,1,POS(' ',MESSAGE)-1)
RETURN TEXT
End: