PROCEDURE install_nosve_maintenance (
  status)

  VAR
    appac_deadstart_info_file: file
    command_file: file = $unique($local)
    deadstart_catalog: file
    ignore_status: status
    local_status: status
    nosve_maintenance_catalog: file
    field_maintenance_catalog: file
    rav$installation_environment: (XREF) rat$installation_environment
    rav$subproduct_information: (XREF) rat$subproduct_information
  VAREND

*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   This installer procedure is for the subproduct NOSVE_MAINTENANCE.
"
*IFEND


  install_block: ..
    BLOCK

      $system.put_line l=' Installing NOSVE_MAINTENANCE ...' o=$job_log

      qcu_maintenance_catalog   = $system.qcu_maintenance
      field_maintenance_catalog = $system.field_maintenance
      nosve_maintenance_catalog = rav$subproduct_information.actual_installation_path
      appac_deadstart_info_file = nosve_maintenance_catalog.RAF$APPAC_DEADSTART_INFO


*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   If this is a CORRECTION installation, check to see if a new deadstart
"tape is to be created. If the APPLY_ALL_CORRECTIONS deadstart information
"file is present, either a deadstart file or tape is to be generated.  This
"contains key variables with assigned values to determine the proper course
"of action.  All variable names in this file begin with RAV#APPAC.
"If this file is not present, no deadstart tape is to be generated.
"
*IFEND


   $system.put_line l=' Deleting QCU/CCU environment' o=$job_log
   $system.delete_catalog c=field_maintenance_catalog do=cac status=ignore_status
   $system.delete_catalog c=qcu_maintenance_catalog do=cac status=ignore_status

      IF rav$subproduct_information.subproduct_type = CORRECTION THEN

        IF $file(appac_deadstart_info_file permanent) THEN

          $system.include_file f=appac_deadstart_info_file status=local_status
          $system.delete_file f=appac_deadstart_info_file status=ignore_status
          EXIT install_block WHEN NOT local_status.normal

          IF rav#appac_installation_id <> rav$installation_environment.installation_identifier THEN
            EXIT install_block
          IFEND

          IF rav#appac_deadstart_medium = DISK THEN

*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   Generate a new deadstart catalog and leave it on disk.
"
*IFEND


COLLECT_TEXT command_file until='**'
            $system.osf$builtin_library.maintain_deadstart_software
              generate_ve_deadstart_catalog cfc=rav#appac_cfc_catalog
              quit
**
          ELSE " rav#appac_deadstart_medium = TAPE


*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'
"
"   Generate a new deadstart catalog and write it to a tape.  When the
"tape completes, delete the deadstart catalog.
"
*IFEND


COLLECT_TEXT command_file until='**'
            $system.osf$builtin_library.maintain_deadstart_software
              generate_ve_deadstart_catalog cfc=rav#appac_cfc_catalog ..
                     deadstart_catalog_path=deadstart_catalog
              IF NOT rav$linker_errors_found THEN
                create_ve_deadstart_tape dc=deadstart_catalog evsn=rav#appac_evsn ..
                     rvsn=rav#appac_rvsn type=rav#appac_type ..
                     unload_deadstart_tape=rav#appac_udv
              IFEND
              $system.delete_catalog c=deadstart_catalog do=catalog_and_contents
**

          IFEND

          include_file f=command_file status=local_status
          delete_file command_file status=ignore_status
          EXIT install_block WHEN NOT local_status.normal

        IFEND

      IFEND

    BLOCKEND install_block

  EXIT procedure WITH local_status WHEN NOT local_status.normal

PROCEND install_nosve_maintenance

