PROCEDURE (HIDDEN) pfp$restore_system_device (
  vsn_prefix, vsnp: any of
      name 1..5
      string 1..5
      integer 0..99999
    anyend = $optional
  vsn_count, vsnc: integer 1..99999 = 9
  vsn_suffix, vsns: any of
      name 1..5
      string 1..5
      integer 0..99998
    anyend = $optional
  increment_scheme, is: key
      (alphabetic, a)
      (decimal, d)
    keyend = decimal
  vsn_list, vsnl: list of any of
      string 1..6
      name 1..6
    anyend = $optional
  file_label_type, flt: key
      (labeled, labelled, l)
      (unlabeled, unlabelled, u)
    keyend = labeled
  type, t: key
      mt9$800, mt9$1600, mt9$6250, mt18$38000
    keyend = mt9$6250
  recorded_vsns, recorded_vsn, rvsn: any of
      key
        all
      keyend
      list of name 6..6
    anyend = all
  restore_options, ro: list of key
      (media_missing, mm)
      (no_data_defined, ndd)
      (volume_unavailable, vu)
    keyend = (media_missing no_data_defined)
  output, o: file = $null
  status)

  "$FORMAT=OFF
  VAR
    backup_file: file=$fname('$local.'//$unique())
    restore_status: status
    volume_list: list 1..$max_list of string 6
  VAREND

  "$FORMAT=ON"

  IF $specified(vsn_list) THEN
    delete_variable volume_list
    volume_list = $apply(vsn_list, $string(x))
  ELSE
    pup$construct_volume_list vsn_count=vsn_count vsn_prefix=vsn_prefix increment_scheme=increment_scheme ..
          vsn_suffix=vsn_suffix volume_list=volume_list
  IFEND

  request_magnetic_tape file=backup_file type=type ring=no ..
        recorded_vsn=volume_list
  set_file_attributes backup_file file_label_type=file_label_type

  IF NOT $variable(cmv$deadstart_simulation, defined) THEN
    vedisplay display_option=tape_mount
  IFEND

  TASK ring=3
    RESTORE_PERMANENT_FILES list=output
      include_volumes recorded_vsn=recorded_vsn
      set_restore_options require_matching_modification=false update_cycle_statistics=false..
            restore_archive_information=TRUE
      IF NOT $variable(cmv$deadstart_simulation, defined) THEN
        restore_excluded_file_cycles backup_file=backup_file ..
              restore_options= restore_options status=restore_status
      IFEND
    QUIT
    change_file_attributes file=output ring_attributes=(11 11 11)
  TASKEND

  IF NOT $variable(cmv$deadstart_simulation, defined) THEN
    vedisplay display_option=null
  IFEND

  delete_file backup_file

  EXIT_PROC WITH restore_status

PROCEND pfp$restore_system_device
