PROC load_base_3_files, load_base_3_file, loab3f (
  tape_file, tf  : file = $local.tape
  files, file, f : list of key srb, s, uib, u cip_support_library, csl, all, a ..
                 = $required
  status         : var of status = $optional
  )


*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

" This is one of several procedures created to simplify the installation process.
" These procedures are kept in the OSF$SITE_COMMAND_LIBRARY and therefore will
" receive minimal support.
"
" The purpose of this procedure is to load the specified files off of the BASE_3
" release tape.  The files are loaded to $NEXT of their actual destination as
" when installed by UPGRADE_SOFTWARE (rings, file permits and storage class may
" not be set correctly).
*IFEND


  create_variable file_destination k=string d=4
  create_variable file_name k=(string $max_name) d=4
  create_variable file_selected k=boolean d=4 v=false
  create_variable ignore_status k=status
  create_variable load_selected_files k=string v=$unique
  create_variable local_tape_file k=string v=$unique
  create_variable local_status k=status
  create_variable restore_status k=status
  create_variable tape_file k=string v=$string($value(tape_file))
  create_variable tape_vsn k=(string 6) v='NVE005'


  FOR i = 1 TO $set_count(files) DO
    files = $string($value(files, i))
    IF (files = 'SRB') OR (files = 'S') OR (files = 'ALL') OR (files = 'A') THEN
      create_catalog $user.documentation status=ignore_status

      file_name(1) = 'SOFTWARE_RELEASE_BULLETIN'
      file_destination(1) = '$USER.DOCUMENTATION.SOFTWARE_RELEASE_BULLETIN.$NEXT'
      file_selected(1) = true
    IFEND
    IF (files = 'UIB') OR (files = 'U') OR (files = 'ALL') OR (files = 'A') THEN
      create_catalog $user.documentation status=ignore_status

      file_name(2) = 'USER_IMPACT_BULLETIN'
      file_destination(2) = '$USER.DOCUMENTATION.USER_IMPACT_BULLETIN.$NEXT'
      file_selected(2) = true

      file_name(3) = 'CREATE_UIB_ONLINE_MANUAL'
      file_destination(3) = '$USER.DOCUMENTATION.CREATE_UIB_ONLINE_MANUAL.$NEXT'
      file_selected(3) = true
    IFEND
    IF (files = 'CIP_SUPPORT_LIBRARY') OR (files = 'CSL') OR (files = 'ALL') OR (files = 'A') THEN

      file_name(4) = 'RAF$CIP_SUPPORT_LIBRARY'
      file_destination(4) = '$USER.RAF$CIP_SUPPORT_LIBRARY.$NEXT'
      file_selected(4) = true
    IFEND
  FOREND


load_files: ..
  BLOCK

    IF NOT $file($fname(tape_file), assigned) THEN
      put_line '   Mount the BASE_3 tape with VSN NVE005.' o=$response
      request_magnetic_tape f=$fname(tape_file) evsn=tape_vsn r=no status=local_status
      EXIT load_files WHEN NOT local_status.normal
    IFEND

COLLECT_TEXT $fname(load_selected_files//'.$boi') until='END_COLLECT'
  $system.osf$builtin_library.restore_permanent_files l=$job_log
  FOR i = 1 TO $variable(file_selected, upper_bound) DO
    IF file_selected(i) THEN
      put_line ('   Loading '//file_name(i)//' to:', ..
            '      '//$string($fname(file_destination(i)))) o=$response
      restore_file f=$fname($backup_file($fname(tape_file), identifier)//'.'//file_name(i)//'.1') ..
            bf=$fname(tape_file) nfn=$fname(file_destination(i)) status=restore_status
      EXIT WHEN NOT restore_status.normal AND ..
            ($condition(restore_status.condition) <> 'PUE$ERROR_SUMMARY_STATUS')
    IFEND
  FOREND
  quit
END_COLLECT

    include_file $fname(load_selected_files) status=local_status
    detach_file $fname(tape_file) status=ignore_status
    IF local_status.normal AND NOT restore_status.normal AND ..
          ($condition(restore_status.condition) <> 'PUE$ERROR_SUMMARY_STATUS') THEN
      local_status = restore_status
    IFEND

  BLOCKEND load_files

  delete_file $fname(load_selected_files) status=ignore_status

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND load_base_3_files
