

PROC qcm$link_qcu,link_qcu, linqcu (
  link_job_template, ljt              : boolean = true
  link_system_core, lsc               : boolean = false
  bind_operating_system, bos          : boolean = false
  save_bound_libraries, sbl           : boolean = false
  delete_modules, dm                  : file = $null
  operating_system_identifier, osi    : string 1..5 = $optional
  product_set_identifier, psi         : string 1..6 = $optional
  release_identifier, ri              : string 1..5 = $optional
  psr_summary_identifier, pi          : string 1..6 = $optional
  display_options, do                 : key errors, e, full, f = errors
  accept_warning, accept_warnings, aw : boolean = false
  development_base, db                : file = .intve
  product_name, pn                    : name = os
  build_level, bl                     : name = $optional
  feature_catalog, fc                 : file or key none = none
  feature_build_level, fbl            : name = object
  working_catalog, wc                 : file = $user
  working_build_level, wbl            : name = object
  status                              : var of status = $optional
  )




IF $specified(development_base) THEN
  VAR
    wev$development_base : (ENVIRONMENT) string = $string(development_base)
    server_development_base : (ENVIRONMENT) file = development_base
    wev$server_development_base : (ENVIRONMENT) string = wev$development_base
  VAREND
ELSE
  IF NOT $variable(wev$default_file_server, defined) THEN
    VAR
      wev$default_file_server : (ENVIRONMENT) string
    VAREND
    check_default_file_server
  IFEND
  IF NOT $variable(wev$default_dev_base_family, defined) THEN
    VAR
      wev$default_dev_base_family : (ENVIRONMENT) string
    VAREND
    set_environment_defaults
  IFEND
  VAR
    dev_base_catalog : string =$trim($substr($string(development_base), ..
        $scan_string('.', $string(development_base)), $strlen($string(development_base))))
    development_base : file = wev$development_base, $fname(wev$default_dev_base_family//dev_base_catalog)
    wev$development_base : (ENVIRONMENT) string = $string(development_base)
    server_development_base : file = wev$server_development_base, $fname(wev$default_file_server//dev_base_catalog)
    wev$server_development_base : (ENVIRONMENT) string = $string(server_development_base)
  VAREND
IFEND
IF $specified(product_name) THEN
  create_variable wev$product_name kind=string scope=xdcl ..
    value=$string($value(product_name))
ELSEIF $variable(wev$product_name,declared) = 'NONLOCAL' THEN
  create_variable wev$product_name kind=string scope=xref
ELSE
  create_variable wev$product_name kind=string scope=xdcl ..
    value=$string($value(product_name))
IFEND

IF $specified(build_level) THEN
  create_variable wev$build_level kind=string scope=xdcl ..
    value=$string($value(build_level))
ELSEIF $variable(wev$build_level,declared) = 'NONLOCAL' THEN
  create_variable wev$build_level kind=string scope=xref
ELSE
  create_variable wev$build_level kind=string scope=xdcl value='NONE'
IFEND

IF $specified(feature_catalog) THEN
  create_variable wev$feature_catalog kind=string scope=xdcl ..
    value=$string($value(feature_catalog))
ELSEIF $variable(wev$feature_catalog,declared) = 'NONLOCAL' THEN
  create_variable wev$feature_catalog kind=string scope=xref
ELSE
  create_variable wev$feature_catalog kind=string scope=xdcl ..
    value=$string($value(feature_catalog))
IFEND

IF $specified(feature_build_level) THEN
  create_variable wev$feature_build_level kind=string scope=xdcl ..
    value=$string($value(feature_build_level))
ELSEIF $variable(wev$feature_build_level,declared) = 'NONLOCAL' THEN
  create_variable wev$feature_build_level kind=string scope=xref
ELSE
  create_variable wev$feature_build_level kind=string scope=xdcl ..
    value=$string($value(feature_build_level))
IFEND


IF $specified(working_catalog) THEN
  create_variable wev$working_catalog kind=string scope=xdcl value=$string($value(working_catalog))
ELSEIF $variable(wev$working_catalog, declared) = 'NONLOCAL' THEN
  create_variable wev$working_catalog kind=string scope=xref
ELSE
  create_variable wev$working_catalog kind=string value='NONE'
IFEND
IF wev$working_catalog = 'NONE' THEN
  EXIT_PROC WITH $status(false, 'WE', wee$unspecified_working_cat)
IFEND

IF ($variable(wev$ignore_status, declared) = 'LOCAL') OR ($variable(wev$local_status, declared) = 'LOCAL') ..
      THEN
  EXIT_PROC WITH $status(false, 'WE', wee$declared_status_variables)
IFEND

create_variable (wev$ignore_status, wev$local_status) k=status

attach_file $fname(wev$working_catalog//'.source_library') status=wev$local_status
detach_file $fname(wev$working_catalog//'.source_library') status=wev$ignore_status
IF (wev$local_status.normal = false) AND (..
      ($condition(wev$local_status.condition) = 'PFE$UNKNOWN_LAST_SUBCATALOG') OR ..
      ($condition(wev$local_status.condition) = 'PFE$UNKNOWN_NTH_SUBCATALOG')) THEN
  delete_variable (wev$ignore_status, wev$local_status)
  EXIT_PROC WITH $status(false, 'WE', wee$undefined_working_catalog)
IFEND

delete_variable (wev$ignore_status, wev$local_status)
IF $specified(working_build_level) THEN
  create_variable wev$working_build_level kind=string scope=xdcl ..
    value=$string($value(working_build_level))
ELSEIF $variable(wev$working_build_level,declared) = 'NONLOCAL' THEN
  create_variable wev$working_build_level kind=string scope=xref
ELSE
  create_variable wev$working_build_level kind=string scope=xdcl ..
    value=$string($value(working_build_level))
IFEND



  create_variable n=binary_file kind=string
  create_variable n=binding_directives k=string value='$local.'//$unique
  create_variable n=boot_modified kind=boolean
  create_variable n=bound_library k=string
  create_variable n=build_id kind=(string 22)
  create_variable n=catastrophic_severity k=integer v=5
  create_variable n=compressed_file kind=string
  create_variable n=compress_status kind=status
  create_variable n=cumulative_status kind=status
  create_variable n=display_linker_status kind=status
  create_variable n=error_severity k=integer v=3
  create_variable n=fatal_severity k=integer v=4
  create_variable n=files_generated k=boolean v=false
  create_variable n=first_library_index k=integer
  create_variable n=highest_severity k=integer v=0
  create_variable n=ignore_status kind=status
  create_variable n=informative_severity k=integer v=1
  create_variable n=job_virtual_memory_string kind=string
  create_variable n=jt_virtual_memory_string kind=string value='$local.virtual_memory_image'
  create_variable n=last_library_index k=integer
  create_variable n=linker_directives kind=string value='$local.'//$unique
  create_variable n=local_status kind=status
  create_variable n=map_file_string kind=string value='$local.system_core_link_map'
  create_variable n=monitor_debug_table kind=string value='$local.'//$unique
  create_variable n=monitor_symbols_string kind=string value='$local.'//$unique
  create_variable n=monitor_virtual_memory_string kind=string value='$local.'//$unique
  create_variable n=normal_severity k=integer v=0
  create_variable n=no_libraries_merged k=boolean
  create_variable n=sli k=integer value=0
  create_variable n=system_core_debug_table kind=string value='$local.system_core_debug_table'
  create_variable n=system_debug_table kind=string value='$local.system_debug_table'
  create_variable n=system_symbols_file_name kind=string value='.system_core_symbol_table'
  create_variable n=system_symbols_string kind=string value='$local'//system_symbols_file_name
  create_variable n=system_virtual_memory_string kind=string value='$local.'//$unique
  create_variable n=tying_path kind=string
  create_variable n=version_id kind=(string 22)
  create_variable n=warning_severity k=integer v=2


  create_variable ol_monitor kind=string value='$local.osf$monitor'
  create_variable ol_system_core_113 kind=string value='$local.osf$system_core_113'
  create_variable ol_system_core_133 kind=string value='$local.osf$system_core_133'
  create_variable ol_system_core_13d kind=string value='$local.osf$system_core_13d'
  create_variable ol_system_core_1dd kind=string value='$local.osf$system_core_1dd'
  create_variable ol_job_template_223 kind=string value='$local.osf$job_template_223'
  create_variable ol_job_template_236 kind=string value='$local.osf$job_template_236'
  create_variable ol_job_template_23d kind=string value='$local.osf$job_template_23d'
  create_variable ol_job_template_2dd kind=string value='$local.osf$job_template_2dd'
  create_variable ol_message_templates kind=string value='$local.osf$message_templates'


link_operating_system: ..
  BLOCK

  boot_modified = ((wev$feature_catalog <> 'NONE') AND ..
        ($file($fname(wev$feature_catalog//'.'//wev$feature_build_level//'.maintenance.osf$boot_job'), ..
        permanent) OR $file(..
        $fname(wev$feature_catalog//'.'//wev$feature_build_level//'.maintenance.osf$boot_monitor'), ..
        permanent))) OR ((wev$working_catalog <> 'NONE') AND ..
        ($file($fname(wev$working_catalog//'.'//wev$working_build_level//'.maintenance.osf$boot_job'), ..
        permanent) OR $file(..
        $fname(wev$working_catalog//'.'//wev$working_build_level//'.maintenance.osf$boot_monitor'), ..
        permanent)))

  IF boot_modified THEN
    link_boot do=$value(display_options) dm=$value(delete_modules) sbl=$value(save_bound_libraries) status=local_status
    IF NOT local_status.normal THEN
      IF $vname($severity(local_status.condition)//'_severity') > highest_severity THEN
        highest_severity = $vname($severity(local_status.condition)//'_severity')
        cumulative_status = local_status
      IFEND
      display_value v=local_status o=$job_log
    IFEND
    EXIT link_operating_system WHEN ((highest_severity > warning_severity) AND (NOT $value(accept_warnings)))
  IFEND



  create_variable system_libraries k=(string, $max_name) d=30
  system_libraries(1) = 'osf$monitor'
  system_libraries(2) = 'ol_monitor'
  system_libraries(3) = 'monitor'
  system_libraries(4) = 'osf$system_core_113'
  system_libraries(5) = 'ol_system_core_113'
  system_libraries(6) = 'system_core_113'
  system_libraries(7) = 'osf$system_core_133'
  system_libraries(8) = 'ol_system_core_133'
  system_libraries(9) = 'system_core_133'
  system_libraries(10) = 'osf$system_core_13d'
  system_libraries(11) = 'ol_system_core_13d'
  system_libraries(12) = 'system_core_13d'
  system_libraries(13) = 'osf$system_core_1dd'
  system_libraries(14) = 'ol_system_core_1dd'
  system_libraries(15) = 'system_core_1dd'
  system_libraries(16) = 'osf$job_template_223'
  system_libraries(17) = 'ol_job_template_223'
  system_libraries(18) = 'job_template_223'
  system_libraries(19) = 'osf$job_template_236'
  system_libraries(20) = 'ol_job_template_236'
  system_libraries(21) = 'job_template_236'
  system_libraries(22) = 'osf$job_template_23d'
  system_libraries(23) = 'ol_job_template_23d'
  system_libraries(24) = 'job_template_23d'
  system_libraries(25) = 'osf$job_template_2dd'
  system_libraries(26) = 'ol_job_template_2dd'
  system_libraries(27) = 'job_template_2dd'
  system_libraries(28) = 'osf$message_templates'
  system_libraries(29) = 'ol_message_templates'
  system_libraries(30) = 'NONE'


  create_variable job_template_library_index k=integer value=16

  log_statistic pn=link_operating_system s=dp000001 t=begin status=ignore_status



  build_object_library_path = wev$server_development_base // '.' // wev$product_name // '.' // wev$build_level // ..
        '.maintenance'
  build_preserved_file_path = wev$server_development_base // '.' // wev$product_name // '.' // wev$build_level
  IF wev$feature_catalog <> 'NONE' THEN
    feature_object_library_path = wev$feature_catalog // '.' // wev$feature_build_level // '.maintenance'
    feature_preserved_file_path = wev$feature_catalog // '.' // wev$feature_build_level
  ELSE
    feature_object_library_path = wev$feature_catalog
    feature_preserved_file_path = wev$feature_catalog
  IFEND

  working_object_library_path = wev$working_catalog // '.' // wev$working_build_level // '.maintenance'
  preserved_file_path = wev$working_catalog // '.' // wev$working_build_level
  display_catalog $fname(preserved_file_path) output=$null status=local_status
  IF NOT local_status.normal THEN
    create_catalog $fname(preserved_file_path) status=local_status
    IF NOT local_status.normal THEN
      put_line ' Cannot create '//preserved_file_path//' catalog due to following error:' output=$response, ..
            status=ignore_status
      display_value local_status output=$response status=ignore_status
    IFEND
  IFEND



    command_line = 'build_system_identifiers bi=build_id vi=version_id'
    command_line = command_line // ' if=' // preserved_file_path // '.version'
    IF NOT $variable(wev$use_release_id defined) THEN
      return_path file_name=tying file_type=general path=tying_path status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
      include_file $fname(tying_path) status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
    IFEND
    command_line = command_line // ' return_release_values=' // wev$use_release_id
    IF $specified(operating_system_identifier) THEN
      command_line = command_line // ' osl=''' // $value(operating_system_identifier) // ''''
    IFEND
    IF $specified(product_set_identifier) THEN
      command_line = command_line // ' psl=''' // $value(product_set_identifier) // ''''
    IFEND
    IF $specified(release_identifier) THEN
      command_line = command_line // ' rl=''' // $value(release_identifier) // ''''
    ELSE
      create_variable name=wev$nosve_version kind=string scope=xref status=local_status
      IF NOT local_status.normal AND $condition(local_status.condition) <> 'CLE$VAR_ALREADY_CREATED' THEN
        return_path file_name=tying file_type=general path=tying_path status=local_status
        EXIT link_operating_system WHEN NOT local_status.normal
        include_file $fname(tying_path) status=local_status
        EXIT link_operating_system WHEN NOT local_status.normal
      IFEND
      command_line = command_line // ' rl=''' // wev$nosve_version // ''''
    IFEND
    IF $specified(psr_summary_identifier) THEN
      command_line = command_line // ' pl=''' // $value(psr_summary_identifier) // ''''
    ELSE
      create_variable name=wev$psr_version kind=string scope=xref status=local_status
      IF NOT local_status.normal AND $condition(local_status.condition) <> 'CLE$VAR_ALREADY_CREATED' THEN
        return_path file_name=tying file_type=general path=tying_path status=local_status
        EXIT link_operating_system WHEN NOT local_status.normal
        include_file $fname(tying_path) status=local_status
        EXIT link_operating_system WHEN NOT local_status.normal
      IFEND
      command_line = command_line // ' pl=''' // wev$psr_version// ''''
    IFEND

    include_line command_line status=local_status
    EXIT link_operating_system WHEN NOT local_status.normal

     put_line ' Establish the environment' o=output

    create_variable wev$cybil_level kind=string scope=xref status=local_status
    IF NOT local_status.normal AND $condition(local_status.condition) <> 'CLE$VAR_ALREADY_CREATED' THEN
      return_path file_name=tying file_type=general path=tying_path status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
      include_file $fname(tying_path) status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
    IFEND

    create_variable wev$aam_level kind=string scope=xref status=local_status
    IF NOT local_status.normal AND $condition(local_status.condition) <> 'CLE$VAR_ALREADY_CREATED' THEN
      return_path file_name=tying file_type=general path=tying_path status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
      include_file $fname(tying_path) status=local_status
      EXIT link_operating_system WHEN NOT local_status.normal
    IFEND


    include_line 'locate_file cyf$run_time_library cyf$$$run_library sc=('//preserved_file_path//' '//..
feature_preserved_file_path//' '//wev$server_development_base//'.cybil.'//wev$cybil_level//' $SYSTEM.cybil)'

  sc_jt_processing: ..
    BLOCK

      EXIT sc_jt_processing WHEN NOT ($value(link_system_core) OR $value(link_job_template))

      first_library_index = job_template_library_index
      last_library_index = $variable(system_libraries, upper_bound)

      IF ($value(link_system_core)) THEN
        first_library_index = $variable(system_libraries, lower_bound)
        IF NOT $value(link_job_template) THEN
          last_library_index = job_template_library_index - 3
        IFEND
      IFEND

      IF $value(bind_operating_system) THEN


        get_source d=raf$binding_directives e=true s=$fname(binding_directives) status=local_status
        EXIT link_operating_system WHEN NOT local_status.normal

        include_file $fname(binding_directives) status=local_status
        detach_file $fname(binding_directives) status=ignore_status
        EXIT link_operating_system WHEN NOT local_status.normal
      IFEND


    merge_libraries: ..
      FOR sli = first_library_index TO last_library_index BY 3 DO
        combine_objects dm=$value(delete_modules) ol=$name(system_libraries(sli)) ..
              rol=$fname($vname(system_libraries(sli+1))) oml=cyf$run_time_library nlm=no_libraries_merged ..
              status=local_status
        IF NOT local_status.normal THEN
          IF $vname($severity(local_status.condition)//'_severity') > highest_severity THEN
            highest_severity = $vname($severity(local_status.condition)//'_severity')
            cumulative_status = local_status
          IFEND
          display_value v=local_status o=$job_log
        IFEND
        EXIT merge_libraries WHEN local_status.normal = false


        IF no_libraries_merged THEN
          IF $value(bind_operating_system) AND (system_libraries(sli + 2) <> 'NONE') THEN
            $vname(system_libraries(sli+1)) = build_preserved_file_path // '.bound_' // ..
                  system_libraries(sli + 2)
          ELSE
            $vname(system_libraries(sli+1)) = build_object_library_path // '.' // system_libraries(sli)
          IFEND
        ELSE

          IF ($value(bind_operating_system)) AND (system_libraries(sli + 2) <> 'NONE') THEN
            IF $value(save_bound_libraries) THEN
              bound_library = preserved_file_path // '.bound_' // system_libraries(sli + 2)
            ELSE
              bound_library = '$local.bound_' // system_libraries(sli + 2)
            IFEND

            delete_file $fname(bound_library) status=ignore_status
            PUSH file_connections
            create_file_connection sf=$errors f=$job_log status=ignore_status
            bind_os_library bd=$fname($vname('bd_'//system_libraries(sli+2))) ..
                  ul=$fname($vname(system_libraries(sli+1))) bl=$fname(bound_library) status=local_status
            POP file_connections

            IF local_status.normal THEN
              $vname(system_libraries(sli+1)) = bound_library
            ELSE
              IF $vname($severity(local_status.condition)//'_severity') > highest_severity THEN
                highest_severity = $vname($severity(local_status.condition)//'_severity')
                cumulative_status = local_status
              IFEND
              display_value v=local_status o=$job_log
            IFEND
          IFEND
        IFEND
      FOREND merge_libraries
      EXIT link_operating_system WHEN ((highest_severity > normal_severity) AND (NOT $value(accept_warnings)))
      EXIT link_operating_system WHEN highest_severity > warning_severity


    generate_linked_system: ..
      BLOCK


        IF highest_severity > normal_severity THEN
          display_value v='' o=$response
          display_value v='Ignoring warnings, begin linking...' o=$response
          display_value v='' o=$response
        IFEND

        put_line '        Link System.' output=$response
        map_file_string = preserved_file_path // '.system_core_link_map'
        system_symbols_file_name = '.system_core_symbol_table'


        system_core_debug_table = preserved_file_path // '.system_core_debug_table'
        system_debug_table = preserved_file_path // '.system_debug_table'
        monitor_virtual_memory_string = preserved_file_path // '.monitor_image'
        system_virtual_memory_string = preserved_file_path // '.system_core_image'


        get_source d=raf$linker_directives s=$fname(linker_directives) e=true status=local_status
        EXIT generate_linked_system WHEN NOT local_status.normal

        include_file $fname(linker_directives) status=local_status
        detach_file $fname(linker_directives) status=ignore_status
        EXIT generate_linked_system WHEN NOT local_status.normal

        IF $value(link_system_core) THEN
          wired_segment = 1
          pageable_segment = 2

          detach_file $fname(map_file_string) status=ignore_status
          create_file $fname(map_file_string//'.$next')
          new_cycle = $file($fname(map_file_string), cycle_number)
          IF new_cycle > 1 THEN
            delete_file_name = map_file_string // '.' // $strrep(new_cycle-1)
            delete_file $fname(delete_file_name) status=ignore_status
          IFEND

          system_symbols_string = preserved_file_path // system_symbols_file_name

          detach_file $fname(system_symbols_string) status=ignore_status
          create_file $fname(system_symbols_string//'.$next')
          new_cycle = $file($fname(system_symbols_string), cycle_number)
          IF new_cycle > 1 THEN
            delete_file_name = system_symbols_string // '.' // $strrep(new_cycle-1)
            delete_file $fname(delete_file_name) status=ignore_status
          IFEND


          put_line '        Link Monitor.' output=$response status=ignore_status

          LINK_VIRTUAL_ENVIRONMENT
            include_file $fname(monitor_linker_commands) status=local_status
          QUIT

          detach_file $fname(monitor_linker_commands) status=ignore_status
          EXIT generate_linked_system WHEN NOT local_status.normal


          put_line '       Link System Core.' output=$response status=ignore_status


          IF NOT $file($fname(monitor_debug_table), assigned) THEN
            local_status = $status(false, 'WE', wee$missing_debug_table, debug_table_kind)
            EXIT generate_linked_system
          IFEND

          LINK_VIRTUAL_ENVIRONMENT
            include_file $fname(system_core_linker_commands) status=local_status
          QUIT

          detach_file $fname(system_core_linker_commands) status=ignore_status
          detach_file $fname(system_core_debug_table) status=ignore_status
          detach_file $fname(monitor_debug_table) status=ignore_status
          detach_file $fname(build_real_memory_commands) status=ignore_status
          detach_file $fname(monitor_virtual_memory_string) status=ignore_status
          detach_file $fname(monitor_symbols_string) status=ignore_status
          detach_file $fname(system_virtual_memory_string) status=ignore_status
          detach_file $fname(map_file_string) status=ignore_status
          EXIT generate_linked_system WHEN NOT local_status.normal
        ELSE


          IF $file($fname(preserved_file_path//system_symbols_file_name), permanent) THEN
            system_symbols_string = preserved_file_path // system_symbols_file_name
            detach_file $fname(system_symbols_string//'.$high') status=ignore_status
            attach_file $fname(system_symbols_string//'.$high') wait=true status=local_status
            EXIT generate_linked_system WHEN NOT local_status.normal
          ELSEIF (wev$feature_catalog <> 'NONE') AND ..
                ($file($fname(feature_preserved_file_path//system_symbols_file_name), permanent)) THEN
            system_symbols_string = feature_preserved_file_path // system_symbols_file_name
            detach_file $fname(system_symbols_string//'.$high') status=ignore_status
            attach_file $fname(system_symbols_string//'.$high') wait=true status=local_status
            EXIT generate_linked_system WHEN NOT local_status.normal
          ELSEIF $file($fname(build_preserved_file_path//system_symbols_file_name), permanent) THEN
            system_symbols_string = build_preserved_file_path // system_symbols_file_name
            detach_file $fname(system_symbols_string//'.$high') status=ignore_status
            attach_file $fname(system_symbols_string//'.$high') wait=true status=local_status
            EXIT generate_linked_system WHEN NOT local_status.normal
          ELSE
            put_line ' ERROR - '//system_symbols_file_name//' does not exist in:' o=$output ..
                  status=ignore_status
            put_line '     working catalog = '//preserved_file_path o=$output status=ignore_status
            put_line '     feature catalog = '//feature_preserved_file_path o=$output status=ignore_status
            put_line '     build catalog = '//build_preserved_file_path o=$output status=ignore_status
            EXIT generate_linked_system
          IFEND
        IFEND

        IF $value(link_job_template) = true THEN
          jt_virtual_memory_string = preserved_file_path // '.job_image'
          map_file_string = preserved_file_path // '.job_template_link_map'

          detach_file $fname(map_file_string) status=ignore_status
          create_file $fname(map_file_string//'.$next')
          new_cycle = $file($fname(map_file_string), cycle_number)
          IF new_cycle > 1 THEN
            delete_file_name = map_file_string // '.' // $strrep(new_cycle-1)
            delete_file $fname(delete_file_name) status=ignore_status
          IFEND

          detach_file $fname(jt_virtual_memory_string) status=ignore_status
          create_file $fname(jt_virtual_memory_string//'.$next')
          new_cycle = $file($fname(jt_virtual_memory_string), cycle_number)
          IF new_cycle > 1 THEN
            delete_file_name = jt_virtual_memory_string // '.' // $strrep(new_cycle-1)
            delete_file $fname(delete_file_name) status=ignore_status
          IFEND


          put_line '       Link Job Template.' output=$response status=ignore_status

          IF NOT $file($fname(system_core_debug_table), assigned) THEN
            IF wev$feature_catalog <> 'NONE' THEN
              IF $file($fname(feature_preserved_file_path//'.system_core_debug_table'), assigned) THEN
                system_core_debug_table = feature_preserved_file_path // '.system_core_debug_table'
              ELSE
                system_core_debug_table = build_preserved_file_path // '.system_core_debug_table'
              IFEND
            ELSE
              system_core_debug_table = build_preserved_file_path // '.system_core_debug_table'
            IFEND
          IFEND

          IF $file($fname(system_core_debug_table), assigned) THEN
           put_line ' '    o=$response status=ignore_status
          ELSE
            local_status = $status(false, 'WE', wee$missing_core_debug_table)
            EXIT generate_linked_system
          IFEND

          LINK_VIRTUAL_ENVIRONMENT
            include_file $fname(job_template_linker_commands) status=local_status
          QUIT

          detach_file $fname(job_template_linker_commands) status=ignore_status
          detach_file $fname(jt_virtual_memory_string) status=ignore_status
          detach_file $fname(map_file_string) status=ignore_status
          detach_file ($fname(system_symbols_string)) status=ignore_status
          detach_file $fname(monitor_debug_table) status=ignore_status
          detach_file $fname(system_debug_table) status=ignore_status
          EXIT generate_linked_system WHEN NOT local_status.normal
        IFEND




        files_generated = true

        IF $value(link_system_core) OR $value(link_job_template) THEN
          show_errors do=$value(display_options) status=display_linker_status
          IF NOT display_linker_status.normal THEN
            EXIT generate_linked_system
          IFEND
        IFEND
      BLOCKEND generate_linked_system
      EXIT link_operating_system WHEN NOT local_status.normal
    BLOCKEND sc_jt_processing


    IF wev$feature_catalog = 'NONE' THEN
      include_line 'locate_file unbound_fortran_interface aam$$$unbound_fortran_interface            sc=('..
//preserved_file_path//'.maintenance '//wev$server_development_base//'.aam.'//wev$aam_level//'.maintenance)'
    ELSE " Feature catalog exists "
      include_line 'locate_file unbound_fortran_interface aam$$$unbound_fortran_interface            sc=('..
//preserved_file_path//'.maintenance '//feature_preserved_file_path//'.maintenance '//wev$server_development_base//..
'.aam.'//wev$aam_level//'.maintenance)'
    IFEND

    build_deadstart_library pfp=$fname(preserved_file_path), crtl=$local.cyf$$$run_library ..
          dm=$value(delete_modules) status=local_status
    EXIT link_operating_system WHEN NOT local_status.normal


    build_builtin_library pfp=$fname(preserved_file_path), crtl=$local.cyf$$$run_library ..
          aamuc=$local.aam$$$unbound_fortran_interface dm=$value(delete_modules) status=local_status

    EXIT link_operating_system WHEN NOT local_status.normal


    build_task_lib pfp=$fname(preserved_file_path), crtl=$local.cyf$$$run_library ..
          dm=$value(delete_modules) status=local_status

    EXIT link_operating_system WHEN NOT local_status.normal

    put_line ' ' output=$response

  BLOCKEND link_operating_system


  detach_file $local.cyf$$$run_library status=ignore_status
  detach_file $local.aam$$$unbound_fortran_interface status=ignore_status
  detach_file $fname(linker_directives) status=ignore_status
  detach_file $fname(system_core_debug_table) status=ignore_status
  detach_file $fname(monitor_debug_table) status=ignore_status
  detach_file $fname(monitor_virtual_memory_string) status=ignore_status
  detach_file $fname(monitor_symbols_string) status=ignore_status
  detach_file $fname(system_virtual_memory_string) status=ignore_status
  detach_file $fname(map_file_string) status=ignore_status
  detach_file $fname(jt_virtual_memory_string) status=ignore_status
  detach_file $fname(system_symbols_string) status=ignore_status
  detach_file $fname(system_debug_table) status=ignore_status

  IF $variable(monitor_linker_commands, declared) = 'LOCAL' THEN
    detach_file $fname(monitor_linker_commands) status=ignore_status
    detach_file $fname(system_core_linker_commands) status=ignore_status
    detach_file $fname(build_real_memory_commands) status=ignore_status
    detach_file $fname(job_template_linker_commands) status=ignore_status
  IFEND

  IF $variable(system_libraries, defined) THEN
    FOR sli = $variable(system_libraries, lower_bound) TO $variable(system_libraries, upper_bound) BY 3 DO
      detach_file $fname($vname(system_libraries(sli+1))) status=ignore_status
      IF $variable($name('bd_'//system_libraries(sli+2)), declared) = 'LOCAL' THEN
        detach_file $fname($vname('bd_'//system_libraries(sli+2))) status=ignore_status
      IFEND
    FOREND
  IFEND

  IF NOT display_linker_status.normal THEN
    IF NOT local_status.normal THEN
      display_value value=local_status output=$response
      local_status = display_linker_status
    ELSE
      local_status = display_linker_status
    IFEND
  IFEND

  IF ((highest_severity > normal_severity) AND (NOT local_status.normal) AND ..
        ($condition(local_status.condition) <> $condition(cumulative_status.condition))) THEN
    display_value v=local_status o=$response
  IFEND
  IF highest_severity > normal_severity THEN
    IF ((highest_severity <= warning_severity) AND ($value(accept_warnings)) AND (files_generated)) THEN
      local_status = $status(false, 'WE', wee$warning_linos_files_made, $severity(cumulative_status.condition))
    ELSEIF ((highest_severity <= warning_severity) AND ($value(accept_warnings)) AND NOT files_generated) THEN
      local_status = $status(false, 'WE', wee$error_linos_no_files, $severity(cumulative_status.condition))
    ELSEIF ((highest_severity <= warning_severity) AND (NOT $value(accept_warnings)) AND NOT files_generated) THEN
      local_status = $status(false, 'WE', wee$error_linos_no_files, $severity(cumulative_status.condition))
    ELSEIF ((highest_severity <= warning_severity) AND (NOT $value(accept_warnings)) AND files_generated) THEN
      local_status = $status(false, 'WE', wee$warning_linos_files_made, $severity(cumulative_status.condition))
    ELSEIF highest_severity >= error_severity THEN
      local_status = $status(false, 'WE', wee$error_linos_no_files, $severity(cumulative_status.condition))
    IFEND
  IFEND

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND qcm$link_qcu
