PROCEDURE install_site_controlled, inssc (
  cdcnet_catalog, cc: file = $required
  version_catalog, vc: file = $required
  status)

  "Install files to $SYSTEM.CDCNET.SITE_CONTROLLED catalog.

  "$FORMAT=OFF
  VAR
    ignore_status: status
    local_status: status
    loop: integer

    name_network_management: name = NETWORK_MANAGEMENT
    name_procedures: name = PROCEDURES
    name_site_controlled: name = SITE_CONTROLLED

    rav$subproduct_information: (XREF) rat$subproduct_information
    rav$installation_defaults: (XREF) rat$installation_defaults
    rav$installation_environment: (XREF) rat$installation_environment

    site_controlled_names: array 1..2 of name = (..
      configuration ..
      exception_list ..
      )
    procedure_names: array 1..3 of name = (..
      device_load ..
      terminal ..
      user ..
      )

  VAREND
  "$FORMAT=ON"

  install_block: ..
    BLOCK

  $system.put_line l=' Installing CDCNET Site Controlled files ...' o=$job_log

" create required catalogs

  $system.create_catalog cdcnet_catalog//name_site_controlled status=ignore_status
  $system.create_catalog cdcnet_catalog//name_site_controlled//name_network_management ..
    status=ignore_status
  $system.create_catalog cdcnet_catalog//name_site_controlled//name_procedures status=ignore_status

" Install the files"

  FOR loop = 1 to $upper_bound(site_controlled_names) DO
    IF NOT $file(cdcnet_catalog//name_site_controlled//site_controlled_names(loop), permanent) THEN
      install_file ..
        f=version_catalog//name_site_controlled//site_controlled_names(loop) ..
        t=cdcnet_catalog//name_site_controlled//site_controlled_names(loop) ..
        ra=(11 11 11) status=local_status
      EXIT install_block WHEN NOT local_status.normal
      delete_file_permit f=cdcnet_catalog//name_site_controlled//site_controlled_names(loop) ..
        g=public status=ignore_status
    IFEND
  FOREND



*IF $variable(rav$prod_doc,declared)<>'UNKNOWN'
"
"  The following code processes the file PROCESS_LOG_JOB.  In previous releases,
"  this file was in the VERSION_INDEPENDENT subcatalog of CDCNET.  It is now installed in
"  the SITE_CONTROLLED subcatalog.
"
"  To provide compatability with previous systems, this file is processed separately here.
"  The following logic applies to the code below to determine if the process log job file
"  should be installed.
"
"     1.  If the file currently exists in the version independent catalog, it is there as
"         a result of a previous release.  Leave it there, and do not install a new copy
"         into the site controlled catalog.
"
"     2.  If the file already exists in the site controlled catalog, do not install over
"         top of it.  The assumption is made that files in the site controlled catalog
"         are site modififable, and should not be overwritten by new release copies.
"
"     3.  If the above two tests indicate that the file currently does not exist in
"         version independent or site controlled, the file will be installed based on
"         the following logic:
"
"         a.  If the subproduct being installed (which called this installer procedure)
"             is not the cdcnet open shop subproduct, install the file.  This is the
"             customer's case.
"
"         b.  If the subproduct being installed is the cdcnet open shop product, this
"             is an internal installation.  It is not desired to use this file and
"             its related processes in open shop testing. Therefore, if the file
"             is found in the version catalog (ie. it was included on the open shop
"             product tape, voiding the statement about it not being desired to be
"             installed), install the file.  This case assumes that the file should
"             be installed.  If the file is not found in the version catalog, it
"             will not be installed.
"
"  The result of the above logic is that, in general, the process log job file and
"  its related processes are not normally required in cdcnet open shop testing;
"  therefore it is not installed, unless the file is present on the open shop
"  product tape.  If the file is already installed anyway, do not re-install it
"  because this is a site modifiable file.  If the file exists in the version
"  independent catalog (where is used to in previous releases), do not install
"  to site controlled, rather, let it remain in version independent.
"
*IFEND

  IF NOT $file(cdcnet_catalog.VERSION_INDEPENDENT.PROCESS_LOG_JOB, permanent) THEN
    IF NOT $file(cdcnet_catalog//name_site_controlled.PROCESS_LOG_JOB, permanent) THEN
      IF (rav$subproduct_information.subproduct_name <> CDCNET_OPEN_SHOP) OR ..
         ((rav$subproduct_information.subproduct_name = CDCNET_OPEN_SHOP) AND ..
           ($file(version_catalog//name_site_controlled.PROCESS_LOG_JOB, permanent))) THEN
        install_file ..
          f=version_catalog//name_site_controlled.PROCESS_LOG_JOB ..
          t=cdcnet_catalog//name_site_controlled.PROCESS_LOG_JOB ..
          ra=(11 11 11) status=local_status
        EXIT install_block WHEN NOT local_status.normal
        delete_file_permit f=cdcnet_catalog//name_site_controlled.PROCESS_LOG_JOB ..
          g=public status=ignore_status
      IFEND
    IFEND
  IFEND

  FOR loop = 1 to $upper_bound(procedure_names) DO
    IF NOT $file(cdcnet_catalog//name_site_controlled//name_procedures//procedure_names(loop), permanent) THEN
      install_file ..
        f=version_catalog//name_site_controlled//name_procedures//procedure_names(loop) ..
        t=cdcnet_catalog//name_site_controlled//name_procedures//procedure_names(loop) ..
        ra=(11 11 11) status=local_status
      EXIT install_block WHEN NOT local_status.normal
      delete_file_permit f=cdcnet_catalog//name_procedures//procedure_names(loop) ..
        g=public status=ignore_status
    IFEND
  FOREND


  BLOCKEND install_block

  EXIT procedure WITH local_status WHEN NOT local_status.normal

PROCEND install_site_controlled
