PROCEDURE rap$copy_processor_job_files (
  processor, p: any of
      key
        all
      keyend
      list of key
        (mag_tape,mt), (mag_tape_rms,mtr), (cartridge_tape,ct), (cartridge_tape_rms,ctr),
        (pseudo_tape,pt), (cartridge_storage_system,css), (clustered_mainframes,cm),
        (archive_to_nos,atn)
      keyend
    anyend = $required
  status)

" This procedure copies the proper archive/VE processor jobs to the
" catalog $SYSTEM.ARCHIVE_VE.PROCESSOR_JOBS.  The user may specify
" multiple processors.
"
" This procedure will exit when any error occurs rather than continue
" because if the input files are not present, there is some other problem
" that must be addressed (i.e. the files did not install properly).  This
" approach was taken because re-running this procedure will not cause
" any problems because we do a straight copy of the files and do not deal with
" cycles.

WHEN any_fault DO
  display_value osv$status o=$response
  EXIT_PROC
WHENEND


  "$FORMAT=OFF"
  VAR
    cartridge_storage_sys_catalog : file = $system.archive_ve.cartridge_storage_system
    clustered_mainframes_catalog : file = $system.archive_ve.clustered_mainframes
    ignore_status : status
    magnetic_tape_catalog : file = $system.archive_ve.magnetic_tape
    nos_7990_catalog : file = $system.archive_ve.nos_7990
    processor_jobs_catalog : file = $system.archive_ve.processor_jobs
    processor_list        : list 1..8 of name

  VAREND
  "$FORMAT=ON"

  IF $generic_type(processor) = key THEN
  " Assume the entry was ALL.
    processor_list = (mag_tape, mag_tape_rms, cartridge_tape, cartridge_tape_rms, ..
          pseudo_tape, cartridge_storage_system, clustered_mainframes, archive_to_nos)
  ELSE
    processor_list = $apply(processor $name(x))
  IFEND

  create_catalog c=processor_jobs_catalog status=ignore_status

  IF $subset(mag_tape, processor_list) THEN

" Copy files necessary to run archive/VE with magnetic tape.

    copy_file i=magnetic_tape_catalog.arf$magnetic_tape ..
          o=processor_jobs_catalog.arf$magnetic_tape
  IFEND

  IF $subset(mag_tape_rms, processor_list) THEN

" Copy files necessary to run archive/VE with magnetic tape with RMS.

    copy_file i=magnetic_tape_catalog.arf$rms_magnetic_tape ..
          o=processor_jobs_catalog.arf$rms_magnetic_tape
  IFEND

  IF $subset(cartridge_tape, processor_list) THEN

" Copy files necessary to run archive/VE with cartridge tape.

    copy_file i=magnetic_tape_catalog.arf$cartridge_tape ..
          o=processor_jobs_catalog.arf$cartridge_tape
  IFEND

  IF $subset(cartridge_tape_rms, processor_list) THEN

" Copy files necessary to run archive/VE with cartridge tape with RMS.

    copy_file i=magnetic_tape_catalog.arf$rms_cartridge_tape ..
          o=processor_jobs_catalog.arf$rms_cartridge_tape
  IFEND

  IF $subset(pseudo_tape, processor_list) THEN

" Copy files necessary to run archive/VE with pseudo tape.

    copy_file i=magnetic_tape_catalog.arf$pseudo_tape ..
          o=processor_jobs_catalog.arf$pseudo_tape
  IFEND

  IF $subset(cartridge_storage_system, processor_list) THEN

" Copy file necessary to run archive/VE with Cartridge Storage System.

    copy_file i=cartridge_storage_sys_catalog.arf$cartridge_storage_system ..
          o=processor_jobs_catalog.arf$cartridge_storage_system
  IFEND

  IF $subset(clustered_mainframes, processor_list) THEN

" Copy files necessary to run archive/VE with clustered mainframes.

    copy_file i=clustered_mainframes_catalog.arf$remote_processors ..
          o=processor_jobs_catalog.arf$remote_processors
  IFEND

  IF $subset(archive_to_nos, processor_list) THEN

" Copy file necessary to run archive/VE with 7990-NOS Option.

    copy_file i=nos_7990_catalog.arf$archive_to_nos ..
          o=processor_jobs_catalog.arf$archive_to_nos
  IFEND

PROCEND rap$copy_processor_job_files
