PROCEDURE generate_ptu_summary, genps (
  size, s: integer 0..999999999 = 10000000
  family, f: name = testing
  user, u: name = $system
  configuration, c: string 1..10 = 'C302 S302'
  tab_file, tf: file = $user.ptu.tf.$next
  collection_file, cf: file = $user.ptu.cf
  write_modified_pages, wmp: boolean = TRUE
  free_pages, fp: boolean = TRUE
  loop_count, lc: integer = 1
  output, o: file = $user.ptu.sum.$next
  collect_keypoints, ck: key
      (all, a)
      (write_normal, wn)
      (write_sequential, ws)
      (write_advise, wa)
      (read_normal, rn)
      (read_sequential, rs)
      (read_advise, ra)
      (none, n)
    keyend = none
  keypoint_selection, ks: key
      (server, s)
      (disk, d)
      (both, b)
    keyend = server
  keypoint_param, kp: name = system
  collect_mmio_data, cmd: boolean = TRUE
  compare_times, compare_time, ct: boolean = FALSE
  flush_in_millions, fim: integer 0..500 = 0
  allocation_size, as: key
      #16k, #32k, #65k, #131k, #262k, #524k, #1048k, all, a
    keyend = #16K
  transfer_size, ts: key
      #16K, #32K, #65K, #131K, #262K, #524k, #1048k, all, a
    keyend = #16K
  server_initial_volume, siv: (BY_NAME) any of key (system_device, sd), keyend,
       name 6..6, anyend = $optional
  local_initial_volume, liv: (BY_NAME) any of key (system_device, sd), keyend,
       name 6..6, anyend = $optional
  help, h: file = $optional
  status)

  "$FORMAT=OFF
  VAR
    un: string = $unique
  VAREND
  "$FORMAT=ON"
COLLECT_TEXT $fname(un)

  PROC GENERATE_PTU_SUMMARY

  This purpose of this procedure is to collect data concerning file server
  file transfers.  Files of the specified SIZE are written to the FAMILY
  and USER specified. Files are written and read using NORMAL, SEQUENTIAL,
  and ADVISED methods. For comparison purposes, similar files are written
  and read in the user catalog (which assumes the user's catalog is not in
  a served family).
  When running GENPS you need to have (read, write) permission to the user
  specified by FAMILY and USER catalog. If the FREE_PAGES parameter is TRUE,
  the specified USER must also have granted READ/WRITE permission to the
  the user :$SYSTEM.$SYSTEM. If running GENPS from the system console these
  permissions are already defined.

  If the COLLECT_MMIO_DATA value is set TRUE, the a remote procedure call will
  be made after each server file operation to collect the memory management
  data for that operation.

  The CONFIGURATION parameter is for documention. C302 S608 would mean that the
  run was made with SN302 as the Client and SN608 as the Server.

  The TAB_FILE consists of the output data separated by tabs. This file is
  used as an input to an EXCEL program

  The COLLECTION_FILE is the file used for collecting keypoints if the
  COLLECT_KEYPOINTS value is other than NONE.

  WRITE_MODIFIED_PAGES controls a Memory Manager operation.

  FREE_PAGES controls whether mmp$free_pages should be called after writing
  each file. This parameter is provided only to check whether the free pages
  actions are effective.

  LOOP_COUNT cntrols the numebr of times the main loop of this procedure is
  executed.

  OUTPUT specifies the listable output file.

  The COLLECT_KEYPOINTS parameter specifies for which operation keypoints are
  to be collected. Since keypoint data is rather voluminous, it is suggested
  that if keypoints are to be collected that the size of the files be limited.
  Usually the size is set to 1MB if keypoints are specified.

  KEYPOINT_SELECTION specifies for what keypoints sre to be collected - server,
  disk, or both. This parameter is valid only if the value of the
  COLLECT_KEYPOINTS parameter is other than NONE.

  KEYPOINT_PARAM is the parameter to the reserve_keypoint_environment command
  which specifies the environment.

  COLLECT_MMIO_DATA controls whether a remote procedure call will be made to the
  server to return Memory Manager io data.

  COMPARE_TIMES provides for a regression-type test. If specified true, then
  the results of the current run are compared with result of previous runs.
  Previous results are hard coded in this procedure and are valid for loopback
  runs of SN302(860) orSN604(830) using the "standard" parameter values of
  this procedure.

  FLUSH_IN_MILLIONS is an attempt to flush all server pages to disk by writing
  a server file the size (* one million) specified prior to reading the files
  of interest. This should not be necessary if free_pages is specified as true.

  ALLOCATION_SIZE is used to determine the allocation_size parameter value to
  be specified on the request_mass_storage command.

  TRANSFER_SIZE is used to determine the transfer_size parameter value to
  be specified on the request_mass_storage command.

  SERVER_INITIAL_VOLUME is the Initial_Volume parameter value to be specified on
  the REQUEST_MASS_STORAGE commands issued by GENPS for the "served file" tests.

  LOCAL_INITIAL_VOLUME is the Initial_Volume parameter value to be specified on
  the REQUEST_MASS_STORAGE commands issued by GENPS for the "local file" tests.

     The GENPS parameters SERVER_INITIAL_VOLUME and LOCAL_INITIAL_VOLUME
     provide the option of selecting mass storage devices within the user's
     validation limits. The specified parameter value is passed along on the
     REQUEST_MASS_STORAGE command to allow selection of a specific mass
     storage volume for the file.
     Users are each validated to have their files on a specific mass
     storage set. Each set consists of one or more mass storage volumes
     that are candidates for assignment to user's files.
     The tester using GENPS should be aware that I/O speeds for
     different mass storage devices may vary.

  HELP specifies the file to which this info will be written.

  STATUS returns the status of this command.
**
  IF $specified(help) THEN
    copy_file input=$fname(un) output=help
    detach_file $fname(un)
    EXIT_PROC
  ELSE
    detach_file $fname(un)
  IFEND

  "$FORMAT=OFF
  VAR
    as_array: array 1..7 of integer
    as_par_array: array 1..7 of string
    as_array_index: integer 1..7
    as_array_start_index: integer 1..7 = 1
    as_array_stop_index: integer 1..7 = 1
    compare_errors: integer = 0
    ignore_status: status
    mmio_file: string = $unique
"
" The next four variables are generated to specify temporary files for the output
" and tab_files.  This is done since if these files are specified with $NEXT,
" SCL will now ('new' types) generate a new cycle every time such files are
" opened (which happens with each PUT_LINE)
    out: string
    out_unique: string
    tab_out: string
    tab_out_unique: string
"
    ts_array: array 1..7 of integer
    ts_par_array: array 1..7 of string
    ts_array_index: integer 1..7
    ts_array_start_index: integer 1..7 = 1
    ts_array_stop_index: integer 1..7 = 1
  VAREND
  "$FORMAT=ON"

  crec $user.ptu status=ignore_status
  setpa al=cyf$run_time_library status=ignore_status
  tab = $char(9)
  ck_value = $string(collect_keypoints)
  ks_value = $string(keypoint_selection)

  IF (ks_value = 'SERVER') OR (ks_value = 'S') THEN
    kp_server = true
    kp_disk = false
  ELSEIF (ks_value = 'DISK') OR (ks_value = 'D') THEN
    kp_server = false
    kp_disk = true
  ELSE
    kp_server = true
    kp_disk = true
  IFEND

" Process allocation_size and transfer_size parameters

    as_par_array(1) = '#16K'
    as_par_array(2) = '#32K'
    as_par_array(3) = '#65K'
    as_par_array(4) = '#131K'
    as_par_array(5) = '#262K'
    as_par_array(6) = '#524K'
    as_par_array(7) = '#1048K'

    as_array(1) = 16384
    as_array(2) = 32768
    as_array(3) = 65536
    as_array(4) = 131072
    as_array(5) = 262144
    as_array(6) = 524288
    as_array(7) = 1048576

  as_value = $string(allocation_size)
  IF as_value = '#16K' THEN
    as_array_start_index = 1
    as_array_stop_index =  1
  ELSEIF as_value = '#32K' THEN
    as_array_start_index = 2
    as_array_stop_index =  2
  ELSEIF as_value = '#65K' THEN
    as_array_start_index = 3
    as_array_stop_index =  3
  ELSEIF as_value = '#131K' THEN
    as_array_start_index = 4
    as_array_stop_index =  4
  ELSEIF as_value = '#262K' THEN
    as_array_start_index = 5
    as_array_stop_index =  5
  ELSEIF as_value = '#524K' THEN
    as_array_start_index = 6
    as_array_stop_index =  6
  ELSEIF as_value = '#1048K' THEN
    as_array_start_index = 7
    as_array_stop_index =  7
  ELSEIF as_value(1) = 'A' THEN
    as_array_start_index = 1
    as_array_stop_index =  7
  IFEND

    ts_par_array(1) = '#16K'
    ts_par_array(2) = '#32K'
    ts_par_array(3) = '#65K'
    ts_par_array(4) = '#131K'
    ts_par_array(5) = '#262K'
    ts_par_array(6) = '#524K'
    ts_par_array(7) = '#1048K'

    ts_array(1) = 16384
    ts_array(2) = 32768
    ts_array(3) = 65536
    ts_array(4) = 131072
    ts_array(5) = 262144
    ts_array(6) = 524288
    ts_array(7) = 1048576

  ts_value = $string(transfer_size)
  IF ts_value = '#16K' THEN
    ts_array_start_index = 1
    ts_array_stop_index =  1
  ELSEIF ts_value = '#32K' THEN
    ts_array_start_index = 2
    ts_array_stop_index =  2
  ELSEIF ts_value = '#65K' THEN
    ts_array_start_index = 3
    ts_array_stop_index =  3
  ELSEIF ts_value = '#131K' THEN
    ts_array_start_index = 4
    ts_array_stop_index =  4
  ELSEIF ts_value = '#262K' THEN
    ts_array_start_index = 5
    ts_array_stop_index =  5
  ELSEIF ts_value = '#524K' THEN
    ts_array_start_index = 6
    ts_array_stop_index =  6
  ELSEIF ts_value = '#1048K' THEN
    ts_array_start_index = 7
    ts_array_stop_index =  7
  ELSEIF ts_value(1) = 'A' THEN
    ts_array_start_index = 1
    ts_array_stop_index =  7
  IFEND

"

  set_file_attributes file=output file_contents=list file_structure=data status=ignore_status
  get_mmio_parameters = 'family=' // $string(family)// ' mmio_file=' // mmio_file
  IF free_pages THEN
    get_mmio_parameters = get_mmio_parameters//' free_pages=TRUE user='//$strrep(user)//' file='
  ELSE
    get_mmio_parameters = get_mmio_parameters//' free_pages=FALSE'
  IFEND

  " Create the mmio file so that it will have ring attributes of this job/task.
COLT $fname(mmio_file)
**

  "Create statistics array
  "$FORMAT=OFF
  VAR
    stats: array 1..2  "disk, server       " of ..
           array 1..2  "write, read        " of ..
           array 1..3  "normal, seq, advise" of ..
           array 1..3  "elapsed, ioc, alc  " of ..
           array 1..3  "mon, max, ave      " of integer
    disk@: integer = 1
    server@: integer = 2

    write@: integer = 1
    read@: integer = 2

    normal@: integer = 1
    seq@: integer = 2
    advise@: integer = 3

    elapsed@: integer = 1
    ioc@: integer = 2  "IO count"
    alc@: integer = 3 "allocation count"

    min@: integer = 1
    max@: integer = 2
    ave@: integer = 3
  VAREND
  "$FORMAT=ON

  IF compare_times THEN
    IF NOT (($mainframe(id) = '$SYSTEM_0830_0604') OR ($mainframe(id) = '$SYSTEM_0860_0302')) THEN
      EXIT_PROC WITH $status(false, 'DF', 333, ' COMPARE_OUTPUT is valid only for SN302 or SN604')
    IFEND
  IFEND

  IF compare_times AND ($mainframe(id) = '$SYSTEM_0830_0604') THEN
    " The following values were generated from several GENPS runs on SN604
    " with default GENPS parameter values.
    " Memory size was 16MB.
    " File server was running loopback, no other jobs.
    " The system had been deadstarted with the default configuration prolog,
    "   that is, USECP SN604_ISD2_2X4.
    stats(disk@)(write@)(normal@)(elapsed@)(min@) = 11
    stats(disk@)(write@)(normal@)(elapsed@)(max@) = 17
    stats(server@)(write@)(normal@)(elapsed@)(min@) = 30
    stats(server@)(write@)(normal@)(elapsed@)(max@) = 41
    stats(server@)(write@)(normal@)(ioc@)(min@) = 605
    stats(server@)(write@)(normal@)(ioc@)(max@) = 630
    stats(server@)(write@)(normal@)(alc@)(min@) = 145
    stats(server@)(write@)(normal@)(alc@)(max@) = 160

    stats(disk@)(write@)(seq@)(elapsed@)(min@) = 9
    stats(disk@)(write@)(seq@)(elapsed@)(max@) = 18
    stats(server@)(write@)(seq@)(elapsed@)(min@) = 21
    stats(server@)(write@)(seq@)(elapsed@)(max@) = 31
    stats(server@)(write@)(seq@)(ioc@)(min@) = 610
    stats(server@)(write@)(seq@)(ioc@)(max@) = 618
    stats(server@)(write@)(seq@)(alc@)(min@) = 145
    stats(server@)(write@)(seq@)(alc@)(max@) = 160

    stats(disk@)(write@)(advise@)(elapsed@)(min@) = 9
    stats(disk@)(write@)(advise@)(elapsed@)(max@) = 14
    stats(server@)(write@)(advise@)(elapsed@)(min@) = 25
    stats(server@)(write@)(advise@)(elapsed@)(max@) = 31
    stats(server@)(write@)(advise@)(ioc@)(min@) = 608
    stats(server@)(write@)(advise@)(ioc@)(max@) = 620
    stats(server@)(write@)(advise@)(alc@)(min@) = 145
    stats(server@)(write@)(advise@)(alc@)(max@) = 160

    stats(disk@)(read@)(normal@)(elapsed@)(min@) = 8
    stats(disk@)(read@)(normal@)(elapsed@)(max@) = 12
    stats(server@)(read@)(normal@)(elapsed@)(min@) = 25
    stats(server@)(read@)(normal@)(elapsed@)(max@) = 31
    stats(server@)(read@)(normal@)(ioc@)(min@) = 605
    stats(server@)(read@)(normal@)(ioc@)(max@) = 630
    stats(server@)(read@)(normal@)(alc@)(min@) = 0
    stats(server@)(read@)(normal@)(alc@)(max@) = 0

    stats(disk@)(read@)(seq@)(elapsed@)(min@) = 7
    stats(disk@)(read@)(seq@)(elapsed@)(max@) = 10
    stats(server@)(read@)(seq@)(elapsed@)(min@) = 25
    stats(server@)(read@)(seq@)(elapsed@)(max@) = 30
    stats(server@)(read@)(seq@)(ioc@)(min@) = 605
    stats(server@)(read@)(seq@)(ioc@)(max@) = 630
    stats(server@)(read@)(seq@)(alc@)(min@) = 0
    stats(server@)(read@)(seq@)(alc@)(max@) = 0

    stats(disk@)(read@)(advise@)(elapsed@)(min@) = 7
    stats(disk@)(read@)(advise@)(elapsed@)(max@) = 10
    stats(server@)(read@)(advise@)(elapsed@)(min@) = 18
    stats(server@)(read@)(advise@)(elapsed@)(max@) = 22
    stats(server@)(read@)(advise@)(ioc@)(min@) = 605
    stats(server@)(read@)(advise@)(ioc@)(max@) = 630
    stats(server@)(read@)(advise@)(alc@)(min@) = 0
    stats(server@)(read@)(advise@)(alc@)(max@) = 0
  IFEND

  IF compare_times AND ($mainframe(id) = '$SYSTEM_0860_0302') THEN
    " The following values were generated from several GENPS runs on SN302
    " with default GENPS parameter values.
    " Memory size was 16MB.
    " File server was running loopback, no other jobs.
    " The system had been deadstarted with the default configuration prolog,
    "   that is, USECP SN302_895_2X4.
    stats(disk@)(write@)(normal@)(elapsed@)(min@) = 5
    stats(disk@)(write@)(normal@)(elapsed@)(max@) = 7
    stats(server@)(write@)(normal@)(elapsed@)(min@) = 8
    stats(server@)(write@)(normal@)(elapsed@)(max@) = 12
    stats(server@)(write@)(normal@)(ioc@)(min@) = 605
    stats(server@)(write@)(normal@)(ioc@)(max@) = 630
    stats(server@)(write@)(normal@)(alc@)(min@) = 145
    stats(server@)(write@)(normal@)(alc@)(max@) = 160

    stats(disk@)(write@)(seq@)(elapsed@)(min@) = 4
    stats(disk@)(write@)(seq@)(elapsed@)(max@) = 6
    stats(server@)(write@)(seq@)(elapsed@)(min@) = 4
    stats(server@)(write@)(seq@)(elapsed@)(max@) = 7
    stats(server@)(write@)(seq@)(ioc@)(min@) = 610
    stats(server@)(write@)(seq@)(ioc@)(max@) = 618
    stats(server@)(write@)(seq@)(alc@)(min@) = 145
    stats(server@)(write@)(seq@)(alc@)(max@) = 160

    stats(disk@)(write@)(advise@)(elapsed@)(min@) = 4
    stats(disk@)(write@)(advise@)(elapsed@)(max@) = 6
    stats(server@)(write@)(advise@)(elapsed@)(min@) = 5
    stats(server@)(write@)(advise@)(elapsed@)(max@) = 8
    stats(server@)(write@)(advise@)(ioc@)(min@) = 608
    stats(server@)(write@)(advise@)(ioc@)(max@) = 622
    stats(server@)(write@)(advise@)(alc@)(min@) = 145
    stats(server@)(write@)(advise@)(alc@)(max@) = 160

    stats(disk@)(read@)(normal@)(elapsed@)(min@) = 4
    stats(disk@)(read@)(normal@)(elapsed@)(max@) = 6
    stats(server@)(read@)(normal@)(elapsed@)(min@) = 7
    stats(server@)(read@)(normal@)(elapsed@)(max@) = 9
    stats(server@)(read@)(normal@)(ioc@)(min@) = 605
    stats(server@)(read@)(normal@)(ioc@)(max@) = 630
    stats(server@)(read@)(normal@)(alc@)(min@) = 0
    stats(server@)(read@)(normal@)(alc@)(max@) = 0

    stats(disk@)(read@)(seq@)(elapsed@)(min@) = 4
    stats(disk@)(read@)(seq@)(elapsed@)(max@) = 6
    stats(server@)(read@)(seq@)(elapsed@)(min@) = 7
    stats(server@)(read@)(seq@)(elapsed@)(max@) = 9
    stats(server@)(read@)(seq@)(ioc@)(min@) = 605
    stats(server@)(read@)(seq@)(ioc@)(max@) = 630
    stats(server@)(read@)(seq@)(alc@)(min@) = 0
    stats(server@)(read@)(seq@)(alc@)(max@) = 0

    stats(disk@)(read@)(advise@)(elapsed@)(min@) = 4
    stats(disk@)(read@)(advise@)(elapsed@)(max@) = 6
    stats(server@)(read@)(advise@)(elapsed@)(min@) = 4
    stats(server@)(read@)(advise@)(elapsed@)(max@) = 6
    stats(server@)(read@)(advise@)(ioc@)(min@) = 605
    stats(server@)(read@)(advise@)(ioc@)(max@) = 630
    stats(server@)(read@)(advise@)(alc@)(min@) = 0
    stats(server@)(read@)(advise@)(alc@)(max@) = 0
  IFEND

  as_loop: ..
   FOR as_array_index = as_array_start_index to as_array_stop_index DO
     alloc_size = as_array(as_array_index)
     as_par = as_par_array(as_array_index)

  ts_loop: ..
   FOR ts_array_index = ts_array_start_index to ts_array_stop_index DO
     trans_size = ts_array(ts_array_index)
     ts_par = ts_par_array(ts_array_index)

loop_counter_loop: ..
  FOR loop_counter = 1 TO loop_count DO

     out_unique = $unique
     out = out_unique//'.$eoi'
     tab_out_unique = $unique
     tab_out = tab_out_unique//'.$eoi'

    config_base = configuration// tab //$date(mdy) // tab // ..
       as_par// tab //ts_par// tab // $strrep(size)
    config_base_d = $substring(configuration, 1, 5)// ' disk' // tab // $date(mdy) // ..
       tab //as_par// tab //ts_par// tab // $strrep(size)
    dest = ':' // $string(family)// '.' // $string(user)

    incl 'display_system_configuration output='//out status=ignore_status
    put_line '1 FILE SERVER PERFORMANCE TEST UTILITY   Date = '//$date(mdy)//'  Time = '//$time(hms) ..
          output=$fname(out)
    put_line '  Mainframe = '//$mainframe(id) output=$fname(out)
    put_line '      Collect_keypoint option = '//ck_value output=$fname(out)
    put_line '      Configuration = '//configuration output=$fname(out)
    put_line '      Collect_MMIO_Data = '//$strrep(collect_mmio_data) output=$fname(out)
    put_line '      Size = '//$strrep(size) output=$fname(out)
    put_line '      Allocation_size option = '//as_par//' ('//as_value//')' output=$fname(out)
    put_line '        Allocation Size = '//$strrep(alloc_size) output=$fname(out)
    put_line '      Transfer_size option = '//ts_par//' ('//ts_value//')' output=$fname(out)
    put_line '        Transfer Size = '//$strrep(trans_size) output=$fname(out)
    IF $specified(server_initial_volume) THEN
      put_line '      Server_initial_volume = '//$strrep(Server_initial_volume) output=$fname(out)
    IFEND
    IF $specified(server_initial_volume) THEN
      put_line '      Local_initial_volume = '//$strrep(local_initial_volume) output=$fname(out)
    IFEND
    put_line '      FMI = '//$strrep(flush_in_millions) output=$fname(out)
    put_line '      Free_pages = '//$strrep(free_pages) output=$fname(out)
    IF $specified(collect_keypoints) THEN
      put_line '      Keypoint_collection_file = '//$string(collection_file) output=$fname(out)
      cf_string = $string(collection_file)// '.$next'
      put_line '      Keypoint_selection = '//$string(keypoint_selection) output=$fname(out)
    IFEND
    put_line ' ' output=$fname(out)
    put_line '       NON-FILE-SERVER             FILE-SERVER' output=$fname(out)
    put_line '                              CLIENT         SERVER MONITOR STATS' output=$fname(out)
    put_line ' ' output=$fname(out)
    put_line '                                              AVE             MAX        COUNT' ..
          output=$fname(out)
    put_line '  WRITE' output=$fname(out)

" Process NORMAL
    putl ' Start Normal WRITE - Server' output=$output
    destn = dest // '.genpsN'
    detf $local.genpsn status=ignore_status
    IF loop_counter = 1 THEN
      delf $fname(destn) status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(server_initial_volume)) THEN
        request_mass_storage f= $fname(destn) as = alloc_size ..
             ts = trans_size iv = server_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for server device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $fname(destn) status=ignore_status
        attf $fname(destn) genpsn am=all
      ELSE
        create_file file=$fname(destn) local_file_name=genpsn
      IFEND
    ELSE
      attf $fname(destn) genpsn am=all
    IFEND


    IF ((ck_value = 'WN') OR (ck_value = 'A') OR (ck_value = 'ALL') OR (ck_value = 'WRITE_NORMAL')) AND ..
          kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='NORMAL SERVER WRITE'
      stakc
      dfp$ptu $local.genpsn w m=n s=size wmp=write_modified_pages fp=free_pages
      detach_file $local.genpsn
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $local.genpsn w m=n s=size wmp=write_modified_pages fp=free_pages
      detach_file $local.genpsn
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Normal WRITE - noserver' output=$output

    IF loop_counter = 1 THEN
      delf $user.ugenpsn status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(local_initial_volume)) THEN
        request_mass_storage f= $user.ugenpsn as = alloc_size ..
             ts = trans_size iv = local_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for local device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $user.ugenpsn status=ignore_status
        attf $user.ugenpsn ugenpsn am=all
      ELSE
        create_file file=$user.ugenpsn local_file_name=ugenpsn status=ignore_status
      IFEND
    ELSE
      attf $user.ugenpsn ugenpsn am=all
    IFEND
    IF ((ck_value = 'WN') OR (ck_value = 'A') OR (ck_value = 'ALL') OR (ck_value = 'WRITE_NORMAL')) AND ..
          kp_disk THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='NORMAL DISK WRITE'
      stakc
      dfp$ptu ugenpsn w m=n s=size wmp=write_modified_pages fp=free_pages
      detf ugenpsn
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu ugenpsn w m=n s=size wmp=write_modified_pages fp=free_pages
      detf ugenpsn
    IFEND

    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpsn'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    ELSE
      ptu@mon_ave_io_time = '0.00000'
      ptu@mon_max_io_time = '0.00000'
      ptu@mon_io_count = '1'
      ptu@mon_ave_allocate_time = '0.00000'
      ptu@mon_max_allocate_time = '0.00000'
      ptu@mon_allocate_count = '1'
      ptu@mon_trace_count = 0
    IFEND

    put_line '    N    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)

    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(write@)(normal@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(write@)(normal@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,write,normal,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(write@)(normal@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(write@)(normal@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(write@)(normal@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(write@)(normal@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,write,normal,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(normal@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(write@)(normal@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(write@)(normal@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(write@)(normal@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,normal,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(normal@)(ioc@)(min@))..
//' to '//$strrep(stats(server@)(write@)(normal@)(ioc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(write@)(normal@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(write@)(normal@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,normal,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(normal@)(alc@)(min@))..
//' to '//$strrep(stats(server@)(write@)(normal@)(alc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND


    put_line '  ' output=$fname(out)

    config = config_base // tab // 'Write Normal'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Write Normal'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)

" Process SEQUENTIAL

    putl ' Start Sequen WRITE - Server' output=$output
    dests = dest // '.genpsS'
    IF loop_counter = 1 THEN
      delf $fname(dests) status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(server_initial_volume)) THEN
        request_mass_storage f= $fname(dests) as = alloc_size ..
             ts = trans_size iv = server_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for server device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $fname(dests) status=ignore_status
      ELSE
        create_file file=$fname(dests) local_file_name=genpss status=ignore_status
        detf $fname(dests) status=ignore_status
      IFEND
    IFEND
    IF ((ck_value = 'WS') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'WRITE_SEQUENTIAL')) AND kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='SEQUENTIAL SERVER WRITE'
      stakc
      dfp$ptu $fname(dests) w m=s s=size wmp=write_modified_pages fp=free_pages
      detach_file $fname(dests) status=ignore_status
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $fname(dests) w m=s s=size wmp=write_modified_pages fp=free_pages
      detach_file $fname(dests) status=ignore_status
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Sequen WRITE - noserver' output=$output
    IF loop_counter = 1 THEN
      delf $user.ugenpss status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(local_initial_volume)) THEN
        request_mass_storage f= $user.ugenpss as = alloc_size ..
             ts = trans_size iv = local_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for local device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $user.ugenpss status=ignore_status
      ELSE
        create_file file=$user.ugenpss local_file_name=ugenpss status=ignore_status
        detf $user.ugenpss
      IFEND
    IFEND
    IF ((ck_value = 'WS') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'WRITE_SEQUENTIAL')) AND kp_disk THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='SEQUENTIAL DISK WRITE'
      stakc
      dfp$ptu $user.ugenpss w m=s s=size wmp=write_modified_pages fp=free_pages
      detf $user.ugenpss  status=ignore_status
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $user.ugenpss w m=s s=size wmp=write_modified_pages fp=free_pages
      detf $user.ugenpss status=ignore_status
    IFEND
    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpss'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    IFEND

    put_line '    S    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)

    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(write@)(seq@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(write@)(seq@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,write,seq,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(write@)(seq@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(write@)(seq@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(write@)(seq@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(write@)(seq@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,write,seq,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(seq@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(write@)(seq@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(write@)(seq@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(write@)(seq@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,seq,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(seq@)(ioc@)(min@))//' to '//$strrep(stats(server@)(write@)(seq@)(ioc@)(max@))..
 output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(write@)(seq@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(write@)(seq@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,seq,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(seq@)(alc@)(min@))//' to '//$strrep(stats(server@)(write@)(seq@)(alc@)(max@))..
 output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND

    config = config_base // tab // 'Write Sequen'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Write Sequen'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)


    putl ' Start Advised WRITE - Server' output=$output
" Process ADVISED
    put_line '     ' output=$fname(out)
    desta = dest // '.genpsA'
    IF loop_counter = 1 THEN
      delf $fname(desta) status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(server_initial_volume)) THEN
        request_mass_storage f= $fname(desta) as = alloc_size ..
             ts = trans_size iv = server_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for server device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $fname(desta) status=ignore_status
        attf $fname(desta) genpsa am=all
      ELSE
        create_file file=$fname(desta) local_file_name=genpsa status=ignore_status
      IFEND
    ELSE
      attf $fname(desta) genpsa am=all
    IFEND
    IF ((ck_value = 'WA') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'WRITE_ADVISE')) AND kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='ADVISE SERVER WRITE'
      stakc
      dfp$ptu $local.genpsa w m=a s=size wmp=write_modified_pages fp=free_pages
      detach_file $local.genpsa
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $local.genpsa w m=a s=size wmp=write_modified_pages fp=free_pages
      detach_file $local.genpsa
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Advised WRITE - noserver' output=$output
    IF loop_counter = 1 THEN
      delf $user.ugenpsa status=ignore_status
      IF ($specified(allocation_size)) OR ($specified(transfer_size)) ..
         OR ($specified(local_initial_volume)) THEN
        request_mass_storage f= $user.ugenpsa as = alloc_size ..
             ts = trans_size iv = local_initial_volume status = ignore_status
        IF NOT ignore_status.normal THEN
          putl ' ERROR on REQMS for local device -' output=$output
          DISV ignore_status output=$output
        IFEND
        detf $user.ugenpsa status=ignore_status
        attf $user.ugenpsa ugenpsa am=all
      ELSE
        create_file file=$user.ugenpsa local_file_name=ugenpsa status=ignore_status
      IFEND
    ELSE
      attf $user.ugenpsa ugenpsa am=all
    IFEND
    IF ((ck_value = 'WA') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'WRITE_ADVISE')) AND kp_disk THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='ADVISE DISK WRITE'
      stakc
      dfp$ptu ugenpsa w m=a s=size wmp=write_modified_pages fp=free_pages
      detf ugenpsa
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu ugenpsa w m=a s=size wmp=write_modified_pages fp=free_pages
      detf ugenpsa
    IFEND
    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpsa'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    IFEND

    put_line '    A    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)

    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(write@)(advise@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(write@)(advise@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,write,advise,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(write@)(advise@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(write@)(advise@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(write@)(advise@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(write@)(advise@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,write,advise,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(advise@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(write@)(advise@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(write@)(advise@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(write@)(advise@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,advise,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(advise@)(ioc@)(min@))..
//' to '//$strrep(stats(server@)(write@)(advise@)(ioc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(write@)(advise@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(write@)(advise@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,write,advise,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(write@)(advise@)(alc@)(min@))..
//' to '//$strrep(stats(server@)(write@)(advise@)(alc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND


    config = config_base // tab // 'Write Advise'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Write Advise'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)

    IF flush_in_millions> 0 THEN
      putl '    Start page flush - Server' output=$output
      destn = dest // '.genpsF'
      detach_file $local.genpsf status=ignore_status
      delf $fname(destn) status=ignore_status
      cref $fname(destn) genpsf status=ignore_status
      IF NOT ignore_status.normal THEN
        attf $fname(destn) genpsf am=all
      IFEND
      dfp$ptu $local.genpsf w m=n s=flush_in_millions*1000000 wmp=write_modified_pages fp=free_pages
      detach_file $local.genpsf
      IF collect_mmio_data THEN
        send_mmio_parameters = get_mmio_parameters
        IF free_pages THEN
          send_mmio_parameters = send_mmio_parameters//'genpsa'
        IFEND
        exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
        chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
        delf $fname(mmio_file) status=ignore_status
      IFEND
      delf $fname(destn) status=ignore_status
    IFEND

    put_line '  ' output=$fname(out)
    put_line '  READ' output=$fname(out)

" Process NORMAL

    putl ' Start Normal READ  - Server' output=$output
    destn = dest // '.genpsN'
    attf $fname(destn) genpsn
    IF ((ck_value = 'RN') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'READ_NORMAL')) AND kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='NORMAL SERVER READ'
      stakc
      dfp$ptu $local.genpsn r m=n wmp=false
      detach_file $local.genpsn
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $local.genpsn r m=n wmp=false
      detach_file $local.genpsn
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Normal READ  - noserver' output=$output
    attf $user.ugenpsn ugenpsn
    IF ((ck_value = 'RN') OR (ck_value = 'A') OR (ck_value = 'ALL') OR (ck_value = 'READ_NORMAL')) AND kp_disk..
           THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='NORMAL DISK READ'
      stakc
      dfp$ptu ugenpsn r m=n wmp=false
      detf ugenpsn
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu ugenpsn r m=n wmp=false
      detf ugenpsn
    IFEND
    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpsn'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    ELSE
      ptu@mon_ave_io_time = '0.00000'
      ptu@mon_max_io_time = '0.00000'
      ptu@mon_io_count = '1'
      ptu@mon_trace_count = 0
    IFEND

    put_line '    N    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)


    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(read@)(normal@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(read@)(normal@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,read,normal,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(read@)(normal@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(read@)(normal@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(read@)(normal@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(read@)(normal@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,read,normal,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(normal@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(read@)(normal@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(read@)(normal@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(read@)(normal@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,normal,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(normal@)(ioc@)(min@))..
//' to '//$strrep(stats(server@)(read@)(normal@)(ioc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(read@)(normal@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(read@)(normal@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,normal,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(normal@)(alc@)(min@))..
//' to '//$strrep(stats(server@)(read@)(normal@)(alc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND

    put_line '  ' output=$fname(out)

    config = config_base // tab // 'Read Normal'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Read Normal'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)


" Process SEQUENTIAL

    putl ' Start Sequen READ  - Server' output=$output
    dests = dest // '.genpsS'
    IF ((ck_value = 'RS') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'READ_SEQUENTIAL')) AND kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='SEQUENTIAL SERVER READ'
      stakc
      dfp$ptu $fname(dests) r m=s wmp=false
      detach_file $fname(dests) status=ignore_status
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $fname(dests) r m=s wmp=false
      detach_file $fname(dests) status=ignore_status
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Sequen READ  - noserver' output=$output
    IF ((ck_value = 'RS') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'READ_SEQUENTIAL')) AND kp_disk THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='SEQUENTIAL DISK READ'
      stakc
      dfp$ptu $user.ugenpss r m=s wmp=false
      detf $user.ugenpss status=ignore_status
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $user.ugenpss r m=s wmp=false
      detf $user.ugenpss status=ignore_status
    IFEND
    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpss'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    IFEND

    put_line '    S    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)


    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(read@)(seq@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(read@)(seq@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,read,seq,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(read@)(seq@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(read@)(seq@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(read@)(seq@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(read@)(seq@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,read,seq,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(seq@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(read@)(seq@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(read@)(seq@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(read@)(seq@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,seq,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(seq@)(ioc@)(min@))//' to '//$strrep(stats(server@)(read@)(seq@)(ioc@)(max@)) ..
              output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(read@)(seq@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(read@)(seq@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,seq,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(seq@)(alc@)(min@))//' to '//$strrep(stats(server@)(read@)(seq@)(alc@)(max@)) ..
              output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND

    config = config_base // tab // 'Read Sequen'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Read Sequen'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)


" Process ADVISED
    putl ' Start Advised READ  - Server' output=$output
    put_line '     ' output=$fname(out)
    desta = dest // '.genpsA'
    attf $fname(desta) genpsa
    IF ((ck_value = 'RA') OR (ck_value = 'A') OR (ck_value = 'ALL') OR ..
          (ck_value = 'READ_ADVISE')) AND kp_server THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='ADVISE SERVER READ'
      stakc
      dfp$ptu $local.genpsa r m=a wmp=false
      detach_file $local.genpsa
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu $local.genpsa r m=a wmp=false
      detach_file $local.genpsa
    IFEND
    incf $user.ptu_report
    server_elapsed = ptu#elapsed_time
    server_mon = ptu#mon_time
    server_task = ptu#task_time

    putl ' Start Advised READ  - noServer' output=$output
    attf $user.ugenpsa ugenpsa
    IF ((ck_value = 'RA') OR (ck_value = 'A') OR (ck_value = 'ALL') OR (ck_value = 'READ_ADVISE')) AND kp_disk..
           THEN
      reske keypoint_param cf=$fname(cf_string) kc=1000000 ds='ADVISE DISK READ'
      stakc
      dfp$ptu ugenpsa r m=a wmp=false
      detf ugenpsa
      stokc
      relke
      chafa collection_file ra=(11, 11, 11)
    ELSE
      dfp$ptu ugenpsa r m=a wmp=false
      detf ugenpsa
    IFEND
    incf $user.ptu_report

    IF collect_mmio_data THEN
      send_mmio_parameters = get_mmio_parameters
      IF free_pages THEN
        send_mmio_parameters = send_mmio_parameters//'genpsa'
      IFEND
      exet sp=dfp$get_mmio_data parameter=send_mmio_parameters
      chafa $fname(mmio_file) ra=(11, 11, 11) status=ignore_status
      incf $fname(mmio_file)
    IFEND

    put_line '    A    E  '//ptu#elapsed_time//'      '//server_elapsed//'    IO   '//ptu@mon_ave_io_time//..
'     '//ptu@mon_max_io_time//'      '//ptu@mon_io_count output=$fname(out)
    put_line '         M  '//ptu#mon_time//'      '//server_mon//'    AL   '//ptu@mon_ave_allocate_time//..
'     '//ptu@mon_max_allocate_time//'      '//ptu@mon_allocate_count output=$fname(out)
    put_line '         T  '//ptu#task_time//'      '//server_task//'            trace_count = '//..
$strrep(ptu@mon_trace_count) output=$fname(out)


    IF compare_times THEN
      "disk elapsed
      IF ($integer($real(ptu#elapsed_time)) < stats(disk@)(read@)(advise@)(elapsed@)(min@)) OR ..
            ($integer($real(ptu#elapsed_time)) > stats(disk@)(read@)(advise@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in disk,read,advise,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(disk@)(read@)(advise@)(elapsed@)(min@))..
//' to '//$strrep(stats(disk@)(read@)(advise@)(elapsed@)(max@)) output=$response
        put_line ' Found '//ptu#elapsed_time output=$response
        compare_errors = compare_errors+1
      IFEND
      "server elapsed
      IF ($integer($real(server_elapsed)) < stats(server@)(read@)(advise@)(elapsed@)(min@)) OR ..
            ($integer($real(server_elapsed)) > stats(server@)(read@)(advise@)(elapsed@)(max@)) THEN
        put_line ' *** CHANGE in server,read,advise,elapsed ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(advise@)(elapsed@)(min@))..
//' to '//$strrep(stats(server@)(read@)(advise@)(elapsed@)(max@)) output=$response
        put_line ' Found '//server_elapsed output=$response
        compare_errors = compare_errors+1
      IFEND
      "server io count
      IF ($integer(ptu@mon_io_count) < stats(server@)(read@)(advise@)(ioc@)(min@)) OR ..
            ($integer(ptu@mon_io_count) > stats(server@)(read@)(advise@)(ioc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,advise,ioc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(advise@)(ioc@)(min@))..
//' to '//$strrep(stats(server@)(read@)(advise@)(ioc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_io_count output=$response
        compare_errors = compare_errors+1
      IFEND
      "server allocate count
      IF ($integer(ptu@mon_allocate_count) < stats(server@)(read@)(advise@)(alc@)(min@)) OR ..
            ($integer(ptu@mon_allocate_count) > stats(server@)(read@)(advise@)(alc@)(max@)) THEN
        put_line ' *** CHANGE in server,read,advise,alc ..' output=$response
        put_line ' Expecting '//..
$strrep(stats(server@)(read@)(advise@)(alc@)(min@))..
//' to '//$strrep(stats(server@)(read@)(advise@)(alc@)(max@)) output=$response
        put_line ' Found '//ptu@mon_allocate_count output=$response
        compare_errors = compare_errors+1
      IFEND
    IFEND

    config = config_base // tab // 'Read Advise'
    config = config // tab // server_elapsed // tab // server_mon // tab // server_task
    config = config // tab // ptu@mon_ave_io_time // tab // ptu@mon_max_io_time
    config = config // tab // ptu@mon_io_count // tab // $strrep(ptu@mon_trace_count)
    config = config // tab // ptu@mon_ave_allocate_time // tab // ptu@mon_max_allocate_time // tab // ..
          ptu@mon_allocate_count
    put_line config output=$fname(tab_out)
    config = config_base_d // tab // 'Read Advise'
    config = config // tab // ptu#elapsed_time // tab // ptu#mon_time // tab // ptu#task_time
    put_line config output=$fname(tab_out)

  IF compare_times THEN
    IF compare_errors > 0 THEN
      put_line '  '//$strrep(compare_errors)//' compare errors encountered.' output=$response
    ELSE
      put_line '  NO compare errors.' output=$response
    IFEND
  IFEND

  chafa $fname(out_unique) ra=(11, 11, 11)
  chafa $fname(tab_out_unique) ra=(11, 11, 11)
  copf $fname(out_unique//'.$boi') $fname($string(output)//'.$eoi')
  copf $fname(tab_out_unique//'.$boi') $fname($string(tab_file)//'.$eoi')
  delete_file $fname(out_unique)
  delete_file $fname(tab_out_unique)
  FOREND loop_counter_loop

    FOREND ts_loop
   FOREND as_loop

  detach_file $fname(mmio_file) status=ignore_status

  delete_file $fname(destn)
  delete_file $user.ugenpsn
  delete_file $fname(dests)
  delete_file $user.ugenpss
  delete_file $fname(desta)
  delete_file $user.ugenpsa

PROCEND generate_ptu_summary
