PROCEDURE rap$copy_configuration_files (
  configuration_files_catalog, cfc: file = $required
  deadstart_catalog, dc: file = $required
  status)

*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   This procedure copies the files DCFILE, PROLOG_LIBRARY, and
"PHYSICAL_CONFIG from teh configuration files catalog to their
"appropriate places in the deadstart catalog.  These files will
"only be copies if they exist.
"
*IFEND


*copyc rav$maids_file_catalog_names

  "$FORMAT=OFF
  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
  "$FORMAT=ON"

  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.put_line l=(' Copying file '//$string(site_dcfile)//' to '//$string(new_dcfile))..
             o=$job_log
      $system.copy_file site_dcfile new_dcfile status=local_status
      EXIT copy_block WHEN NOT local_status.normal
    ELSE
      $system.put_line l=(' '//$string(site_dcfile)//' does not exist, DCFILE not replaced.') o=$job_log
    IFEND

    IF ($file(site_physical_config, permanent)) OR ($file(site_physical_configuration, permanent)) THEN
      IF $file(site_physical_config, permanent) THEN
        $system.put_line l=(' Copying file '//$string(site_physical_config)//' to '//$string(new_physical_config))..
               o=$job_log
        $system.copy_file site_physical_config new_physical_config status=local_status
      ELSE
        $system.put_line l=(' Copying file '//$string(site_physical_configuration)//' to '//$string(new_physical_config))..
               o=$job_log
        $system.copy_file site_physical_configuration new_physical_config status=local_status
      IFEND
      EXIT copy_block WHEN NOT local_status.normal
    ELSE
      $system.put_line l=(' '//$string(site_physical_config)//' does not exist, PHYSICAL_CONFIG not replaced.')..
             o=$job_log
    IFEND

*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   At release L716 the format of the prolog file changed.  If a new format
"   prolog file does not already exist, but an old format prolog file is
"   present, pass the old format prolog file into a converter that creates
"   a new format prolog file from the old format prolog file.
*IFEND

    IF (NOT $file(site_prolog_library, permanent)) AND ($file(old_prolog_file, permanent)) THEN
      cmp$convert_config_prolog pf=old_prolog_file npl=site_prolog_library status=local_status
      IF NOT local_status.normal THEN
        $system.put_line l=(' The following error occured while converting ', ..
                              '   '//$strrep(old_prolog_file)//' to ', ..
                            '   '//$strrep(site_prolog_library), ..
                            '   '//$strrep(local_status)) o=$response
        EXIT copy_block
      IFEND
    IFEND

    IF $file(site_prolog_library, permanent) THEN
      $system.put_line l=(' Copying file '//$string(site_prolog_library)//' to '//$string(new_prolog_library))..
             o=$job_log
      $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
        $system.put_line l=(' The following error occured while creating LCU_MF_SUBCMDS - skipping this file ', ..
          $strrep(lcu_status)) o=$response
      IFEND
    ELSE
      $system.put_line l=(' '//$string(site_prolog_library)//' does not exist, PROLOG_LIBRARY not replaced.')..
             o=$job_log
    IFEND

  BLOCKEND copy_block

  EXIT procedure WITH local_status WHEN NOT local_status.normal

PROCEND rap$copy_configuration_files
