

PROC qcm$show_errors, show_errors (
  link_map_type, lmt: key boot os ei = os
  display_options, do: key errors e full f = errors
  product_name, pn: name = os
  build_level, bl: name
  feature_catalog, fc: file or key none = none
  feature_build_level, fbl: name = object
  working_catalog, wc: file or key none = none
  working_build_level, wbl: name = object
  status)



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
  development_base : file = wev$development_base, $fname(wev$default_dev_base_family//'.INTVE')
  wev$development_base : (ENVIRONMENT) string = $string(development_base)
  server_development_base : file = wev$server_development_base, $fname($string(wev$default_file_server)//..
$trim($substr(wev$development_base, $scan_string('.', wev$development_base), $strlen(wev$development_base))))
  wev$server_development_base : (ENVIRONMENT) string = $string(server_development_base)
VAREND
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(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 scope=xdcl ..
    value=$string($value(working_catalog))
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(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

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


  create_variable (local_status, display_status, ignore_status) kind=status
  create_variable partial_errors kind=(string $max_name) value=$unique
  create_variable complete_errors kind=(string $max_name) value=$unique
  create_variable link_map_path kind=string


disle_proc: ..
  BLOCK

    IF $string($value(link_map_type)) = 'OS' THEN
      create_variable number_of_link_maps value=2
      create_variable link_map_name kind=string dimension=1..number_of_link_maps
      link_map_name(1) = 'SYSTEM_CORE_LINK_MAP'
      link_map_name(2) = 'JOB_TEMPLATE_LINK_MAP'
    ELSEIF $string($value(link_map_type)) = 'BOOT' THEN
      create_variable number_of_link_maps value=1
      create_variable link_map_name kind=string dimension=1..number_of_link_maps
      link_map_name(1) = 'BOOT_LINK_MAP'
    ELSE
      create_variable number_of_link_maps value=1
      create_variable link_map_name kind=string dimension=1..number_of_link_maps
      link_map_name(1) = 'C170_EI_LINK_MAP'
    IFEND

    search_catalog_limit = wev$server_development_base // '.' // wev$product_name // '.' // wev$build_level

    FOR i = 1 TO number_of_link_maps DO

    locate_map: ..
      BLOCK
      limit_search: ..
        BLOCK

          IF wev$working_catalog <> 'NONE' THEN
            catalog = wev$working_catalog // '.' // wev$working_build_level
            include_line 'display_catalog '//catalog//' do=p o=$null' status=display_status
            IF display_status.normal THEN
              link_map_path = catalog // '.' // link_map_name(i)
              EXIT locate_map WHEN ..
                    ($file($fname(link_map_path), assigned) AND $file($fname(link_map_path), size) > 0)
              EXIT limit_search WHEN $path($fname(link_map_path), catalog) = search_catalog_limit
              detach_file file=$fname(link_map_path) status=ignore_status
            IFEND
          IFEND

          IF wev$feature_catalog <> 'NONE' THEN
            catalog = wev$feature_catalog // '.' // wev$feature_build_level
            include_line 'display_catalog '//catalog//' o=$null' status=display_status
            IF display_status.normal THEN
              link_map_path = catalog // '.' // link_map_name(i)
              EXIT locate_map WHEN ..
                    ($file($fname(link_map_path), assigned) AND $file($fname(link_map_path), size) > 0)
              EXIT limit_search WHEN $path($fname(link_map_path), catalog) = search_catalog_limit
              detach_file file=$fname(link_map_path) status=ignore_status
            IFEND
          IFEND

          catalog = wev$server_development_base // '.' // wev$product_name // '.' // wev$build_level
          include_line 'display_catalog '//catalog//' o=$null' status=display_status
          EXIT limit_search WHEN NOT local_status.normal
          link_map_path = catalog // '.' // link_map_name(i)
          EXIT locate_map WHEN ..
                ($file($fname(link_map_path), assigned) AND $file($fname(link_map_path), size) > 0)

          detach_file file=$fname(link_map_path) status=ignore_status
        BLOCKEND limit_search
        put_line ' Link map '//link_map_name(i)//' not found -- DISPLAY_LINKER_ERRORS exiting.' o=output ..
              status=ignore_status
        EXIT disle_proc
      BLOCKEND locate_map


      search_link_map link_map=$fname(link_map_path) output=$fname(partial_errors) status=local_status
      EXIT disle_proc WHEN NOT local_status.normal

      IF $file($fname(partial_errors), size) <> 0 THEN
        put_line lines=' Linker errors found in '//link_map_path output=$fname(complete_errors//'.$eoi')
        copy_file input=$fname(partial_errors) output=$fname(complete_errors//'.$eoi')
        detach_file file=$fname(partial_errors) status=ignore_status
      IFEND

      search_catalog_limit = $path($fname(link_map_path), catalog)
    FOREND


    IF $file($fname(complete_errors), size) <> 0 THEN
      put_line ' WARNING-  Errors found while searching link maps.' o=$output status=ignore_status
      copy_file input=$fname(complete_errors) output=$errors
      detach_file file=$local.linker_errors status=ignore_status
      copy_file input=$fname(complete_errors) output=$local.linker_errors
      detach_file file=$fname(complete_errors) status=ignore_status
      put_line ' See file $local.linker_errors for a listing of the errors.' o=$output status=ignore_status
      local_status = $status(false, 'WE', wee$linker_errors)


    ELSEIF ..
          (($string($value(do)) = 'ERRORS') OR ($string($value(do)) = 'E') AND wev$working_catalog <> 'NONE')..
           THEN
      put_line '       No Errors.' o=$output status=ignore_status
      FOR i = 1 TO number_of_link_maps DO
        delete_file file=$fname(wev$working_catalog//'.'//wev$working_build_level//'.'//link_map_name(i)) ..
              status=ignore_status
      FOREND
    IFEND
  BLOCKEND disle_proc

  detach_file file=$fname(partial_errors) status=ignore_status
  detach_file file=$fname(complete_errors) status=ignore_status
  detach_file file=$fname(link_map_path) status=ignore_status

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND qcm$show_errors
