PROCEDURE qcp$withdraw_system (
  status)

  VAR
    ignore: status
    local_status: status
    deadstart_catalog: string
    aux_catalog: string
    version_file: string
    qcu_file: string
    work: string = ''
  VAREND



  IF NOT $job(system) THEN
    putl ' '
    putl '                    STOP  '
    putl '    The command WITHDRAW_SYSTEM must be initiated'
    putl '    from a system job.'
    putl ' '
    EXIT_PROC
  IFEND

    deadstart_catalog = ':$SYSTEM.$SYSTEM.NOSVE_MAINTENANCE.deadstart_catalog'
    version_file = ':$SYSTEM.$SYSTEM.NOSVE_MAINTENANCE.LINK_INPUT_FILES.OS_VERSION'
    qcu_file = ':$SYSTEM.$SYSTEM.QCU_MAINTENANCE.IDENTIFICATION'
    aux_catalog = ':$SYSTEM.$SYSTEM.SITE_OS_MAINTENANCE.DEADSTART_COMMANDS'

  "  Create the global variables.
    delv csv$estqcu_ident status=ignore
    delv csv$estqcu_catalog_specified status=ignore
    delv csv$estqcu_existing_catalog status=ignore

    IF $file($fname(version_file),permanent) THEN
    $system.include_file $fname(version_file)
    ident = $string(level_id)
    ELSE
    ident = ''
    IFEND

    IF $file($fname(qcu_file),permanent) THEN
    $system.accept_line v=work i=$fname(qcu_file)
    IFEND


    putl ' '
    putl '                   ADVISE '
    putl '     Initiating backup to system level '//ident
    putl '                      Wait'
    putl ' '

  VAR
    csv$estqcu_catalog_specified: (JOB) boolean = TRUE
    csv$estqcu_existing_catalog: (JOB) file
    csv$estqcu_ident: (JOB) string
  VAREND

    csv$estqcu_existing_catalog = deadstart_catalog
    csv$estqcu_ident = work



  "  Execute a task to install the deadstart file.

  TASK tn=install_ds_catalog_to_disk
    VAR
      command_status: status
      ignore_status: status
      local_status: status
    VAREND

 MANAGE_FIELD_CHANGES
  put_line ' '
  put_line '     Withdrawing Correction System '//csv$estqcu_ident
  put_line '                 Please'
  put_line '     Wait on the completion message. '
  put_line ' '

   incc c='withdraw_deadstart_catalog status=local_status' ..
      status=command_status
      IF NOT command_status.normal THEN
        local_status = command_status
      IFEND
  QUIT

    IF NOT local_status.normal THEN
        putl ' '
        putl '                       STOP '
        putl '     Some of the material required to reinstate the'
        putl '     base system is missing. It will be necessary to '
        putl '     reestablish the system using the ESTABLISH_DISK_'
        putl '     BASED_SYSTEM subcommand of the MAIDS utility '
        putl '     followed by a COMMIT_NEW_SYSTEM subcommand.'
        putl '     Please refer to the description of the command'
        putl '     MAINTAIN_DEADSTART_SOFTWARE, page 5-15 of the'
        putl '     NOS/VE System Performance and Maintenance, Volume'
        putl '     2, Revision H for further details.'
        putl ' '
        putl '     The detailed status is ..'
        putl ' '

      disv  local_status
       putl ' '
       putl ' MANFC/'

    ELSE
       MANAGE_FIELD_CHANGES
          COMMIT_CORRECTION_SYSTEM
          QUIT
    IFEND

    delete_variable n=csv$estqcu_catalog_specified
    delete_variable n=csv$estqcu_existing_catalog
  TASKEND



 PROCEND qcp$withdraw_system



