

PROCEDURE qcp$copy_configuration (
  configuration_files_catalog, cfc: file = $required
  deadstart_catalog, dc: file = $required
  status)

"
"   This procedure copies the files DCFILE, PROLOG_LIBRARY, and
"PHYSICAL_CONFIG from the configuration files catalog to their
"appropriate places in the deadstart catalog.  These files will
"only be copied if they exist.
"
putl ' '
putl '       Checking for presence of site configuration files.'

  VAR
    name_builtin_library: name = builtin_library
    name_osf$builtin_library: name = osf$builtin_library
    name_sou_library: name = sou_library
    name_osf$sou_library: name = osf$sou_library
    name_dcfile: name = dcfile
    name_deadstart_catalog: name = deadstart_catalog
    name_deadstart_commands_catalog: name = deadstart_commands
    name_jt_link_map: name = job_template_link_map
    name_link_input_catalog: name = link_input_files
    name_link_output_catalog: name = link_output_files
    name_mf_config_catalog: name = mf_config_files
    name_mf_config_files: name = mf_config_files
    name_non_boot_drivers_catalog: name = non_boot_drivers
    name_non_boot_drivers_file: name = non_boot_drivers
    name_nosve_maintenance_catalog: name = nosve_maintenance
    name_os_version_file: name = os_version
    name_physical_config: name = physical_config
    name_physical_configuration: name = physical_configuration
    name_product_files_catalog: name = product_files
    name_prolog_file: name = prolog_file
    name_prolog_library: name = prolog_library
    name_sc_link_map: name = system_core_link_map
    name_site_maintenance_catalog: name = site_os_maintenance
    name_system_debug_table: name = system_debug_table
  VAREND


  VAR
    command_file: file = $unique($local)
    ignore_status: status
    lcu_mainframe_subcommands: file = $unique($local)
    lcu_status: status
    local_status: status
    message: string

    new_dcfile: file
    new_lcu_mainframe_subcommands: file
    new_physical_config: file
    new_prolog_library: file

    old_prolog_file: file

    site_dcfile: file
    site_physical_config: file
    site_physical_configuration: file
    site_prolog_library: file
  VAREND

  site_dcfile = configuration_files_catalog//name_dcfile
  site_physical_config = configuration_files_catalog//name_physical_config
  site_physical_configuration = configuration_files_catalog//name_physical_configuration
  site_prolog_library = configuration_files_catalog//name_prolog_library

  new_dcfile = deadstart_catalog//name_dcfile
  new_lcu_mainframe_subcommands = deadstart_catalog//name_mf_config_files.LCU_MF_SUBCMDS
  new_physical_config = deadstart_catalog//name_mf_config_files//name_physical_config
  new_prolog_library = deadstart_catalog//name_mf_config_files//name_prolog_library

  old_prolog_file = configuration_files_catalog//name_prolog_file

copy_block: ..
  BLOCK

    IF $file(site_dcfile, permanent) THEN
      $system.copy_file site_dcfile new_dcfile status=local_status
      EXIT copy_block WHEN NOT local_status.normal
    IFEND

    IF ($file(site_physical_config, permanent)) OR ($file(site_physical_configuration, permanent)) THEN
      IF $file(site_physical_config, permanent) THEN
        $system.copy_file site_physical_config new_physical_config status=local_status
      ELSE
        $system.copy_file site_physical_configuration new_physical_config status=local_status
      IFEND
      EXIT copy_block WHEN NOT local_status.normal
    IFEND



    IF $file(site_prolog_library, permanent) THEN
      $system.copy_file site_prolog_library new_prolog_library status=local_status
      EXIT copy_block WHEN NOT local_status.normal


COLLECT_TEXT command_file until='**'
        $system.create_object_library
          add_module l=site_prolog_library
          generate_library l=lcu_mainframe_subcommands f=sp
          quit
        $system.delete_file f=$local.lcu_mainframe_subcommands status=ignore_status
        $system.delete_file f=$local.pcu_subcommands status=ignore_status
        $system.delete_file f=$local.lcu_network_subcommands status=ignore_status

        $system.include_command $strrep(lcu_mainframe_subcommands)

        $system.copy_file $local.lcu_mainframe_subcommands new_lcu_mainframe_subcommands
        $system.delete_file f=$local.lcu_mainframe_subcommands status=ignore_status
        $system.delete_file f=$local.pcu_subcommands status=ignore_status
        $system.delete_file f=$local.lcu_network_subcommands status=ignore_status
        $system.delete_file f=lcu_mainframe_subcommands status=ignore_status
**
      $system.include_file f=command_file status=lcu_status
      $system.delete_file f=command_file status=ignore_status
      IF NOT lcu_status.normal THEN
        put_line l= ' ' o=$response
        put_line l= '                          NOTICE' o=$response
        put_line l= '    Error while processing LCU_Mainframe_Subcommands file' o=$response
        put_line l='                    Skipping this file' o=$response
      IFEND
    IFEND

  BLOCKEND copy_block

  EXIT procedure WITH local_status WHEN NOT local_status.normal


PROCEND qcp$copy_configuration

