PROCEDURE (HIDDEN) start_hpa_monitor_job (
  status)


*IF $variable(wev$proc_doc,declared)<>'UNKNOWN'

" PURPOSE:
"   This procedure starts the HPA monitor job.
"
" NOTES:
"   When this procedure is called by the ACTIVATE_JOB_ENVIRONMENT command an event message is
"   used to help isolate where an error originated from.  The variable RAV$EVENT_MESSAGE is set for
"   starting the job and will be displayed along with the error should one occur.  The event
"   message is cleared if the procedure finishes without an error.
*IFEND

*copy rav$system_paths

  IF $variable(rav$event_message, nonlocal) THEN
    "$FORMAT=OFF
    VAR
      rav$event_message: (XREF) status
    VAREND
    "$FORMAT=ON"
    rav$event_message=$status(false, 'RA', rae$starting_error, 'the HPA monitor job')
  IFEND
  "$FORMAT=OFF
  VAR
    local_status: status
    permanent: boolean = false
    hpa_monitor_job_file: file = rav$system.hardware_maintenance.hpa.hpf$start_monitor_job
  VAREND
  "$FORMAT=ON"

  $system.include_line 'permanent = $file(hpa_monitor_job_file, permanent)' status=local_status

  IF local_status.normal AND permanent THEN
    $system.include_file hpa_monitor_job_file status=local_status
  ELSE
    local_status=$status(false, 'PF', pfe$unknown_permanent_file, $string(hpa_monitor_job_file))
  IFEND

  IF (local_status.normal) AND ($variable(rav$event_message, local)) THEN
    rav$event_message.normal=true
  IFEND

  EXIT procedure WITH local_status WHEN NOT local_status.normal

PROCEND start_hpa_monitor_job


