PROCEDURE dum$display_allocation_log, display_allocation_log, disal (
  first, f: integer 0..3125 = 0
  last, l: integer 0..3125 = 0
  output, o: file = $output
  )

  "$FORMAT=OFF"
  VAR
    when_status: status
  VAREND
  "$FORMAT=ON"

  WHEN any_fault DO
    when_status = $previous_status
    putl ' Invoked DISAL condition handler due to the following abnormal status:'
    disv when_status
    putl ' Enter commands, "exit_proc" to abort, or "exit_proc with when_status" to abort with status'
    include_file command prompt='disal_ch'
  WHENEND

  crev s k= status

  IF $file($value(output) open_position) = '$BOI' THEN
    rewind_file $value(output) status= s
    output_file = $string($value(output))//'.$asis'
  ELSE
    output_file = $string($value(output))
  IFEND

  setfa $fname(output_file) fc= unknown

  create_variable allocation_log_entry k= string d= 0..5
  allocation_log_entry(0) = 'dmc$al_allocate'
  allocation_log_entry(1) = 'dmc$al_initialize'
  allocation_log_entry(2) = 'dmc$al_return_dau'
  allocation_log_entry(3) = 'dmc$al_software_flawed'
  allocation_log_entry(4) = 'dmc$al_reallocate'
  allocation_log_entry(5) = 'dmc$al_trim_file'

  create_variable chain_pos k= string d= 0..4
  chain_pos(0) = 'dmc$first_and_last_allocation'
  chain_pos(1) = 'dmc$first_allocation'
  chain_pos(2) = 'dmc$middle_allocation'
  chain_pos(3) = 'dmc$last_allocation'
  chain_pos(4) = 'dmc$part_of_allocation_unit'

  create_variable allocate_flag k= string d= 0..1
  allocate_flag(0) = 'dmc$dl_first_allocation'
  allocate_flag(1) = 'dmc$dl_continue_allocation'

  create_variable flaw_options k= string d=0..1
  flaw_options(0) = 'dmc$remove_flaw'
  flaw_options(1) = 'dmc$add_flaw'

  create_variable name= entry_type kind= integer
  create_variable name= line kind= string
  create_variable name= al_first kind= integer
  create_variable name= al_last kind= integer
  create_variable name= common_int kind= integer
  create_variable name= common_offset kind= integer
  create_variable name= rap_around kind= integer value= 1

  entry_type_offset = 2
  number_offset = 0
  first_offset = 16
  last_offset = 18
  committed_offset = 8
  entries_offset = 20
  entry_size = 36
  max_entry = 3125

  al_start = $sa(dmv$allocation_log)

  IF $specified(first) OR $specified(last) THEN
    al_first = $value(first)
    al_last = $value(last)
    IF al_first > al_last THEN
      al_last = max_entry
      rap_around = 2
    IFEND
  ELSE
    al_first = $memory(al_start+first_offset, 2)
    al_last = $memory(al_start+last_offset, 2)
  IFEND

  line = '               First Allocation Log Entry = '//..
$strrep(($memory(al_start+first_offset, 2)), 16)//'(16)'
  putl line o= $fname(output_file)
  line = '               Last Allocation Log Entry = '//..
$strrep(($memory(al_start+last_offset, 2)), 16)//'(16)'
  putl line o= $fname(output_file)
  line = '               Number Of Entries = '//$strrep(($memory(al_start+number_offset, 8)), 16)//'(16)'
  putl line o= $fname(output_file)
  line = '               Committed Initialize Count = '//..
$strrep(($memory(al_start+committed_offset, 8)), 16)//'(16)'
  putl line o= $fname(output_file)

  REPEAT
    FOR i = al_first TO al_last DO
      putl '  ' o= $fname(output_file)
      al_entry_adrs = al_start+entries_offset+(i * entry_size)
      display_memory al_entry_adrs, entry_size, o= $fname(output_file)
      entry_type = $memory(al_entry_adrs+entry_type_offset, 1)
      line = '   AVT Index = '//$strrep($memory(al_entry_adrs, 2))
      line = line//'    Entry Type = '//allocation_log_entry(entry_type)
      line = line//'    Entry Index = '//$strrep(i, 16)//'(16)'
      putl line o= $fname(output_file)

      IF entry_type = 0 THEN "dmc$al_allocate"
        display_binary_unique_name, al_entry_adrs+3, o= $fname(output_file), cs= '   Gfn = '
        common_string = $strrep(($memory(al_entry_adrs+14, 3)), 16)//'(16)'
        line = '   DFL Index = '//common_string
        common_int = $memory(al_entry_adrs+17, 1)
        line = line//'    Flag = '//allocate_flag(common_int)
        putl line o= $fname(output_file)
        common_string = $strrep(($memory(al_entry_adrs+18, 3)), 16)//'(16)'
        line = '   DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+21, 3)), 16)//'(16)'
        line = line//'    Prev DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+24, 1)), 16)//'(16)'
        line = line//'    DAUS Per = '//common_string
      ELSEIF entry_type = 1 THEN "dmc$al_initialize"
        display_binary_unique_name, al_entry_adrs+3, o= $fname(output_file), cs= '   GFN = '
        common_string = $strrep(($memory(al_entry_adrs+14, 3)), 16)//'(16)'
        line = '   DFL Index = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+17, 3)), 16)//'(16)'
        line = line//'    DAU Adrs = '//common_string
      ELSEIF entry_type = 2 THEN "dmc$al_return_dau"
        common_string = $strrep(($memory(al_entry_adrs+3, 5)), 16)//'(16)'
        line = '   MF Assign = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+8, 3)), 16)//'(16)'
        line = line//'    DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+11, 1)), 16)//'(16)'
        line = line//'    DAUS Per = '//common_string
      ELSEIF entry_type = 3 THEN "dmc$al_software_flawed"
        common_string = $strrep(($memory(al_entry_adrs+3, 3)), 16)//'(16)'
        line = '   DAU Adrs = '//common_string
        common_int = $memory(al_entry_adrs+6, 1)
        line = line//'    Flaw Option = '//flaw_options(common_int)
      ELSEIF entry_type = 4 THEN "dmc$reallocate"
        display_binary_unique_name, al_entry_adrs+3, o= $fname(output_file), cs= '   GFN = '
        common_string = $strrep(($memory(al_entry_adrs+14, 3)), 16)//'(16)'
        line = '   DFL Index = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+17, 5)), 16)//'(16)'
        line = line//'    MF Assign = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+22, 3)), 16)//'(16)'
        line = line//'    DAU Adrs = '//common_string
        putl line o= $fname(output_file)
        common_string = $strrep(($memory(al_entry_adrs+25, 3)), 16)//'(16)'
        line = '   Old DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+28, 3)), 16)//'(16)'
        line = line//'    Next DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+31, 3)), 16)//'(16)'
        line = line//'    Prev DAU Adrs = '//common_string
        putl line o= $fname(output_file)
        common_string = $strrep(($memory(al_entry_adrs+34, 1)), 16)//'(16)'
        line = '   DAUS Per = '//common_string
        common_int = $memory(al_entry_adrs+35, 1)
        line = line//'    Alloc Chain Pos = '//chain_pos(common_int)
      ELSEIF entry_type = 5 THEN "dmc$al_trim_file"
        display_binary_unique_name, al_entry_adrs+3, o= $fname(output_file), cs= '   GFN = '
        common_string = $strrep(($memory(al_entry_adrs+14, 3)), 16)//'(16)'
        line = '   DFL Index = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+17, 3)), 16)//'(16)'
        line = line//'  DAU Adrs = '//common_string
        common_string = $strrep(($memory(al_entry_adrs+20, 3)), 16)//'(16)'
        line = line//'  DAU of Fragment = '//common_string
      IFEND
      putl line o= $fname(output_file)

    FOREND
    al_first = 0
    al_last = $value(last)
    rap_around = rap_around - 1
  UNTIL rap_around = 0

PROCEND dum$display_allocation_log
