PROCEDURE dum$locate_asid, locate_asid, loca (
  asid, a:integer 0 .. 0ffff(16) = $required
  exit_on_first, eof: boolean = true
  ptl: integer = 0
  output, o: file = $output
  status)


" This procedure searches the system FDE table for the specified ASID.

  "$FORMAT=OFF"
  VAR
    any_found: boolean = FALSE
    asti: integer
    current: name = $current_module
    fde: integer
    fde_table: integer = 100000000(16) + $mem($sa(gfv$fde_table_base) 8)
    gfc$fde_size: integer = $mem($sa(gfv$fde_size) 8)
    gfc$max_file_descriptor_index: integer = 0ffff(16) "maximum value of gft$file_descriptor_index"
  VAREND
  "$FORMAT=ON"

  chadm dmm$monitor_utilities

" Convert the given ASID to an ASTI which can be located in the FDE_table.

  dum$asti xasid=asid ptl=ptl xasti=asti

  FOR i = 0 TO gfc$max_file_descriptor_index DO
    fde = fde_table + (i * gfc$fde_size)
    IF $pv(?fde.gft$file_descriptor_entry.file_hash) <> 0FF(16) THEN
      IF $pv(?fde.gft$file_descriptor_entry.asti) = asti THEN
        any_found = TRUE
        put_line ' -- File entry '//$strrep(i, 16)//'(16) matches.  GFN ='//..
$pv(?fde.gft$file_descriptor_entry.global_file_name) o=output
        IF exit_on_first THEN
          chadm current
          EXIT
        IFEND
      IFEND
    IFEND

  FOREND

  IF not any_found THEN
    putl ' -- No FDE entry found for the specified ASID '  o=output
  IFEND

  chadm current

PROCEND dum$locate_asid
