PROC display_summary_errors (
  listing, l : file = $required
  output, o  : file = $output
  )


*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

"     The purpose of this procedure is to display the summary status errors from a
"RESTORE_PERMANENT_FILES listing.  This procedure is called by INSTALL_REQUIRED_FILES.
"The LISTING file is assumed to be a $LOCAL file.
*IFEND


  create_variable number_of_lines kind=integer value=100

  create_variable append_count kind=integer value=2
  create_variable append_line kind=boolean value=false
  create_variable ignore_status kind=status
  create_variable lines kind=string dimension=number_of_lines
  create_variable lines_returned kind=integer value=0


  rewind_file $value(listing) status=ignore_status

  REPEAT

    accept_line v=lines $fname($string($value(listing))//'.$asis') lc=lines_returned

    FOR i = 1 TO lines_returned DO

      append_line = (append_line AND (lines(i) <> '') AND (append_count < 2))

      IF $scan_string('--ERROR' lines(i)) <> 0 THEN
        put_line lines(i) o=$fname($string($value(output))//'.$eoi')
        append_line = true
        append_count = 0

      ELSE
        IF append_line THEN
          put_line lines(i) o=$fname($string($value(output))//'.$eoi')
          append_count = append_count + 1
        IFEND
      IFEND

    FOREND

  UNTIL lines_returned < number_of_lines

  put_line ('  ',' --WARNING-- Above errors occurred during tape load.' ..
        ' The load errors encountered may be due to a bad tape device.') ..
        o=$fname($string($value(output))//'.$eoi')


PROCEND display_summary_errors
