/**************************************************************************/
/* Self test environment set up routine - original coding 02-09-97        */
/* Rich Bassemir (Austin Integration Test Lab)                            */
/*                                                                        */
/* Simple Rexx cmd file to prepare the domain controller,                 */
/* the additional server, and both requesters for running                 */
/* the network test cases.  This command file should be used              */
/* only if the environment set up guidelines were followed.               */
/*                                                                        */
/* NOTE: THIS ROUTINE  EXPECTS THE NAMING CONVENTIONS WERE                */
/* FOLLOWED WHEN SETTING UP THE TEST ENVIRONMENT                          */
/*                                                                        */
/*                                                                        */
/* A log file is kept to record the success or failure                    */
/*                                                                        */
/* 2-13-97 R.Bassemir Added the update for R02 to update the WCLDIAL file */
/*                    so there is an ITL entry in the phone book          */
/* 2-17-97 R.Bassemir Added the setup of R01 peer services                */
/* 3-25-97 R.Bassemir Change data_files routine to cd to itlutil and back */
/* 3-28-97 R.Bassemir Fix to have comp.rsp copied to Domain initially     */
/* 3-28-97 R.Bassemir Change to put ITL TEST .CMD's in \lancmd dir        */
/* 6-09-97 R.Bassemir Created log directories, log shares, tcpip remote   */
/*                    execution set up, use of boot drive (instead of c:) */
/*                    data files to R01, and more (RTB)                   */
/* 6-17-97 S.Hudson   Erased .dat files before creating them to avoid     */
/*                    making them bigger when setup is re-run.            */
/* 6-27-97 S.Hudson   Added the resync to the additional server setup     */
/*                    to be sure the system comes up in sync with domain  */
/* 7-25-97 S.Hudson   Fix to startup.cmd and config.sys processing to     */
/*                    save to .os2 if not there, then update correctly.   */
/* 7-28-97 S.Hudson   Added ability to setup R03->R12 and S02             */
/* 8-08-97 S.Hudson   Fix to req startup.cmd to add NET START if not fnd  */
/* 8-20-97 S.Hudson   Change to use current drive for install (cd or a)   */
/* 8-21-97 S.Hudson   Change to copy files from load drive instead of     */
/*                    copy from domain controller - needed for LAN Load.  */
/*                    Change data_files to work for D01,S01,S02, and R01  */
/* 8-21-97 S.Hudson   Add copy new startup.cmd to os2\startup.tst so base */
/*                    autotesting restores a startup.cmd with LAN updts.  */
/* 9-11-97 S.Hudson   Remove NET START Alerts from startup.cmd for Server */
/* 9-23-97 S.Hudson/R.Bassemir - fix net definition for server/user/alias */
/*                               names for rerun of lansetup.             */
/* 2-03-99 S.Hudson   Add BACKACC before adding any users,alias,etc...    */
/* 2-13-99 S.Hudson   Move create of ITLUTIL directory to top of lansetup.*/
/* 2-13-99 S.Hudson   Change copy of LANSETUP.LOG to ITLUTIL\LANSETUP.xxx.*/
/**************************************************************************/

/*trace ?r */
arg  server  source  Logfile .

server=strip(server)
source=strip(source)
logfile=strip(logfile)

CALL RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
Call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call RxFuncAdd 'SysFileSearch','RexxUtil','SysFileSearch'
Call SysLoadFuncs

grepchk = '-Ny -r'
rcx = value('grepopt',grepchk,'OS2ENVIRONMENT');

/**************************************************************/
/* OS2 ENVIRONMENT VARIABLE COMSPEC= TO FIND OS/2 BOOT DRIVE. */
/**************************************************************/
cmspec = value('COMSPEC',,'OS2ENVIRONMENT');
os2drv = left(cmspec,1)||':'

os2cfg  = left(os2drv,1);                       /* get only the drive letter */
/*-------------------------------------------------------------------------- */
currdir=directory();           /* use REXX DIRECTORY to determine LOAD drive */
cddrv = left(currdir,1);

/*----------------------------------------------------------*/
/* Go to OS2 Boot Drive and create initial PCM directories. */
/*----------------------------------------------------------*/
os2drv
'cd \'
'md pcmlogs'
'md itlutil'

/* ------------------------------------------------------------------------- */
verfile = os2drv'\pcmlogs\os2rel.ver'
'ver /r >'verfile
x=stream(verfile,'c','open read');
verline1 = LINEIN(verfile);
verline2 = LINEIN(verfile);
verline3 = LINEIN(verfile);
x=stream(verfile,'c','close')
parse value verline2 with frntpart '.' backpart;
num1 = right(frntpart,1);
num23 = left(backpart,2)
rellvl = num1 || '.' || num23;

/*---------------------------------------------------------------------------*/
if logfile = "" then logfile = os2drv||"\itlutil\lansetup.log"


/****************************************************************/
/* Determine the netbios name for this workstation              */
/****************************************************************/
call SysFileSearch 'Computername',os2drv'\ibmlan\ibmlan.ini','file.'
target = strip(subword(file.1,3,1))

if target = 'IT01D01' then do
   call RD01
   end
else
if target = 'IT01S01' then do
   call RS01
   end
else
if target = 'IT01R01' then do
   call RR01
   end
else
if target = 'IT01R02' then do
   call RR02
   end
else
if target = 'IT01S02' then do
   call RS02
   end
else do
     call GENREQ   /* setup for requesters r03 through r12 allowed */
     end

say 'Setup Completed Successfully.'
Exit

/********************* Domain setup for D01 ************************/
RD01:
os2drv
'cd \'
'md d01logs'
'cd itlutil'
'md cube'
'cd \'
res=lineout(logfile,'>>>> Start of Log for Domain, time='time()' date='date())
res=lineout(logfile)

call edit_startupdc
call data_files
call load_itlutildc

'LOGON USERID /P=PASSWORD /D:IT01D01D 1>> 'logfile' 2>>&1'
if rc <> 0 then Exit 101

call add_server_d01
call add_users_d01
call add_shares_d01

res=lineout(logfile,'>>>> Domain completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.d01'
Return



/********************* Additional Server Setup for S01 *************/
RS01:
os2drv
'cd \'
'md s01logs'

res=lineout(logfile,'>>>> Start of Log for Additional server 1, time='time()' date='date())
res=lineout(logfile)

call edit_startups1
call data_files
call load_itlutils1

'LOGON IT01S01A /P:APW01S01 /V:D  1>> 'logfile' 2>>&1'
if rc <> 0 then Exit 101

call add_shares_s01
call resync_sys

res=lineout(logfile,'>>>> Additional server 1 setup completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.s01'
Return



/********************* Requester one setup  ************************/
RR01:
os2drv
'cd \'
'md r01logs'

'md itlutil\os2peer'
res=lineout(logfile,'>>>> Start of Log for Requester #1, time='time()' date='date())
res=lineout(logfile)

call edit_startupreq
call data_files
call load_itlutilr01

call setup_peer

res=lineout(logfile,'>>>> Requester #1 completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.r01'
return



/********************* Requester two setup  ************************/
RR02:
os2drv
'cd \'
'md r02logs'

res=lineout(logfile,'>>>> Start of Log for Requester #2, time='time()' date='date())
res=lineout(logfile)

call edit_startupreq
call load_itlutilr02
call edit_wcldial

res=lineout(logfile,'>>>> Requester #2 setup completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.r02'
Return



/*******************************************************************/
/* FOLLOWING SECTIONS ARE ADDED FOR CUSTOMERS WHO WISH TO INSTALL  */
/* A SECOND ADDITIONAL SERVER, OR REQUESTERS R03-->R12             */
/*******************************************************************/


/********************* Additional Server Setup for S02 *************/
RS02:
os2drv
'cd \'
'md s02logs'

res=lineout(logfile,'>>>> Start of Log for Additional server 2, time='time()' date='date())
res=lineout(logfile)


call edit_startups2
call data_files
call load_itlutils2

'LOGON IT01S02A /P:APW01S02 /V:D  1>> 'logfile' 2>>&1'
if rc <> 0 then Exit 101

call add_shares_s02
call resync_sys

res=lineout(logfile,'>>>> Additional server 2 setup completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.s02'
Return



/********************* GENERIC Requester Setup *********************/
GENREQ:
os2drv
'cd \'

reqname = substr(target,5,3)       /* get last 3 chars of target name       */
userid=target||u                   /* set userid to IT01xxxU  xxx = reqname */
password=upw||substr(target,3,5)   /* set password to UPW01xxx              */

'md 'reqname'logs'


res=lineout(logfile,'>>>> Start of Log for 'target' Generic Requester, time='time()' date='date())
res=lineout(logfile)

call edit_startupgenreq
call load_itlutilgenreq

res=lineout(logfile,'>>>> Requester 'reqname' setup completed successfully, time='time())
res=lineout(logfile)
'copy 'logfile' 'os2drv||'\itlutil\lansetup.'reqname
Return



add_server_d01:
/**************************************************************/
'NET USER IT01S01 /ADD /ACTIVE:NO /PRIVILEGE:USER /PASSWORDREQ:NO /USERCOMMENT:"System ID - Server" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 102

'NET GROUP SERVERS IT01S01 /A 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 1) then call setup_error 103

'NET USER IT01S02 /ADD /ACTIVE:NO /PRIVILEGE:USER /PASSWORDREQ:NO /USERCOMMENT:"System ID - Server" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 104

'NET GROUP SERVERS IT01S02 /A 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 1) then call setup_error 105

res=lineout(logfile,'>>>> Additional servers defined successfully on D01, time='time())
res=lineout(logfile)
return



add_users_d01:
/**************************************************************/
'NET USER IT01D01A APW01D01 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01D01A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 110
'NET USER IT01D01U UPW01D01 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01D01U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 111
'NET USER IT01S01A APW01S01 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01S01A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 112
'NET USER IT01S01U UPW01S01 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01S01U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 113
'NET USER IT01S02A APW01S02 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01S02A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 114
'NET USER IT01S02U UPW01S02 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01S02U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 115
'NET USER IT01R01A APW01R01 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R01A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 116
'NET USER IT01R01U UPW01R01 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R01U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 117
'NET USER IT01R02A APW01R02 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R02A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 118
'NET USER IT01R02U UPW01R02 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R02U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 119
'NET USER IT01R03A APW01R03 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R03A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 120
'NET USER IT01R03U UPW01R03 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R03U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 121
'NET USER IT01R04A APW01R04 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R04A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 122
'NET USER IT01R04U UPW01R04 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R04U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 123
'NET USER IT01R05A APW01R05 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R05A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 124
'NET USER IT01R05U UPW01R05 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R05U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 125
'NET USER IT01R06A APW01R06 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R06A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 126
'NET USER IT01R06U UPW01R06 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R06U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 127
'NET USER IT01R07A APW01R07 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R07A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 128
'NET USER IT01R07U UPW01R07 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R07U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 129
'NET USER IT01R08A APW01R08 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R08A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 130
'NET USER IT01R08U UPW01R08 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R08U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 131
'NET USER IT01R09A APW01R09 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R09A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 132
'NET USER IT01R09U UPW01R09 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R09U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 133
'NET USER IT01R10A APW01R10 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R10A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 134
'NET USER IT01R10U UPW01R10 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R10U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 135
'NET USER IT01R11A APW01R11 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R11A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 136
'NET USER IT01R11U UPW01R11 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R11U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 137
'NET USER IT01R12A APW01R12 /ADD /PRIVILEGE:ADMIN /USERCOMMENT:"ADMIN Userid for IT01R12A" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 138
'NET USER IT01R12U UPW01R12 /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R12U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 139
'NET USER TEST TEST /ADD /PRIVILEGE:USER /USERCOMMENT:"USER Userid for IT01R02U" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 140
res=lineout(logfile,'>>>> Users added to the Domain successfully on D01, time='time())
res=lineout(logfile)
return



add_shares_d01:
/**************************************************************/
'NET ALIAS DOMROOT \\IT01D01 'os2drv'\ITLUTIL /R:"ITLUTIL directory on D01" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 150
'NET ACCESS 'os2drv'\ITLUTIL /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 151
'NET ACCESS 'os2drv'\ITLUTIL /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 152
'NET ACCESS 'os2drv'\ITLUTIL /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 153

'NET ALIAS D01LOGS \\IT01D01 'os2drv'\D01LOGS /R:"LOGS directory on D01" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 154
'NET ACCESS 'os2drv'\D01LOGS /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 155
'NET ACCESS 'os2drv'\D01LOGS /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 156
'NET ACCESS 'os2drv'\D01LOGS /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 157

res=lineout(logfile,'>>>> Shared resources added successfully on D01, time='time())
res=lineout(logfile)
return



data_files:
/******************************/
if target = 'IT01R01' then do
   'cd \itlutil\os2peer'
   end
else do
     'cd \itlutil'
     end
/******************************/
/* Build a 1 meg file first   */
/******************************/
'erase 1mb.dat 2>nul'       /* erase the file if it exists */
do 102
 LINEDATA='...OS/2 was here...987654321098765432109876543210987654321098976543210'
 count = 0
 ones = 0
 do until count = 60
  res = lineout('1mb.dat',linedata)
  res = lineout('1mb.dat')
  linedata = ones||substr(linedata,1,78)
  ones = ones + 1
  if ones > 9 then ones = 0
  count = count +1
 end
 count = 0
 ones = 9
 do until count = 61
  res = lineout('1mb.dat',linedata)
  res = lineout('1mb.dat')
  linedata = substr(linedata,2,78)||ones
  ones = ones - 1
  if ones < 0 then ones = 9
  count = count +1
 end
end /* do 102 loop */

/**********************************************************/
/* Now that the 1 meg file is built, build the 2 MB file  */
/**********************************************************/
'erase 2mb.dat 2>nul'       /* erase the file if it exists */
'copy 1mb.dat 2mb.dat 1>> 'logfile' 2>>&1'
'copy 2mb.dat+1mb.dat 1>> 'logfile' 2>>&1'
/**********************************************************/
/* Now that the 2 meg file is built, build the 4 MB file  */
/**********************************************************/
'erase 4mb.dat 2>nul'       /* erase the file if it exists */
'copy 2mb.dat 4mb.dat 1>> 'logfile' 2>>&1'
'copy 4mb.dat+2mb.dat 1>> 'logfile' 2>>&1'
/**********************************************************/
/* Now that the 4 meg file is built, build the 8 MB file  */
/**********************************************************/
'erase 8mb.dat 2>nul'       /* erase the file if it exists */
'copy 4mb.dat 8mb.dat 1>> 'logfile' 2>>&1'
'copy 8mb.dat+4mb.dat 1>> 'logfile' 2>>&1'
/**********************************************************/
/* Build a separate 2 MB file for FTP test case           */
/**********************************************************/
'erase 2mb.ftp 2>nul'       /* erase the file if it exists */
'copy 2mb.dat 2mb.ftp 1>> 'logfile' 2>>&1'
/**********************************************************/
/* Build a   smaller file for lan distance remote tests   */
/**********************************************************/
'erase 1k.dat 2>nul'       /* erase the file if it exists */
 LINEDATA='...OS/2 was here...987654321098765432109876543210987654321098976543210'
 count = 0
 ones = 0
 do until count = 6
  res = lineout('1k.dat',linedata)
  res = lineout('1k.dat')
  linedata = ones||substr(linedata,1,78)
  ones = ones + 1
  if ones > 9 then ones = 0
  count = count +1
 end
 count = 0
 ones = 9
 do until count = 7
  res = lineout('1k.dat',linedata)
  res = lineout('1k.dat')
  linedata = substr(linedata,2,78)||ones
  ones = ones - 1
  if ones < 0 then ones = 9
  count = count +1
 end
/*******************************************************/
/* Now that 1K file is built, build the others         */
/*******************************************************/
'erase 2k.dat 2>nul'    /* erase the file if it exists */
'copy 1k.dat 2k.dat 1>> 'logfile' 2>>&1'
'copy 2k.dat+1k.dat 1>> 'logfile' 2>>&1'
/********************************************************/
/* Now that the 2K file is built, build the 4K file     */
/********************************************************/
'erase 4k.dat 2>nul'     /* erase the file if it exists */
'copy 2k.dat 4k.dat 1>> 'logfile' 2>>&1'
'copy 4k.dat+2k.dat 1>> 'logfile' 2>>&1'
/********************************************************/
/* Now that the 4K file is built, build the 8K file     */
/********************************************************/
'erase 8k.dat 2>nul'     /* erase the file if it exists */
'copy 4k.dat 8k.dat 1>> 'logfile' 2>>&1'
'copy 8k.dat+4k.dat 1>> 'logfile' 2>>&1'
/********************************************************/
/********************************************************/
/* Now that the 8K file is built, build the 16K file    */
/********************************************************/
'erase 16k.dat 2>nul'    /* erase the file if it exists */
'copy 8k.dat 16k.dat 1>> 'logfile' 2>>&1'
'copy 16k.dat+8k.dat 1>> 'logfile' 2>>&1'
/********************************************************/
res=lineout(logfile,'>>>> Data files built successfully on D01, time='time())
res=lineout(logfile)

'cd \'
return



load_itlutildc:
/*******************************************************/
/* Copy the test cases to the itlutil directory on D01 */
/*******************************************************/
'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls57.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlmsg.cmd    'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itltcp01.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\resync.cmd    'os2drv'\itlutil 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\itldump.*     'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlpsns.*     'os2drv'\itlutil 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\*.*           'os2drv'\itlutil 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\hosts         'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts        'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\trusers       'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.d01  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\cube\*.*             'os2drv'\itlutil\cube  1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Test files transfered successfully on D01, time='time())
res=lineout(logfile)
return



edit_startupdc:
/*****************************************************************************/
if stream(os2drv'\startup.cmd','c','query exists') = '' then do   /* no cmd */
     res=lineout(logfile,'>>>> STARTUP.CMD was NOT found on DOMAIN System  time='time())
     res=lineout(logfile)
     say '[1;09;41m  *****************************************************[0;40;37m';
     say '[1;09;41m  *** Could NOT find 'os2drv'\STARTUP.CMD                  ***[0;40;37m';
     say '[1;09;41m  ***                                               ***[0;40;37m';
     say '[1;09;41m  *** Startup.cmd should have been created during   ***[0;40;37m';
     say '[1;09;41m  *** Domain installation with the following lines. ***[0;40;37m';
     say '[1;09;41m  ***  NET START SERVER                             ***[0;40;37m';
     say '[1;09;41m  ***  @IF ERRORLEVEL 2 C:\IBMLAN\NETPROG\LSERR.EXE ***[0;40;37m';
     say '[1;09;41m  ***  EXIT                                         ***[0;40;37m';
     say '[1;09;41m  *****************************************************[0;40;37m';
     'echo 'NET START SERVER'  > 'os2drv'\startup.cmd'
     'echo '@IF ERRORLEVEL 2 C:\IBMLAN\NETPROG\LSERR.EXE' >> 'os2drv'\startup.cmd'
     'echo 'EXIT'             >> 'os2drv'\startup.cmd'
     res=lineout(logfile,'>>>> STARTUP.CMD created on DOMAIN CONTROLLER')
     res=lineout(logfile)
     end

if stream(os2drv'\startup.os2','c','query exists') = '' then do   /* no os2 */
   'copy 'os2drv'\startup.cmd 'os2drv'\startup.os2 >NUL'         /* copyit */
    res=lineout(logfile,'>>>> STARTUP.CMD found and saved as STARTUP.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> STARTUP.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Startup.os2 already exists, no copy done *';
     say '********************************************';
     end


/**************************************************************************/
/* STARTUP.CMD  -  add logon line and FTPD line for D01                   */
/**************************************************************************/
res=lineout(os2drv'\startls56.cub','ADDLINE "logon IT01D01A /p:apw01d01 /v:d " ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub')
'call 'cddrv':\cube\cube 'os2drv'\startls56.CUB 'os2drv'\startup.cmd 1>> 'logfile' 2>>&1'
'erase 'os2drv'\startls56.cub 2>nul'

'copy 'os2drv'\startup.cmd  'os2drv'\os2\startup.tst 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Startup.cmd modified successfully on D01  time='time()' date='date())
res=lineout(logfile)



if stream(os2drv'\config.os2','c','query exists') = '' then do    /* no org */
   'copy 'os2drv'\config.sys 'os2drv'\config.os2 >NUL'           /* copyit */
    res=lineout(logfile,'>>>> CONFIG.SYS found and saved as CONFIG.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> CONFIG.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Config.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* CONFIG.SYS  -  remove connections from autostarting on reboots         */
/*                add ITLUTIL directory to the path statements            */
/**************************************************************************/
res=lineout(os2drv'\config.cub','DELSTRING "CONNECTIONS," IN "SET AUTOSTART="  ')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "LIBPATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET PATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET DPATH=" ( AFTER FIRST')
/**************************************************************************/
/***** add TCP/IP lines for FTP and Remote execution test cases   *********/
/**************************************************************************/
res=lineout(os2drv'\config.cub','ADDLINE "SET USE_HOSTS_FIRST=1" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TZ=CST6CDT" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USER=IT01D01U" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PASSWD=UPW01D01" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TELNET.PASSWORD.ID=UPW01D01" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_BOOTDRV='os2cfg'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET LAN_TESTDRV='os2cfg'" ( AFTER')

/* Update PCM_RELLVL variable only if it is not set yet */
call SysFileSearch 'SET PCM_RELLVL=',os2drv'\config.sys','file.'
 IF file.0 = 0   /* Returned 0 lines, string not found */
  THEN res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_RELLVL='rellvl'" ( AFTER')
  ELSE DO
        res=lineout(logfile,'>>>> SET PCM_RELLVL string already exists in config.sys, time='time())
        res=lineout(logfile)
       END

res=lineout(os2drv'\config.cub')
'call 'cddrv':\cube\cube 'os2drv'\config.cub 'os2drv'\config.sys 1>> 'logfile' 2>>&1'
'erase 'os2drv'\config.cub 2>nul'
res=lineout(logfile,'>>>> Config.sys modified successfully on D01  time='time()' date='date())
res=lineout(logfile)
return



add_shares_s01:
/**************************************************************/
'NET ALIAS S01UTIL \\IT01S01 'os2drv'\ITLUTIL /R:"ITLUTIL directory on S01" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 201

'NET ACCESS 'os2drv'\ITLUTIL /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 202

'NET ACCESS 'os2drv'\ITLUTIL /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 203

'NET ACCESS 'os2drv'\ITLUTIL /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 204

'NET ALIAS S01LOGS \\IT01S01 'os2drv'\S01LOGS /R:"LOGS directory on S01" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 205

'NET ACCESS 'os2drv'\S01LOGS /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 206

'NET ACCESS 'os2drv'\S01LOGS /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 207

'NET ACCESS 'os2drv'\S01LOGS /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 208

res=lineout(logfile,'>>>> Shared resources added successfully on S01, time='time())
res=lineout(logfile)
return



load_itlutils1:
/*********************************************************************/
/* Copy the test cases from diskette to the itlutil directory on S01 */
/*********************************************************************/

'copy 'cddrv':\lannet\trusers       'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\hosts         'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts        'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.s01  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\wcbusrf.isf   'os2drv'\wal\wcbusrf.kit  1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls56.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlpeer.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\*.ps          'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\resync.cmd    'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlalert.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\itlpsf00.*    'os2drv'\itlutil 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Test files added successfully on S01  time='time()' date='date())
res=lineout(logfile)
return



edit_startups1:
/*****************************************************************************/
if stream(os2drv'\startup.cmd','c','query exists') = '' then do   /* no cmd */
     res=lineout(logfile,'>>>> STARTUP.CMD was NOT found on SERVER system  time='time())
     res=lineout(logfile)
     say '[1;09;41m  *****************************************************[0;40;37m';
     say '[1;09;41m  *** Could NOT find 'os2drv'\STARTUP.CMD                  ***[0;40;37m';
     say '[1;09;41m  ***                                               ***[0;40;37m';
     say '[1;09;41m  *** Startup.cmd should have been created during   ***[0;40;37m';
     say '[1;09;41m  *** Server installation with the following lines. ***[0;40;37m';
     say '[1;09;41m  ***  NET START SERVER                             ***[0;40;37m';
     say '[1;09;41m  ***  @IF ERRORLEVEL 2 C:\IBMLAN\NETPROG\LSERR.EXE ***[0;40;37m';
     say '[1;09;41m  ***  EXIT                                         ***[0;40;37m';
     say '[1;09;41m  ***                                               ***[0;40;37m';
     say '[1;09;41m  ***  ....CREATING STARTUP.CMD FOR SERVER NOW....  ***[0;40;37m';
     say '[1;09;41m  *****************************************************[0;40;37m';
     'echo 'NET START SERVER'  > 'os2drv'\startup.cmd'
     'echo '@IF ERRORLEVEL 2 C:\IBMLAN\NETPROG\LSERR.EXE' >> 'os2drv'\startup.cmd'
     'echo 'EXIT'             >> 'os2drv'\startup.cmd'
     res=lineout(logfile,'>>>> STARTUP.CMD created on ADDITIONAL SERVER')
     res=lineout(logfile)
     end

if stream(os2drv'\startup.os2','c','query exists') = '' then do   /* no os2 */
   'copy 'os2drv'\startup.cmd 'os2drv'\startup.os2 >NUL'         /* copyit */
    res=lineout(logfile,'>>>> STARTUP.CMD found and saved as STARTUP.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> STARTUP.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Startup.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* STARTUP.CMD - add logon line and start FTPD line to startup.cmd        */
/**************************************************************************/
res=lineout(os2drv'\startls56.cub','ADDSTRING " /e:1 /alerts:1 /alertn:it01s01 /di:15000" IN "NET START SERVER" ( AFTER [IFNEW]')

res=lineout(os2drv'\startls56.cub','ADDLINE "START \WAL\LDSTART START /UI" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub','ADDLINE "NET TIME /DOMAIN:IT01D01D /SET /YES" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub','ADDLINE "logon IT01S01A /p:apw01s01 /v:d" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub')
'call 'cddrv':\cube\cube 'os2drv'\startls56.CUB 'os2drv'\startup.cmd 1>> 'logfile' 2>>&1'
'erase 'os2drv'\startls56.cub 2>nul'

'copy 'os2drv'\startup.cmd  'os2drv'\os2\startup.tst 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Startup.cmd modified successfully   time='time()' date='date())
res=lineout(logfile)




if stream(os2drv'\config.os2','c','query exists') = '' then do    /* no org */
   'copy 'os2drv'\config.sys 'os2drv'\config.os2 >NUL'           /* copyit */
    res=lineout(logfile,'>>>> CONFIG.SYS saved as CONFIG.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> CONFIG.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Config.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* CONFIG.SYS  -  remove connections from autostarting on reboots         */
/*                add ITLUTIL directory to the path statements            */
/**************************************************************************/
res=lineout(os2drv'\config.cub','DELSTRING "CONNECTIONS," IN "SET AUTOSTART="  ')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "LIBPATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET PATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET DPATH=" ( AFTER FIRST')
/**************************************************************************/
/***** add TCP/IP lines for FTP and Remote execution test cases   *********/
/**************************************************************************/
res=lineout(os2drv'\config.cub','ADDLINE "SET TZ=CST6CDT" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USER=IT01S01U" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PASSWD=UPW01S01" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TELNET.PASSWORD.ID=UPW01S01" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USE_HOSTS_FIRST=1" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_BOOTDRV='os2cfg'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET LAN_TESTDRV='os2cfg'" ( AFTER')

/* Update PCM_RELLVL variable only if it is not set yet */
call SysFileSearch 'SET PCM_RELLVL=',os2drv'\config.sys','file.'
 IF file.0 = 0   /* Returned 0 lines, string not found */
  THEN res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_RELLVL='rellvl'" ( AFTER')
  ELSE DO
        res=lineout(logfile,'>>>> SET PCM_RELLVL string already exists in config.sys, time='time())
        res=lineout(logfile)
       END

res=lineout(os2drv'\config.cub')
'call 'cddrv':\cube\cube 'os2drv'\config.cub 'os2drv'\config.sys 1>> 'logfile' 2>>&1'
'erase 'os2drv'\config.cub 2>nul'
res=lineout(logfile,'>>>> Config.sys modified successfully for S01  time='time()' date='date())
res=lineout(logfile)
return



resync_sys:
/*********************************************************************/
CALL SysFileSearch 'Computername',os2drv'\ibmlan\ibmlan.ini','file.'
server = strip(subword(file.1,3,1))

say '>>>> Resync of Additional Server with Domain  time='time()' date='date()
res=lineout(logfile,'>>>> Resync of Additional Server with Domain, time='time()' date='date())
res=lineout(logfile)

'call logoff /y'
'call logon userid /p=password /vl'
net stop netlogon
'NET USER 'server' ""'
"NET accounts /role:standalone"
'NET USER 'server' ""'
"net accounts /role:member"
"net start netlogon"
return



load_itlutilr01:
/*********************************************************************/
/* Copy the test cases from diskette to the itlutil directory on R01 */
/*********************************************************************/

'copy 'cddrv':\lannet\netrc.r01     'os2drv'\mptn\etc\netrc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\hosts         'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts        'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\trusers       'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.r01  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls56.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls57.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlmsg.cmd    'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlftp01.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Test cases copied successfully on R01, time='time())
res=lineout(logfile)
return



load_itlutilr02:
/*********************************************************************/
/* Copy the test cases from diskette to the itlutil directory on R02 */
/*********************************************************************/

'copy 'cddrv':\lannet\netrc.r02     'os2drv'\mptn\etc\netrc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\hosts         'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts        'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\trusers       'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.r02  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls56.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls57.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlftp02.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlld.cmd     'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlpeer.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'


res=lineout(logfile,'>>>> Test cases copied successfully on R02, time='time())
res=lineout(logfile)
return



edit_startupreq:
/***************************************************************************/
/* STARTUP.CMD  -  add logon line and shares for PEER System shares        */
/*              -  if startup.cmd not found - create with net start req    */
/***************************************************************************/
if stream(os2drv'\startup.cmd','c','query exists') = '' then do  /* no cmd */
   'echo 'NET START REQ'  > 'os2drv'\startup.cmd'
   'echo 'EXIT'          >> 'os2drv'\startup.cmd'
    res=lineout(logfile,'>>>> Startup.cmd was CREATED with NET START REQ, time='time())
    res=lineout(logfile)
   end
else do
     'grep "NET START REQ" startup.cmd  >NUL'
     if rc = 0 then do
        need_net = 1
        res=lineout(logfile,'>>>> Startup.cmd DOES NOT HAVE -- NET START REQ, time='time())
        res=lineout(logfile)
        say '********************************************';
        say '* Startup.cmd needs NET START REQ line     *';
        say '********************************************';
        end
     end

CALL SysSleep 15;

if stream(os2drv'\startup.os2','c','query exists') = '' then do   /* no org */
   'copy 'os2drv'\startup.cmd 'os2drv'\startup.os2 >NUL'         /* copyit */
    res=lineout(logfile,'>>>> STARTUP.CMD found and saved as STARTUP.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> STARTUP.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Startup.os2 already exists, no copy done *';
     say '********************************************';
     end

userid=target||u
password=upw||substr(target,3,5)

if need_net = 1 then do
   res=lineout(os2drv'\startup.cub','ADDLINE "NET START REQ" ( BEFORE ')
   end

if target = 'IT01R01' then do
  res=lineout(os2drv'\startup.cub','ADDLINE "logon userid  /p:password /l "( AFTER "NET START"')
  res=lineout(os2drv'\startup.cub','ADDLINE "net share ipc$ " ( AFTER "logon userid"')
  res=lineout(os2drv'\startup.cub','ADDLINE "net share os2peer='os2drv'\itlutil\os2peer " ( AFTER "net share ipc"')
  res=lineout(os2drv'\startup.cub','ADDLINE "net share r01logs='os2drv'\r01logs " ( AFTER "net share os2"')
  end
res=lineout(os2drv'\startup.cub','ADDLINE "logon 'userid' /p:'password' /v:d " ( BEFORE "EXIT"')
res=lineout(os2drv'\startup.cub','ADDLINE "NET TIME /DOMAIN:IT01D01D /SET /YES" ( AFTER "logon IT01"')

res=lineout(os2drv'\startup.cub')
'call 'cddrv':\cube\cube 'os2drv'\startup.CUB 'os2drv'\startup.cmd 1>> 'logfile' 2>>&1'
'erase 'os2drv'\startup.cub 2>nul'

'copy 'os2drv'\startup.cmd  'os2drv'\os2\startup.tst 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Startup.cmd modified successfully on REQ 'target' : time='time())
res=lineout(logfile)


if stream(os2drv'\config.os2','c','query exists') = '' then do    /* no org */
   'copy 'os2drv'\config.sys 'os2drv'\config.os2 >NUL'           /* copyit */
    res=lineout(logfile,'>>>> CONFIG.SYS found and saved as CONFIG.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> CONFIG.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Config.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* update config.sys  -  remove connections from autostarting on reboots  */
/*                       add ITLUTIL directory to the path statements     */
/**************************************************************************/
res=lineout(os2drv'\config.cub','DELSTRING "CONNECTIONS," IN "SET AUTOSTART="  ')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "LIBPATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET PATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET DPATH=" ( AFTER FIRST')
/**************************************************************************/
/* set up for TCP/IP test cases      **************************************/
/**************************************************************************/
res=lineout(os2drv'\config.cub','ADDLINE "SET USE_HOSTS_FIRST=1" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TZ=CST6CDT" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USER=IT01'substr(target,5,3)'U" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PASSWD=UPW01'substr(target,5,3)'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TELNET.PASSWORD.ID=UPW01'substr(target,5,3)'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_BOOTDRV='os2cfg'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET LAN_TESTDRV='os2cfg'" ( AFTER')

/* Update PCM_RELLVL variable only if it is not set yet */
call SysFileSearch 'SET PCM_RELLVL=',os2drv'\config.sys','file.'
 IF file.0 = 0   /* Returned 0 lines, string not found */
  THEN res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_RELLVL='rellvl'" ( AFTER')
  ELSE DO
        res=lineout(logfile,'>>>> SET PCM_RELLVL string already exists in config.sys, time='time())
        res=lineout(logfile)
       END

if target = 'IT01R02' then do
   res=lineout(os2drv'\config.cub','ADDLINE "DEVICE='os2drv'\OS2\HKDD.SYS" ( AFTER')
   end

res=lineout(os2drv'\config.cub')
'call 'cddrv':\cube\cube 'os2drv'\config.cub 'os2drv'\config.sys 1>> 'logfile' 2>>&1'
'erase 'os2drv'\config.cub 2>nul'
res=lineout(logfile,'>>>> config.sys modified successfully on REQ, time='time())
res=lineout(logfile)
return



edit_wcldial:
/**************************************************************************/
/* changes for ITLLD test case to run automatically  **********************/
/* Determine the phone number currently supplied during the install       */
/**************************************************************************/
call SysFileSearch 'Phone Number',os2drv'\wal\wcldial.cxd','file.'
phone = strip(subword(file.1,4,1))
res=lineout(os2drv'\wal.cub','ADDLINE "[ITL]" ( AFTER')
res=lineout(os2drv'\wal.cub','ADDLINE "  SUBFIELD = Bearer Capability" ( AFTER')
res=lineout(os2drv'\wal.cub','ADDLINE "    Synchronicity = Asynchronous" ( AFTER')
res=lineout(os2drv'\wal.cub','ADDLINE "    Modem Class = Unspecified" ( AFTER')
res=lineout(os2drv'\wal.cub','ADDLINE "  SUBFIELD = Called Party Number" ( AFTER')
res=lineout(os2drv'\wal.cub','ADDLINE "    Phone Number = 'phone'" ( AFTER')
res=lineout(os2drv'\wal.cub')
'call 'cddrv':\cube\cube 'os2drv'\wal.cub 'os2drv'\wcldial.cxd 1>> 'logfile' 2>>&1'
'erase 'os2drv'\wal.cub 2>nul'
res=lineout(logfile,'>>>> wcldial.cxd modified successfully on R02, time='time())
res=lineout(logfile)
return



setup_peer:
'logoff'
'logon userid /p:password /v:l'
/**************************************************************************/
/* define OS2PEER shares on R01 and setup access list  ********************/
/**************************************************************************/
'NET SHARE OS2PEER='os2drv'\ITLUTIL\OS2PEER /USERS:5 /R:"Peer test directory" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 320
'NET ACCESS 'os2drv'\ITLUTIL\OS2PEER /ADD GUESTS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 321
'NET ACCESS 'os2drv'\ITLUTIL\OS2PEER /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 322
'NET ACCESS 'os2drv'\ITLUTIL\OS2PEER /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 323

'NET SHARE R01LOGS='os2drv'\R01LOGS /USERS:5 /R:"Log directory" 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 324
'NET ACCESS 'os2drv'\R01LOGS /ADD GUESTS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 325
'NET ACCESS 'os2drv'\R01LOGS /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 326
'NET ACCESS 'os2drv'\R01LOGS /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 327


res=lineout(logfile,'>>>> Shared resources added successfully on R01, time='time())
res=lineout(logfile)
'logoff'
return



edit_startupgenreq:
/**************************************************************************/
/* STARTUP.CMD  -  add logon line and shares for PEER System shares       */
/*              -  if startup.cmd not found - create with net start req   */
/**************************************************************************/
if stream(os2drv'\startup.cmd','c','query exists') = '' then do
   'echo 'NET START REQ'  > 'os2drv'\startup.cmd'
   'echo 'EXIT'          >> 'os2drv'\startup.cmd'
    res=lineout(logfile,'>>>> Startup.cmd was CREATED with NET START REQ, time='time())
    res=lineout(logfile)
   end
else do
     'grep "NET START REQ" startup.cmd  >NUL'
     if rc = 0 then do
        need_net = 1
        res=lineout(logfile,'>>>> Startup.cmd DOES NOT HAVE -- NET START REQ, time='time())
        res=lineout(logfile)
        say '********************************************';
        say '* Startup.cmd needs NET START REQ line     *';
        say '********************************************';
        end
     end

CALL SysSleep 5;

if stream(os2drv'\startup.os2','c','query exists') = '' then do   /* no org */
   'copy 'os2drv'\startup.cmd 'os2drv'\startup.os2 >NUL'         /* copyit */
    res=lineout(logfile,'>>>> STARTUP.CMD found and saved as STARTUP.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> STARTUP.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Startup.os2 already exists, no copy done *';
     say '********************************************';
     end

reqname = substr(target,5,3)       /* get last 3 chars of target name       */
userid=target||u                   /* set userid to IT01xxxU  xxx = reqname */
password=upw||substr(target,3,5)   /* set password to UPW01xxx              */

if need_net = 1 then do
   res=lineout(os2drv'\startup.cub','ADDLINE "NET START REQ" ( BEFORE ')
   end

res=lineout(os2drv'\startup.cub','ADDLINE "logon 'userid' /p:'password' /v:d " ( BEFORE "EXIT"')
res=lineout(os2drv'\startup.cub','ADDLINE "NET TIME /DOMAIN:IT01D01D /SET /YES" ( AFTER "logon IT01"')

res=lineout(os2drv'\startup.cub')
'call 'cddrv':\cube\cube 'os2drv'\startup.CUB 'os2drv'\startup.cmd 1>> 'logfile' 2>>    1'
'erase 'os2drv'\startup.cub 2>nul'

'copy 'os2drv'\startup.cmd  'os2drv'\os2\startup.tst 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Startup.cmd modified successfully on REQ 'target' : time='time())
res=lineout(logfile)


if stream(os2drv'\config.os2','c','query exists') = '' then do    /* no org */
   'copy 'os2drv'\config.sys 'os2drv'\config.os2 >NUL'           /* copyit */
    res=lineout(logfile,'>>>> CONFIG.SYS found and saved as CONFIG.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> CONFIG.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Config.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* update config.sys  -  remove connections from autostarting on reboots  */
/*                       add ITLUTIL directory to the path statements     */
/**************************************************************************/
res=lineout(os2drv'\config.cub','DELSTRING "CONNECTIONS," IN "SET AUTOSTART="  ')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "LIBPATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET PATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET DPATH=" ( AFTER FIRST')
/**************************************************************************/
/* set up for TCP/IP test cases      **************************************/
/**************************************************************************/
res=lineout(os2drv'\config.cub','ADDLINE "SET USE_HOSTS_FIRST=1" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TZ=CST6CDT" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USER=IT01'substr(target,5,3)'U" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PASSWD=UPW01'substr(target,5,3)'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TELNET.PASSWORD.ID=UPW01'substr(target,5,3)'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_BOOTDRV='os2cfg'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET LAN_TESTDRV='os2cfg'" ( AFTER')

/* Update PCM_RELLVL variable only if it is not set yet */
call SysFileSearch 'SET PCM_RELLVL=',os2drv'\config.sys','file.'
 IF file.0 = 0   /* Returned 0 lines, string not found */
  THEN res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_RELLVL='rellvl'" ( AFTER')
  ELSE DO
        res=lineout(logfile,'>>>> SET PCM_RELLVL string already exists in config.sys, time='time())
        res=lineout(logfile)
       END


res=lineout(os2drv'\config.cub')
'call 'cddrv':\cube\cube 'os2drv'\config.cub 'os2drv'\config.sys 1>> 'logfile' 2>>&1'
'erase 'os2drv'\config.cub 2>nul'
res=lineout(logfile,'>>>> config.sys modified successfully on GENERIC REQUESTER 'target', time='time())
res=lineout(logfile)
return



load_itlutilgenreq:
/*********************************************************************/
/* Copy the test cases from diskette to the itlutil directory on R01 */
/*********************************************************************/

reqname = substr(target,5,3)       /* get last 3 chars of target name       */

'copy 'cddrv':\lannet\netrc.'reqname'     'os2drv'\mptn\etc\netrc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\hosts               'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts              'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\trusers             'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.'reqname'  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls56.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls57.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlftp01.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlftp02.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'


res=lineout(logfile,'>>>> Test cases copied successfully on 'reqname', time='time())
res=lineout(logfile)
return



add_shares_s02:
/**************************************************************/
'NET ALIAS S02UTIL \\IT01S02 'os2drv'\ITLUTIL /R:"ITLUTIL directory on S02" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 201
'NET ACCESS 'os2drv'\ITLUTIL /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 202
'NET ACCESS 'os2drv'\ITLUTIL /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 203
'NET ACCESS 'os2drv'\ITLUTIL /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 204

'NET ALIAS S02LOGS \\IT01S02 'os2drv'\S02LOGS /R:"LOGS directory on S02" /W:STARTUP 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 205
'NET ACCESS 'os2drv'\S02LOGS /ADD USERS:RWCXD 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 206
'NET ACCESS 'os2drv'\S02LOGS /FAILURE:ALL 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 207
'NET ACCESS 'os2drv'\S02LOGS /APPLY 1>> 'logfile' 2>>&1'
if (rc <> 0 & rc <> 2) then call setup_error 208

res=lineout(logfile,'>>>> Shared resources added successfully on S02, time='time())
res=lineout(logfile)
return



load_itlutils2:
/*********************************************************************/
/* Copy the test cases from diskette to the itlutil directory on S01 */
/*********************************************************************/

'copy 'cddrv':\lannet\trusers       'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\tcpnbk.lst    'os2drv'\mptn\etc 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\hosts         'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'
'copy 'cddrv':\lannet\rhosts        'os2drv'\mptn\etc  1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\tcpstart.s02  'os2drv'\tcpip\bin\tcpstart.cmd 1>> 'logfile' 2>>&1'

'copy 'cddrv':\lannet\wcbusrf.isf   'os2drv'\wal\wcbusrf.kit  1>> 'logfile' 2>>&1'

'copy 'cddrv':\lancmd\comp.rsp      'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\nextfree.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlls56.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlpeer.cmd   'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\*.ps          'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\resync.cmd    'os2drv'\itlutil 1>> 'logfile' 2>>&1'
'copy 'cddrv':\lancmd\itlalert.cmd  'os2drv'\itlutil 1>> 'logfile' 2>>&1'


res=lineout(logfile,'>>>> Test files added successfully on S02  time='time()' date='date())
res=lineout(logfile)
return



edit_startups2:
/*****************************************************************************/
if stream(os2drv'\startup.cmd','c','query exists') = '' then do   /* no cmd */
     res=lineout(logfile,'>>>> STARTUP.CMD was NOT found ***************** time='time())
     res=lineout(logfile)
     say '[1;09;41m  *****************************************************[0;40;37m';
     say '[1;09;41m  *** Could NOT find 'os2drv'\STARTUP.CMD                  ***[0;40;37m';
     say '[1;09;41m  ***                                               ***[0;40;37m';
     say '[1;09;41m  *** Startup.cmd should have been created during   ***[0;40;37m';
     say '[1;09;41m  *** Server installation with the following lines. ***[0;40;37m';
     say '[1;09;41m  ***     NET START SERVER                          ***[0;40;37m';
     say '[1;09;41m  ***     EXIT                                      ***[0;40;37m';
     say '[1;09;41m  *****************************************************[0;40;37m';
     exit
     end

if stream(os2drv'\startup.os2','c','query exists') = '' then do   /* no os2 */
   'copy 'os2drv'\startup.cmd 'os2drv'\startup.os2 >NUL'         /* copyit */
    res=lineout(logfile,'>>>> STARTUP.CMD found and saved as STARTUP.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> STARTUP.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Startup.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* STARTUP.CMD - add logon line and start FTPD line to startup.cmd        */
/* Note: Alerts are setup to send messages to S01 system..........        */
/**************************************************************************/
res=lineout(os2drv'\startls56.cub','ADDSTRING " /e:1 /alerts:1 /alertn:it01s01 /di:15000" IN "NET START SERVER" ( AFTER [IFNEW]')
res=lineout(os2drv'\startls56.cub','ADDLINE "NET START GENALERT" ( AFTER "NET START SERVER"')
res=lineout(os2drv'\startls56.cub','ADDLINE "NET START ALERTER" ( AFTER "NET START SERVER"')

res=lineout(os2drv'\startls56.cub','ADDLINE "START \WAL\LDSTART START /UI" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub','ADDLINE "NET TIME /DOMAIN:IT01D01D /SET /YES" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub','ADDLINE "logon IT01S02A /p:apw01s02 /v:d" ( AFTER "@if"')
res=lineout(os2drv'\startls56.cub')
'call 'cddrv':\cube\cube 'os2drv'\startls56.CUB 'os2drv'\startup.cmd 1>> 'logfile' 2>>&1'
'erase 'os2drv'\startls56.cub 2>nul'

'copy 'os2drv'\startup.cmd  'os2drv'\os2\startup.tst 1>> 'logfile' 2>>&1'

res=lineout(logfile,'>>>> Startup.cmd modified successfully   time='time()' date='date())
res=lineout(logfile)


if stream(os2drv'\config.os2','c','query exists') = '' then do    /* no org */
   'copy 'os2drv'\config.sys 'os2drv'\config.os2 >NUL'           /* copyit */
    res=lineout(logfile,'>>>> CONFIG.SYS saved as CONFIG.OS2, time='time())
    res=lineout(logfile)
   end
else do
     res=lineout(logfile,'>>>> CONFIG.OS2 already exists, no copy done, time='time())
     res=lineout(logfile)
     say '********************************************';
     say '* Config.os2 already exists, no copy done *';
     say '********************************************';
     end

/**************************************************************************/
/* CONFIG.SYS  -  remove connections from autostarting on reboots         */
/*                add ITLUTIL directory to the path statements            */
/**************************************************************************/
res=lineout(os2drv'\config.cub','DELSTRING "CONNECTIONS," IN "SET AUTOSTART="  ')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "LIBPATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET PATH=" ( AFTER FIRST')
res=lineout(os2drv'\config.cub','ADDSTRING "'os2drv'\ITLUTIL;" IN "SET DPATH=" ( AFTER FIRST')
/**************************************************************************/
/***** add TCP/IP lines for FTP and Remote execution test cases   *********/
/**************************************************************************/
res=lineout(os2drv'\config.cub','ADDLINE "SET TZ=CST6CDT" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USER=IT01S02U" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PASSWD=UPW01S02" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET TELNET.PASSWORD.ID=UPW01S02" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET USE_HOSTS_FIRST=1" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_BOOTDRV='os2cfg'" ( AFTER')
res=lineout(os2drv'\config.cub','ADDLINE "SET LAN_TESTDRV='os2cfg'" ( AFTER')

/* Update PCM_RELLVL variable only if it is not set yet */
call SysFileSearch 'SET PCM_RELLVL=',os2drv'\config.sys','file.'
 IF file.0 = 0   /* Returned 0 lines, string not found */
  THEN res=lineout(os2drv'\config.cub','ADDLINE "SET PCM_RELLVL='rellvl'" ( AFTER')
  ELSE DO
        res=lineout(logfile,'>>>> SET PCM_RELLVL string already exists in config.sys, time='time())
        res=lineout(logfile)
       END

res=lineout(os2drv'\config.cub')
'call 'cddrv':\cube\cube 'os2drv'\config.cub 'os2drv'\config.sys 1>> 'logfile' 2>>&1'
'erase 'os2drv'\config.cub 2>nul'
res=lineout(logfile,'>>>> Config.sys modified successfully for S02  time='time()' date='date())
res=lineout(logfile)
return




setup_error:
arg  rcxx .
/**************************************************************************/
res=lineout(logfile,'>>>> above command failed with return code = 'rcxx', time='time())
res=lineout(logfile)
exit
