home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / wr07011.zip / db22selp.cmd next >
OS/2 REXX Batch file  |  1993-08-30  |  25KB  |  2 lines

  1. /* DB22SELP CMD */options 'exmode';signal on halt;signal on novalue;signal on syntax;"@echo off";call init;if checkExists(msgFile, 'F') = FALSE then;do;say 'ERROR : Cannot open message file';exit;end;call createMsgArray;parse upper arg selpakName bootDrive db22Drive db22BackUpDrive db22BackUpDir;if selpakName = '' then;signal showSyntax;packageName = getPackageName(selpakName);packageFile = packageName || packageExt;selpakFile  = packageName || '.PKZ';readmeFile  = packageName || '.INF';if checkExists(packageFile, 'F') = FALSE then;do;call displayMsg MSG_PACK_FILE_NOT_FOUND;exit;end;if checkExists(selpakFile, 'F') = FALSE then;do;call displayMsg MSG_SELPAK_FILE_NOT_FOUND;exit;end;if checkExists(readmeFile, 'F') = TRUE then;do;if SysSearchPath('PATH', 'VIEW.EXE') \= '' then;'view' readmeFile;end;if bootDrive = '' then;do;bOneArgumentOnly = TRUE;call SysCls;say DASHES;say centre(msg.MSG_INSTALL_MAIN_TITLE, length(DASHES));say DASHES;say '';end;else;bOneArgumentOnly = FALSE;bootDrive = substr(bootDrive, 1, 1);db22Drive = substr(db22Drive, 1, 1);db22BackupDrive = substr(db22BackupDrive, 1, 1);getInputAgain:;call getBootDrive;call getDB22drive;if bOneArgumentOnly = TRUE then;call getBackupDriveAndDir;say '';call displayMsg MSG_BOOT_DRIVE, SPACING, bootDrive;call displayMsg MSG_DB22_DRIVE, SPACING, db22Drive;if db22BackupDrive = '' then;call displayMsg MSG_NO_BACKUP, SPACING;else;do;if substr(db22BackupDir, 1, 1) \= '\' then;db22BackupDir = '\' || db22BackupDir;db22BackupPath = db22BackupDrive':'db22BackupDir;call displayMsg MSG_BACKUP_PATH, SPACING, db22BackupPath;end;response = '';do while (response \= '0' & response \= '1');say '';call charout , msg.MSG_CHECK_PARAMETERS '';parse upper linein response;end;if response = '0' then;do;bootDrive = '';db22Drive = '';db22BackupDrive = '';db22BackupDir = '';bOneArgumentOnly = TRUE;end;else;signal continueInstall;signal getInputAgain;continueInstall:;if stream(packageFile, 'C', 'open read') \= 'READY:' then;do;call displayMsg MSG_ERR_OPEN_FILE, '', packageFile;exit;end;db22Path = db22Drive':\SQLLIB';ddcsPath = db22Path'\DCSLIB';dosPath = db22Drive':\DBDRQLIB';db22BackupPath = db22BackupPath'\SQLBAK';upmDrive = SysIni(bootDrive':\ibmlvl.ini', 'IBM_UPM', 'PATH');upmDrive = substr(upmDrive, 1, 1);say '';call displayMsg MSG_CHECK_SYS_CONFIG;'stopdbm >nul 2>&1';line1 = linein(packageFile);parse upper var line1 selpakType ourCSDprefix ourPrevCSDlevel ourCSDlevel tempFreeSpace fixFreeSpace backupFreeSpace ourEPWrel ourEPWver ourEPWlevel;line2 = linein(packageFile);say '';call displayMsg MSG_SELPAK_TYPE, '', line2;parse value SysDriveInfo(bootDrive) with . freeBootDriveSpace . .;parse value SysDriveInfo(db22Drive) with . freeTargetDriveSpace . .;if bootDrive = db22Drive then;tempFreeSpace = tempFreeSpace + fixFreeSpace;if db22BackupDrive \= '' then;do;parse value SysDriveInfo(db22BackupDrive) with . freeBackupDriveSpace . .;if bootDrive = db22BackupDrive then;tempFreeSpace = tempFreeSpace + backupFreeSpace;if db22Drive = db22BackupDrive then;fixFreeSpace = fixFreeSpace + backupFreeSpace;if freeBackupDriveSpace < backupFreeSpace then;do;call displayMsg MSG_NOT_ENOUGH_SPACE;exit;end;end;if freeBootDriveSpace < tempFreeSpace then;do;call displayMsg MSG_NOT_ENOUGH_SPACE;exit;end;if freeTargetDriveSpace < fixFreeSpace then;do;call displayMsg MSG_NOT_ENOUGH_SPACE;exit;end;call preInstallChecks;call getCSDlevel selpakType;if (csdNumber \= ourCSDlevel & csdNumber \= ourPrevCSDlevel) | (csdPrefix \= ourCSDprefix) then;do;call displayMsg MSG_MISSING_CSD, '', ourCsdPrefix || ourPrevCSDlevel;exit;end;call getEPWversion;bInstallFFST = FALSE;if epwCSDlevel = 6000 & epwRelease = 1 & epwVersion = 2 then;bInstallFFST = TRUE;else if epwCSDlevel < ourEPWlevel then;bInstallFFST = TRUE;else if epwCSDlevel = ourEPWlevel & epwRelease <= ourEPWrel & epwVersion <= ourEPWver then;bInstallFFST = TRUE;nodeType = getDB22nodeType();say '';call displayMsg MSG_DB22_NODE_TYPE, '', nodeTypeText.nodeType;say '';call displayMsg MSG_BEGIN_PHASE1_INSTALL;do while lines(packageFile) > 0;line = linein(packageFile);if line = '' then iterate;parse upper var line delvName newName targetSA targetServer targetClient targetLDB targetDCF targetFFST targetUPM targetSU targetMU targetDos targetWin dbcsOnly phase;if newName = '#' then;newName = delvName;delvPathName = '#';if selpakType = 'ENGINE' then;do;if targetFFST \= '#' & bInstallFFST = TRUE then;delvPathName = bootDrive || ':' || targetFFST;else if targetUPM \= '#' then;delvPathName = upmDrive || ':' || targetUPM;else if nodeType = SERVER then;delvPathName = db22Drive':' || targetServer;else if nodeType = STANDALONE then;delvPathName = db22Drive':' || targetSA;else if nodeType = CLIENT then;delvPathName = db22Drive':' || targetClient;else if nodeType = CLIENT_W_LDB then;delvPathName = db22Drive':' || targetLDB;else if nodeType = DCF then;delvPathName = db22Drive':' || targetDCF;end;else if selpakType = 'DDCS' then;do;if ddcsType = SINGLE then;delvPathName = db22Drive':' || targetSU;else if ddcsType = MULTI then;delvPathName = db22Drive':' || targetMU;end;else if selpakType = 'QMGR' then;delvPathName = db22Drive':' || targetSA;else if selpakType = 'DBAT' then;delvPathName = db22Drive':' || targetSA;else if selpakType = 'DOS' then;do;if dosType = DOSONLY then;delvPathName = dosPath || targetDOS;else;delvPathName = dosPath || targetWin;end;else;call displayMsg MSG_UNKNOWN_SELPAK_TYPE;if substr(delvPathName, length(delvPathName), 1) = '#' then;iterate;lockedFilePath = bootDrive':\OS2\INSTALL\IBMLANLK' || substr(delvPathName, 3);realName = delvPathName'\'newName;if db22BackupDrive \= '' then;do;db22FullBackupPath = db22BackupPath || substr(delvPathName, 3);if phase = 1 then;do;'copy' realName db22FullBackupPath '> nul 2>>&1';if rc \= 0 then;do;nLockedFiles = nLockedFiles + 1;lockedFileBuffer_Mov.nLockedFiles = 'MOVE' realName db22FullBackupPath'\'newName;end;end;else;do;nLockedFiles = nLockedFiles + 1;lockedFileBuffer_Mov.nLockedFiles = 'MOVE' realName db22FullBackupPath'\'newName;end;end;call getNewFileDateTime delvName;call getOrgFileDateTime realName;if targetFFST \= '#' | targetUPM \= '#' then;call install;else;do;if delvFileLater() then;call install;else;do;response = '';do while response = '';say '';call charout , msg.MSG_LATER_DATE;say '';say '   ====>' realName;say '';call charout , msg.MSG_REPLACE_OR_NOT '';parse upper linein response;if response \= '0' & response \= '1' then;response = '';end;if response = '1' then;call install;end;end;end;call SysFileTree db22Path'\'newSyslevelName, 'filestem', 'F', NORMAL_FILE, '***-*';'attrib -r' db22Path'\'newSyslevelName '>nul 2>&1';'pkunzip -o' selpakFile db22Path newSyslevelName '>nul 2>&1';if selpakType = 'DDCS' then;do;call SysFileTree syslevelFile, 'filestem', 'F', NORMAL_FILE, '***-*';'attrib -r' syslevelFile '>nul 2>&1';'del' syslevelFile '>nul 2>&1';'move' db22Path'\'newSyslevelName substr(syslevelFile, 3) '> nul 2>&1';end;if nLockedFiles > 0 then;do;call SysFileTree bootDrive':\os2\install\ibmlanlk.sys', 'filestem', 'F', NORMAL_FILE, '***-*';call SysFileTree bootDrive':\os2\install\ibmlanlk.exe', 'filestem', 'F', NORMAL_FILE, '***-*';call SysFileTree bootDrive':\os2\install\lsi.msg', 'filestem', 'F', NORMAL_FILE, '***-*';call SysFileTree bootDrive':\os2\install\lsih.msg', 'filestem', 'F', NORMAL_FILE, '***-*';call SysFileTree bootDrive':\os2\install\lsilog.msg', 'filestem', 'F', NORMAL_FILE, '***-*';'pkunzip -o' selpakFile bootDrive':\os2\install ibmlanlk.sys >nul 2>&1';'pkunzip -o' selpakFile bootDrive':\os2\install ibmlanlk.exe >nul 2>&1';'pkunzip -o' selpakFile bootDrive':\os2\install lsi.msg >nul 2>&1';if rc \= 0 then;do;call displayMsg MSG_ERR_OPEN_FILE, '', 'LSI.MSG';call displayMsg MSG_INCONSISTENT_STATE;call displayMsg MSG_ERR_REBOOT_NOW;exit;end;'pkunzip -o' selpakFile bootDrive':\os2\install lsih.msg >nul 2>&1';'pkunzip -o' selpakFile bootDrive':\os2\install lsilog.msg >nul 2>&1';lockFilesList = bootDrive':\os2\install\ibmlanlk.lst';if checkExists(lockFilesList, 'F') then;do;call SysFileTree lockFilesList, 'filestem', 'F', NORMAL_FILE, '***-*';'del' lockFilesList '>nul 2>&1';end;if stream(lockFilesList, 'C', 'open write') \= 'READY:' then;do;call displayMsg MSG_ERR_OPEN_FILE, '', lockFilesList;exit;end;oldConfigSys = bootDrive':\config.sys';if stream(oldConfigSys, 'C', 'open read') \= 'READY:' then;do;call displayMsg MSG_ERR_OPEN_FILE, '', oldConfigSys;exit;end;newConfigSys = SysTempFileName(bootDrive':\config.???');if stream(newConfigSys, 'C', 'open') \= 'READY:' then;do;call displayMsg MSG_ERR_OPEN_FILE, '', newConfigSys;exit;end;do i = 1 to nLockedFiles;call lineout lockFilesList, lockedFileBuffer_Mov.i;end;bDevInsertedAlready = FALSE;bRunInsertedAlready = FALSE;devLine = 'DEVICE=' || bootDrive':\OS2\INSTALL\IBMLANLK.SYS' translate(lockFilesList);runLine = 'RUN=' || bootDrive':\OS2\INSTALL\IBMLANLK.EXE' translate(lockFilesList);do while lines(oldConfigSys) > 0;line = linein(oldConfigSys);if (bDevInsertedAlready = FALSE) then;do;parse upper var line first 'DEVICE' '=' rest;if length(first) = 0 & length(rest) > 0 then;do;bDevInsertedAlready = TRUE;call lineout newConfigSys, devLine;end;end;if (bRunInsertedAlready = FALSE & bDevInsertedAlready = TRUE) then;do;parse upper var line first 'RUN' '=' rest;if length(first) = 0 & length(rest) > 0 then;do;bRunInsertedAlready = TRUE;call lineout newConfigSys, runLine;end;end;call lineout newConfigSys, line;end;call stream newConfigSys, 'c', 'close';call stream oldConfigSys, 'c', 'close';call SysFileTree oldConfigSys, 'filestem', 'F', NORMAL_FILE, '***-*';'attrib -r' oldConfigSys '>nul 2>&1';'copy' newConfigSys oldConfigSys '>nul 2>&1';'del' newConfigSys '>nul 2>&1';call stream lockFilesList, 'c', 'close';'pkunzip -o' selpakFile db22Path 'db22eof >nul 2>&1';'copy' lockFilesList'+'db22Path'\db22eof' lockFilesList '>nul 2>&1';'del' db22Path'\db22eof >nul 2>&1';end;call stream packageFile, 'c', 'close';call stream msgFile, 'c', 'close';call setIBMLVL;say '';if nLockedFiles > 0 then;do;say DASHES;say centre(msg.MSG_COMPLETION_1, length(DASHES));say centre(msg.MSG_COMPLETION_2, length(DASHES));say DASHES;end;else;do;say DASHES;say centre(msg.MSG_SUCCESSFUL_COMPLETION, length(DASHES));say DASHES;end;exit;init:;if Rxfuncquery('SysLoadFuncs') <> 0 then;call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';call SysLoadFuncs;if Rxfuncquery('SQLDBS') <> 0 then;call RxFuncAdd 'SQLDBS', 'SQLAR', 'SQLDBS';db22BackupPath = '';TRUE  = 1;FALSE = 0;NORMAL_FILE = '**-*-';packageExt = '.pac';SPACING = '  ';STANDALONE   = 0;SERVER       = 1;CLIENT       = 2;CLIENT_W_LDB = 3;DCF          = 4;DDCS_SU      = '3060';SINGLE       = 0;MULTI        = 1;DOSONLY      = 0;DASHES = '------------------------------------------------------------';msgFile = 'db22selp.msg';newConfigSys = '';oldConfigSys = '';lockFilesList = '';packageFile = '';logFile = 'db22selp.log';call lineout logFile, '';call lineout logFile, DASHES;call lineout logFile, date() '  ' time();call lineout logFile, DASHES;nodeTypeText.0 = 'Standalone';nodeTypeText.1 = 'Server';nodeTypeText.2 = 'Client';nodeTypeText.3 = 'Client with Local Database';nodeTypeText.4 = 'DCF Client';nLockedFiles = 0;MSG_SHOW_SYNTAX1              = 1;MSG_SHOW_SYNTAX2              = 2;MSG_SHOW_SYNTAX3              = 3;MSG_SHOW_SYNTAX4              = 4;MSG_SHOW_SYNTAX5              = 5;MSG_SHOW_SYNTAX6              = 6;MSG_SHOW_SYNTAX7              = 7;MSG_PACK_FILE_NOT_FOUND       = 8;MSG_ERR_GET_NODE              = 9;MSG_GET_BOOT_DRIVE            = 10;MSG_ERR_INVALID_BOOT_DRIVE    = 11;MSG_GET_DB22_DRIVE            = 12;MSG_ERR_INVALID_DB22_DRIVE    = 13;MSG_ERR_INVALID_BACKUP_DRIVE  = 14;MSG_GET_DB22BU_DRIVE          = 15;MSG_GET_BACKUP_DIR            = 16;MSG_CHECK_PARAMETERS          = 17;MSG_BOOT_DRIVE                = 18;MSG_DB22_DRIVE                = 19;MSG_NO_BACKUP                 = 20;MSG_BACKUP_PATH               = 21;MSG_INSTALL_MAIN_TITLE        = 22;MSG_ERR_PKZ_NOT_FOUND         = 23;MSG_ERR_LCKSYS_NOT_FOUND      = 24;MSG_ERR_OPEN_FILE             = 25;MSG_ERROR_OPEN_SYSLEVEL       = 26;MSG_ERR_GET_PROFILE_INFO      = 27;MSG_ERR_SET_PROFILE_INFO      = 28;MSG_NOT_ENOUGH_SPACE          = 29;MSG_SELPAK_FILE_NOT_FOUND     = 30;MSG_LATER_DATE                = 31;MSG_REPLACE_OR_NOT            = 32;MSG_COMPLETION_1              = 33;MSG_COMPLETION_2              = 34;MSG_MISSING_CSD               = 35;MSG_BEGIN_PHASE1_INSTALL      = 36;MSG_UNKNOWN_SELPAK_TYPE       = 37;MSG_DB22_NODE_TYPE            = 38;MSG_CHECK_SYS_CONFIG          = 39;MSG_ARROWS                    = 40;MSG_SELPAK_TYPE               = 41;MSG_SUCCESSFUL_COMPLETION     = 42;MSG_REBOOT_OR_NOT             = 43;MSG_INCONSISTENT_STATE        = 44;MSG_ERR_REBOOT_NOW            = 45;return;showSyntax:;say msg.MSG_SHOW_SYNTAX1;say SPACING msg.MSG_SHOW_SYNTAX2;say SPACING msg.MSG_SHOW_SYNTAX3;say SPACING msg.MSG_SHOW_SYNTAX4;say SPACING msg.MSG_SHOW_SYNTAX5;say SPACING msg.MSG_SHOW_SYNTAX6;say SPACING msg.MSG_SHOW_SYNTAX7;exit;getBootDrive:;do while bootDrive = '';call charout , msg.MSG_GET_BOOT_DRIVE '';parse upper linein bootDrive;bootDrive = substr(bootDrive, 1, 1);temp = bootDrive':\os2\install';if checkExists(temp, 'D') = FALSE then;do;call displayMsg MSG_ERR_INVALID_BOOT_DRIVE;bootDrive = '';end;end;return;getDB22drive:;do while db22Drive = '';call charout , msg.MSG_GET_DB22_DRIVE '';parse upper linein db22Drive;db22Drive = substr(db22Drive, 1, 1);db22Path = db22Drive':\sqllib';if checkExists(db22Path, 'D') = FALSE then;do;call displayMsg MSG_ERR_INVALID_DB22_DRIVE;db22Drive = '';end;end;return;getBackupDriveAndDir:;bValidBackupDrive = FALSE;do while bValidBackupDrive = FALSE;call charout , msg.MSG_GET_DB22BU_DRIVE '';parse upper linein db22BackupDrive;if db22BackupDrive \= '' then;do;db22BackupDrive = substr(db22BackupDrive, 1, 1);temp = db22BackupDrive':\';if checkExists(temp, 'D') = TRUE then;do;do while db22BackupDir = '';call charout , msg.MSG_GET_BACKUP_DIR '';parse upper linein db22BackupDir;end;bValidBackupDrive = TRUE;end;else;call displayMsg MSG_ERR_INVALID_BACKUP_DRIVE;end;else;bValidBackupDrive = TRUE;end;return;createMsgArray:;nMessages = 0;do while lines(msgFile) > 0;nMessages = nMessages + 1;msg.nMessages = linein(msgFile);end;call stream msgFile, 'c', 'close';return;getPackageName:;arg inputName;dotPos = pos('.', inputName);if dotPos \= 0 then;outputName = substr(inputName, 1, dotPos-1);else;outputName= inputName;return outputName;getDB22nodeType:;sqlToken.0 = 2;sqlToken.1 = 100;call SQLDBS 'GET DATABASE MANAGER CONFIGURATION USING :sqlToken';if SQLCA.SQLCODE \= 0 then;do;call displayMsg MSG_ERR_GET_NODE;exit;end;if sqlToken.2 = CLIENT & newSyslevelName = 'syslevel.sqd' then;sqlToken.2 = DCF;return sqlToken.2;getEPWversion:;epwSyslevel = bootDrive':\os2\syslevel.epw';if checkExists(epwSyslevel, 'F') = TRUE then;do;line1 = linein(epwSyslevel);call stream epwSyslevel, 'c', 'close';epwCSDlevel = substr(line1, 48, 4);temp = c2x(substr(line1, 41, 1));epwRelease = substr(temp, 1, 1);temp = substr(temp, 2, 1);epwVersion = temp || substr(c2x(substr(line1, 42, 1)), 2, 1);end;else;do;ibmlvl = bootDrive':\ibmlvl.ini';epwRelease = SysIni(ibmlvl, 'IBM_FFDC', 'RELEASE');if epwRelease = 'ERROR:' then;do;call displayMsg MSG_ERR_GET_PROFILE_INFO;exit;end;epwRelease = substr(epwRelease, 1, length(epwRelease)-1);epwVersion = SysIni(ibmlvl, 'IBM_FFDC', 'VERSION');if epwVersion = 'ERROR:' then;do;call displayMsg MSG_ERR_GET_PROFILE_INFO;exit;end;epwVersion = substr(epwVersion, 1, length(epwVersion)-1);epwCSDlevel = SysIni(ibmlvl, 'IBM_FFDC', 'CURRCSD');if epwCsdLevel = 'ERROR:' then;do;call displayMsg MSG_ERR_GET_PROFILE_INFO;exit;end;epwCSDlevel = substr(epwCSDlevel, 4, 4);end;return;setEPWversion:;newVal = ourEPWrel || d2c(0);ret = SysIni(ibmlvl, 'IBM_FFDC', 'RELEASE', newVal);if ret = 'ERROR:' then;do;call displayMsg MSG_ERR_SET_PROFILE_INFO;exit;end;newVal = ourEPWver || d2c(0);ret = SysIni(ibmlvl, 'IBM_FFDC', 'VERSION', newVal);if ret = 'ERROR:' then;do;call displayMsg MSG_ERR_SET_PROFILE_INFO;exit;end;newVal = ourCSDprefix || ourEPWlevel || d2c(0);ret = SysIni(ibmlvl, 'IBM_FFDC', 'CURRCSD', newVal);if ret = 'ERROR:' then;do;call displayMsg MSG_ERR_SET_PROFILE_INFO;exit;end;return;getCSDlevel:;arg selpakType;engnSyslevel.1 = db22Path'\syslevel.sql';engnSyslevel.2 = db22Path'\syslevel.sqc';engnSyslevel.3 = db22Path'\syslevel.sqd';csdPrefix = '000';csdNumber = -1;if selpakType = 'ENGINE' then;do;do i = 1 to 3;syslevelFile = engnSyslevel.i;if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);newSyslevelName = filespec('name', syslevelFile);return;end;end;end;else if selpakType = 'DDCS' then;do;syslevelFile = ddcsPath'\syslevel.dcs';if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);sysID = substr(firstLine, 38, 2);sysID = c2x(sysID);if sysID = DDCS_SU then;do;ddcsType = SINGLE;newSyslevelName = 'SYSLEVEL.DSS';end;else;do;ddcsType = MULTI;newSyslevelName = 'SYSLEVEL.DMS';end;return;end;end;else if selpakType = 'QMGR' then;do;syslevelFile = db22Path'\syslevel.qrw';newSyslevelName = 'SYSLEVEL.QRW';if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);return;end;end;else if selpakType = 'DOS' then;do;syslevelFile = dosPath'\syslevel.pdr';if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);newSyslevelName = 'SYSLEVEL.PDR';return;end;syslevelFile = dosPath'\syslevel.wdc';if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);newSyslevelName = 'SYSLEVEL.WDC';return;end;end;else if selpakType = 'DBAT' then;do;syslevelFile = db22Path'\syslevel.dba';newSyslevelName = '\syslevel.dba';if checkExists(syslevelFile, 'F') then;do;firstLine = linein(syslevelFile);call stream syslevelFile, 'c', 'close';csdPrefix = substr(firstLine, 45, 3);csdNumber = substr(firstLine, 48, 4);return;end;end;else;do;call displayMsg MSG_ERROR_OPEN_SYSLEVEL;exit;end;preInstallChecks:;if SysSearchPath('PATH', 'pkunzip.EXE') = '' then;do;call displayMsg MSG_ERR_PKZ_NOT_FOUND;exit;end;temp = bootDrive':\os2\install\ibmlanlk';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\sqllib';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\sqllib\dll';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\sqllib\reqdll';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\sqllib\saldll';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;if selpakType = 'DDCS' then;do;temp = bootDrive':\os2\install\ibmlanlk\sqllib\dcslib';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;end;temp = bootDrive':\os2\install\ibmlanlk\os2';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\os2\dll';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\os2\help';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = bootDrive':\os2\install\ibmlanlk\os2\install';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;if db22BackupDrive \= '' then;do;temp = db22BackupDrive':'db22BackupDir;if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\SQLLIB';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\SQLLIB\DLL';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\SQLLIB\REQDLL';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\SQLLIB\SALDLL';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;if selpakType = 'DDCS' then;do;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\SQLLIB\DCSLIB';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;end;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\OS2';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\OS2\DLL';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\OS2\HELP';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;temp = db22BackupDrive':'db22BackupDir'\SQLBAK\OS2\INSTALL';if checkExists(temp, 'D') = FALSE then;call SysMkDir temp;end;return;checkExists:;arg fileName, dirFileFlag;call SysFileTree fileName, 'filestem', dirFileFlag, NORMAL_FILE;if (result = 0) & (filestem.0 > 0) then;return TRUE;else;return FALSE;getNewFileDateTime:;arg fileName;'pkunzip -v' selpakFile fileName '| rxqueue';do i = 1 to queued();pull pkunzipLine.i;end;parse var pkunzipLine.10 . . . . delvDate delvTime .;return;getOrgFileDateTime:;arg fileName;call SysFileTree filename, 'filestem', 'F', NORMAL_FILE;if (result = 0) & (filestem.0 > 0) then;parse var filestem.1 orgFileDate orgFileTime . . .;else;do;orgFileDate = '00/00/00';orgFileTime = '00:00a';end;return;delvFileLater:;colonPos1 = pos('/', orgFileDate);orgMM = substr(orgFileDate, 1, colonPos1-1);colonPos2 = pos('/', orgFileDate, colonPos1+1);orgDD = substr(orgFileDate, colonPos1+1, colonPos2-colonPos1-1);orgYY = substr(orgFileDate, colonPos2+1);colonPos1 = pos(':', orgFileTime);orgHH = substr(orgFileTime, 1, colonPos1-1);orgMin = substr(orgFileTime, colonPos1+1);ampm = substr(orgMin, 3, 1);orgMin = substr(orgMin, 1, 2);if ampm = 'p' & orgHH < 12 then;orgHH = orgHH + 12;else if ampm = 'a' & orgHH = 12 then;orgHH = orgHH - 12;newMM = substr(delvDate, 1, 2);newDD = substr(delvDate, 4, 2);newYY = substr(delvDate, 7, 2);newHH  = substr(delvTime, 1, 2);newMin = substr(delvTime, 4, 2);newDate = newYY * 100 + newMM * 31 + newDD;orgDate = orgYY * 100 + orgMM * 31 + orgDD;newTime = newHH * 60 + newMin;orgTime = orgHH * 60 + orgMin;if newDate < orgDate then;return FALSE;else if newDate > orgDate then;return TRUE;if newTime < orgTime then;return FALSE;return TRUE;install:;call displayMsg MSG_ARROWS, SPACING, realName;call SysFileTree realName, 'filestem', 'F', NORMAL_FILE, '***-*';delvFullName = delvPathName || '\'delvName;lockedFullName = lockedFilePath || '\'newName;if phase = '1' then;do;'pkunzip -o' selpakFile delvPathName delvName '>nul 2>&1';if rc \= 0 then;do;nLockedFiles = nLockedFiles + 1;'pkunzip -o' selpakFile lockedFilePath delvName '>nul 2>&1';lockedFileBuffer_Mov.nLockedFiles = 'MOVE' lockedFilePath || '\' || delvName realName;end;else;do;if delvName \= newName then;do;'copy' delvFullName realName '>nul 2>>&1';if rc \= 0 then;do;nLockedFiles = nLockedFiles + 1;'copy' delvFullName lockedFullName '>nul 2>>&1';'del' delvFullName '>nul 2>&1';lockedFileBuffer_Mov.nLockedFiles = 'MOVE' lockedFullName realName;end;else;'del' delvFullName '>nul 2>&1';end;end;end;else;do;nLockedFiles = nLockedFiles + 1;'pkunzip -o' selpakFile lockedFilePath delvName '>nul 2>&1';if delvName \= newName then;do;'copy' lockedFilePath || '\'delvName lockedFullName '>nul 2>>&1';'del' lockedFilePath || '\'delvName '>nul 2>>&1';end;lockedFileBuffer_Mov.nLockedFiles = 'MOVE' lockedFullName realName;end;return;displayMsg:;arg msgIndex, preMsg, extraMsg1, extraMsg2, extraMsg3;call lineout logFile, '';call lineout logFile, preMsg msg.msgIndex extraMsg1 extraMsg2 extraMsg3;say preMsg msg.msgIndex extraMsg1 extraMsg2 extraMsg3;return;setIBMLVL:;ibmlvl = bootDrive':\ibmlvl.ini';call SysFileTree ibmlvl, 'filestem', 'F', NORMAL_FILE, '***-*';'attrib -r' ibmlvl '>nul 2>&1';newVal = ourCSDprefix || ourCSDlevel || d2c(0);if selpakType = 'DDCS' then;ret = SysIni(ibmlvl, 'IBM_DDCS', 'CURRCSD', newVal);else;ret = SysIni(ibmlvl, 'IBM_DB', 'CURRCSD', newVal);if ret = 'ERROR:' then;do;call displayMsg MSG_ERR_SET_PROFILE_INFO;exit;end;if bInstallFFST = TRUE then;call setEPWversion;call SysFileTree ibmlvl, 'filestem', 'F', NORMAL_FILE, '***+*';return;syntax:;source = sigl;say 'A SYNTAX condition was raised on line' sigl;say 'Return code =' rc;say '===>' Errortext(rc);signal abnormalEnd;halt:;call stream newConfigSys, 'c', 'close';call stream oldConfigSys, 'c', 'close';call stream lockFilesList, 'c', 'close';call stream packageFile, 'c', 'close';call stream msgFile, 'c', 'close';say 'User Termination';exit;novalue:;source = sigl;say 'A NOVALUE condition was raised on line' sigl;say 'The variable is' Condition('Description');signal abnormalEnd;abnormalEnd:;say Sourceline(source);exit;
  2.