PROC compile_pf_maint_procs, compfmp (
  list, l           : file = $list
  alternate_catalog, ac : file = $optional
  status : var of status = $optional
  )

" The purpose of this procedure is to compile the PF maintenance procedures
" found on the source library under the SITE_OS_MAINTENANCE catalog and
" place the resulting binary onto OSF$SOU_LIBRARY which is also in
" the SITE_OS_MAINTENANCE catalog.  The presence of the library
" OSF$SOU_LIBRARY in the SITE_OS_MAINTENANCE catalog will be merged
" merged onto the released OSF$SOU_LIBRARY automatically upon the next
" execution of MAKE_VE_DEADSTART_FILE.
"
" If the OS files have been installed to an alternate catalog this should be
" specified by the ALTERNATE_CATALOG parameter.

  create_variable (local_status ignore_status) kind=status
  create_variable source_library kind=string value='$system.site_os_maintenance.source_library'
  create_variable object_library kind=string value='$system.site_os_maintenance.osf$sou_library'
  create_variable temp_file kind=(string $max_name) value=$unique


  IF $specified(alternate_catalog) THEN
    source_library = $string($value(alternate_catalog)) // '.site_os_maintenance.source_library'
    object_library = $string($value(alternate_catalog)) // '.site_os_maintenance.osf$sou_library'
  IFEND

compile_block: ..
  BLOCK
    SOURCE_CODE_UTILITY
      use_library base=$fname(source_library) result=$null
      expand_deck compile=$fname(temp_file) deck=(..
          pup$create_aged_file_backup ..
          pup$create_catalog_backup ..
          pup$create_full_backup ..
          pup$create_partial_backup ..
          pup$delete_expired_files ..
          pup$display_all_files ..
          pup$label_tape_volumes ..
          pup$restore_cataloged_files ..
          pup$restore_unreconciled_files ..
          pup$restore_unreconciled_cats) status=local_status
    QUIT
    EXIT compile_block WHEN NOT local_status.normal

    CREATE_OBJECT_LIBRARY
    ocu_block: ..
      BLOCK
        add_module library=$fname(object_library) status=ignore_status
        combine_module library=$fname(temp_file) status=local_status
        EXIT ocu_block WHEN NOT local_status.normal
        generate_library library=$fname(object_library) status=local_status
        EXIT ocu_block WHEN NOT local_status.normal
      BLOCKEND ocu_block
    QUIT
  BLOCKEND compile_block

  IF $file($fname(temp_file), assigned) THEN
    copy_file input=$fname(temp_file) output=$value(list) status=local_status
    detach_file file=$fname(temp_file) status=ignore_status
  IFEND

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND compile_pf_maint_procs
