/********************** PALS-IT REXX PROLOGUE ********************************/
/*                                                                           */
/* Testcase Name:     ITLLS57.CMD                                            */
/*                                                                           */
/* Descriptive Name:  LAN DOMAIN EXERCISER                                   */
/*                                                                           */
/* FUNCTION TESTED:   Remote file access                                     */
/*                                                                           */
/* TESTCASE OBJECTIVE:                                                       */
/*    DESCRIPTION:                                                           */
/*                                                                           */
/*        Get network resource (Net use the X: DRIVE), copy different files. */
/*        to the local DRIVE.  Compare local files to remote files.          */
/*        Then erase the files. There are delays between copies.             */
/*        This test loops continuously until control C is entered            */
/*    END_OF_DESCRIPTION                                                     */
/*                                                                           */
/*    TESTABLE ITEMS:                                                        */
/*        Lan Server file server                                             */
/*                                                                           */
/* DEPENDENCIES:                                                             */
/*                                                                           */
/* MANUAL INTERVENTION                                                       */
/*    None                                                                   */
/*                                                                           */
/*    PREREQUISITES:                                                         */
/*                                                                           */
/*                                                                           */
/*    Input Parameters:                                                      */
/*                                                                           */
/*        - Test Duration, Sleep Time between loops                          */
/*                                                                           */
/*    Outputs:                                                               */
/*        - RC= 0 if successful      RC=8 if failed                          */
/*                                                                           */
/*    SPECIAL NOTES:                                                         */
/*                                                                           */
/*        - None.                                                            */
/*                                                                           */
/* RESTRICTIONS:                                                             */
/*    none                                                                   */
/*                                                                           */
/* CHANGE ACTIVITY:                                                          */
/*   Ver  Date      NAME         Comments                                    */
/*   1.0  8/05/93  R.Bassemir    Initial release.                            */
/*   1.1  8/06/93  R.Bassemir    Updated with time stamp message on errors   */
/*   1.2  2/12/97  R.Bassemir    Option to use smaller files (LAN Distance)  */
/*   1.1  02/17/97 R.Bassemir    Updated for use with self test kit          */
/*   1.3  5/23/97  R.Bassemir    Changed the logfile naming convention       */
/*   1.4  5/27/97  R.Bassemir    Write log file back to D01, added parm      */
/*                               for setting the number of passes            */
/*   1.5  6/02/97  R.Bassemir    Erased logfile on D01 before starting       */
/*   1.6  6/04/97  R.Bassemir    Added the use of nextfree DRIVE, added the  */
/*                               detection of the boot DRIVE, added remote   */
/*                               logging of results, added history file      */
/*                                                                           */
/*        7/03/97  S. Hudson     Change to use OS2DRV instead of hardcode c  */
/*        7/10/97  S. Hudson     Change to use subdir on local system for    */
/*                               copy, compare, and erase of test data files */
/*        7/15/97  S. Hudson     Change to use common functions for methods  */
/*                               of creating history,log files, extracting   */
/*                               local system names, duration times.         */
/*        7/25/97  S. Hudson     Change to add xcopy of all .MB files        */
/*        8/06/97  S. Hudson     Add COMP for xcopy of files to-from domain  */
/*        8/16/97  S. Hudson     Add 3sec sleep aft copy before net use /d   */
/*                               for files to be released before dropping net*/
/*                                                                           */
/*****************************-END PROLOGUE-**********************************/
arg  duration  sleeptime  type .
TRACE  off

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

if duration = '?' then signal HELP

if duration = '' then duration = 2     /* set a default of 2 hours    */
  else limited = 1

if sleeptime ='' then sleeptime = 5    /* set a default of 5 seconds */

if type = 'RPL' then os2drv = 'Z:'

if type = 'LD' then usesmall = 1       /* LD use *k.dat files, not *mb.dat */
  else usesmall = 0

if type = 'RPL' then inifile = 'Z:\IBMLAN\IBMLAN.INI'
  else inifile = os2drv'\IBMLAN\IBMLAN.INI'

/*****************************************************************************/
/*****************************************************************************/
CALL RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
CALL RxFuncAdd 'SysFileSearch','RexxUtil','SysFileSearch'
CALL SysLoadFuncs

/***************** determine NETBIOS name **local system*************/
CALL SysFileSearch 'Computername',os2drv'\ibmlan\ibmlan.ini','file.'
localname = strip(subword(file.1,3,1))

/***************** define the log file and history file *************/
logfile = os2drv'\'||substr(localname,5,3)'logs\itlls57.'||substr(localname,5,3)
histfile = os2drv'\'||substr(localname,5,3)'logs\itlls57.'||substr(localname,5,3)'.history'

/***************** initialize a history file **************************/
res = lineout(histfile, '***** 'time() date()' ITLLS57 History *****')
res = lineout(histfile)

/***************** copy existing file to history ********************/
'copy 'histfile'+'logfile' 'histfile
'erase 'logfile

/**************** start a new log file *****************************/
res = lineout(logfile, '***** 'time() date()' ITLLS57 STARTING *****')
res = lineout(logfile)


start_time = date('u') time('c')

/******* determine the next available DRIVE for a net use ******/
ndrive = nextfree()
if ndrive = 0 then
   do
      say '- There are NO free DRIVES for the NET USE '
      say '           *** This test will end now.'
      exit
   end /* do */

'net use 'ndrive' S01LOGS'                  /* get network resource          */
'erase 'ndrive||substr(logfile,12,11)       /* erase logfile on S01 if there */

CALL SysSleep 3

'net use 'ndrive' /delete'                  /* drop the network resource     */

/********** set up data files depending on large or small parameter *****/
if usesmall = 1 then
   do
   datafile1 = '1k.dat'
   datafile2 = '2k.dat'
   datafile3 = '4k.dat'
   datafile4 = '8k.dat'
   end
   else
   do
   datafile1 = '1mb.dat'
   datafile2 = '2mb.dat'
   datafile3 = '4mb.dat'
   datafile4 = '8mb.dat'
   end

xx =time('e')           /* this initializes elapsed timer for testcase */
count = 1

/***************  start the copy and compares  ********************/
if limited = 1 then
   DO until stopme = 1
     CALL get_drive
     CALL copy_file datafile1
     CALL copy_file datafile2
     CALL copy_file datafile3
     CALL copy_file datafile4
     CALL xcopy_files
     CALL drop_drive
     if ehrs > duration then stopme=1
   END
   else
   do until stopme = 1
     CALL get_drive
     CALL copy_file datafile1
     CALL copy_file datafile2
     CALL copy_file datafile3
     CALL copy_file datafile4
     CALL xcopy_files
     CALL drop_drive
     if ehrs > 2 then stopme=1
   end

/****** run completed successfully, copy log file back to S01 ******/
res = lineout(logfile, '***** 'time() date()' ITLLS57 Completed successfully *****')
res = lineout(logfile)

'NET USE 'ndrive' S01LOGS'                      /* get network resource      */
'copy 'logfile' 'ndrive'*.*'

CALL SysSleep 3

'NET USE 'ndrive' /DELETE'                      /* drop the network resource */

exit
/* ************************************************************************* */
/* NORMAL EXIT POINT WHEN TESTCASE COMPLETES OK                              */
/* ************************************************************************* */


/************* get the DRIVE ***************************************/
GET_DRIVE:
'NET USE 'ndrive' S01UTIL'                   /* get network resource        */
 IF (RC \= 0 & RC \= 2) then do              /* exit if the NET USE failed  */
   SAY 'THE USE OF THE NETWORK RESOURCE FAILED. RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                  /* set time and date           */
   SAY DATETIME                              /* output date and time        */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                /* drop the network resource   */
   errorwith = netuse
   CALL bad_exit errorwith
 END

'MD 'ndrive'\'||localname             /* make the test dir on network DRIVE */

'MD 'os2drv'\itlutil\srvtest'          /* make the test dir on local   DRIVE */
return


/************* copy the file ***************************************/
COPY_FILE:
parse upper arg file_name
file_name = strip(file_name)

etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)

if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'

say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp

'COPY 'ndrive'\'||file_name os2drv||'\ITLUTIL\SRVTEST' /* copy to local DRIVE */
IF RC \= 0 then do                                     /* exit if copy failed */
   SAY 'THE FIRST COPY OF 'file_name' FAILED.  RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstcopy
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\'||file_name os2drv||'\ITLUTIL\SRVTEST\'||file_name' < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE FIRST COMP OF 'file_name 'FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstcomp
   CALL bad_exit errorwith                         /* post error and exit    */
 END

etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)

if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'

say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp
SAY 'ITLLS57> Sleeping for 'sleeptime' seconds after copy and compare.'
CALL SysSleep sleeptime

'COPY 'os2drv||'\ITLUTIL\SRVTEST\'||file_name ''ndrive'\'||localname
IF RC \= 0 then do                                 /* exit if copy failed    */
   SAY 'THE SECOND COPY OF 'file_name' FAILED.  RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondcopy
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\'||file_name ''ndrive'\'||localname||'\'||file_name' < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE SECOND COMP OF 'file_name 'FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondcomp
   CALL bad_exit errorwith                         /* post error and exit    */
 END

etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)

if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'

say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp
SAY 'ITLLS57> Sleeping for 'sleeptime' seconds after copy and compare.'
CALL SysSleep sleeptime

'ERASE 'ndrive'\'||localname||'\'file_name
'ERASE 'os2drv||'\ITLUTIL\SRVTEST\'||file_name

return


/************* copy the file ***************************************/
XCOPY_FILES:

etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)

if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'

say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp

'XCOPY 'ndrive'\*MB.DAT 'os2drv||'\ITLUTIL\SRVTEST' /* copy to local DRIVE */
IF RC \= 0 then do                                     /* exit if copy failed */
   SAY 'THE FIRST XCOPY OF *MB.DAT FAILED.  RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstxcopy
   CALL bad_exit errorwith                         /* post error and exit    */
 END


'COMP 'ndrive'\1MB.DAT 'os2drv||'\ITLUTIL\SRVTEST\1MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE FIRST XCOPY COMP OF 1MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstxcomp1
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\2MB.DAT 'os2drv||'\ITLUTIL\SRVTEST\2MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE FIRST XCOPY COMP OF 2MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstxcomp2
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\4MB.DAT 'os2drv||'\ITLUTIL\SRVTEST\4MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE FIRST XCOPY COMP OF 4MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstxcomp3
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\8MB.DAT 'os2drv||'\ITLUTIL\SRVTEST\8MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE FIRST XCOPY COMP OF 8MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = firstxcomp4
   CALL bad_exit errorwith                         /* post error and exit    */
 END


etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)


if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'


say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp
SAY 'ITLLS57> Sleeping for 'sleeptime' seconds after xcopy and compares.'
CALL SysSleep sleeptime


'XCOPY 'os2drv||'\ITLUTIL\SRVTEST\*MB.DAT 'ndrive'\'||localname
IF RC \= 0 then do                                 /* exit if copy failed    */
   SAY 'THE SECOND COPY OF 'file_name' FAILED.  RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondxcopy
   CALL bad_exit errorwith                         /* post error and exit    */
 END


'COMP 'ndrive'\1MB.DAT 'ndrive'\'||localname||'\1MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE SECOND XCOPY COMP OF 1MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondxcomp1
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\2MB.DAT 'ndrive'\'||localname||'\2MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE SECOND XCOPY COMP OF 2MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondxcomp2
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\4MB.DAT 'ndrive'\'||localname||'\4MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE SECOND XCOPY COMP OF 4MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondxcomp3
   CALL bad_exit errorwith                         /* post error and exit    */
 END

'COMP 'ndrive'\8MB.DAT 'ndrive'\'||localname||'\8MB.DAT < 'os2drv||'\ITLUTIL\COMP.RSP'
IF RC <> 0 then do                                 /* exit if compare failed */
   SAY 'THE SECOND XCOPY COMP OF 8MB.DAT FAILED.'
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   CALL SysSleep 3
   'NET USE 'ndrive' /DELETE'                      /* drop network resource  */
   errorwith = secondxcomp4
   CALL bad_exit errorwith                         /* post error and exit    */
 END


etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)


if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'


say 'ITLLS57> CURRENT PASS: 'count' START: 'start_time' ELP: 'etimestamp
SAY 'ITLLS57> Sleeping for 'sleeptime' seconds after xcopy and compares.'
CALL SysSleep sleeptime


'ERASE 'ndrive'\'||localname||'\*MB.DAT <yes.in'    /* erase files on netdrv */
'ERASE 'os2drv||'\ITLUTIL\SRVTEST\*MB.DAT <yes.in'  /* erase files on local  */


return



/***************** drop the network DRIVE  *********************************/
DROP_DRIVE:
CALL SysSleep 3
'NET USE 'ndrive' /DELETE'                      /* drop the network resource */
IF RC \= 0 then do                              /* exit if the drop  failed  */
   SAY 'THE DELETE OF THE NETWORK RESOURCE FAILED. RETURN CODE WAS: ' RC
   DATETIME = DATE() TIME()                        /* set time and date      */
   SAY DATETIME                                    /* output date and time   */
   errorwith = dropdrive
   CALL bad_exit errorwith                         /* post error and exit    */
 END

etime = time('e')
emin  = trunc(etime / 60,2)
ehrs  = trunc(emin  / 60,2)

if ehrs < 1 then etimestamp = emin' MIN'
  else etimestamp = ehrs' HRS'

fmsg = 'ITLLS57> COMPLETED PASS: 'count' START: 'start_time' ELP: 'etimestamp
res = lineout(logfile, fmsg)
res = lineout(logfile)

SAY fmsg
SAY 'ITLLS57> Sleeping for 'sleeptime' seconds after dropping network drive.'
CALL SysSleep sleeptime

count = count + 1

return

/************ error exit *******************************************/
BAD_EXIT:
parse arg cause

if cause = netuse then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on a net use to s01util *****')
  res = lineout(logfile)
end

if cause = firstcopy then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on first copy *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstcomp then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on first compare *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondcopy then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on second copy *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondcomp then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on second compare *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstxcopy then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on first xcopy *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondxcopy then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on second xcopy *****')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstxcomp1 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 1MB.DAT from first xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstxcomp2 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 2MB.DAT from first xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstxcomp3 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 4MB.DAT from first xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = firstxcomp4 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 8MB.DAT from first xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondxcomp1 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 1MB.DAT from second xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondxcomp2 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 2MB.DAT from second xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondxcomp3 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 4MB.DAT from second xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end

if cause = secondxcomp4 then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed compare of 8MB.DAT from second xcopy***')
  res = lineout(logfile)
  'NET USE 'ndrive' S01LOGS'                  /* get network resource       */
  'copy 'logfile' 'ndrive'*.* '
   CALL SysSleep 3
  'NET USE 'ndrive' /delete'                  /* drop the network resource  */
end


if cause = dropdrive then do
  res = lineout(logfile, '***** 'time() date()' ITLLS57 Failed on net use /d     *****')
  res = lineout(logfile)
end


EXIT
/* ************************************************************************* */
/* ERROR EXIT POINT WHEN TESTCASE FAILS - CAUSE POSTED IN LOGFILE            */
/* ************************************************************************* */


/************ help menu ********************************************/
HELP:
say ' '
say 'This command will copy and compare files from the domain controller'
say 'The syntax is: '
say '               ITLLS57 duration sleeptime type '
say 'Where: '
say '      duration  = time in hours you want the test to run '
say '                 (the default is 2 hours)'
say '      sleeptime = time between file copies (default is 10 secs)'
say '      type      = LD (for a lan distance remote client)'
say '                  RPL (for a ripl client)'
say '                  blank for a ordinary client (this is the default)'
say ' '
say 'Notes: -These parameters are position dependent. '
say '       -If you want to specify a type of LD then you must also'
say '        specify a duration and sleeptime'
exit
