summary_report_generate Subroutine

public subroutine summary_report_generate(harnDesc, reportFname, localrc)

Arguments

Type IntentOptional Attributes Name
type(harness_descriptor), intent(in) :: harnDesc
character(len=*), intent(in) :: reportFname
integer, intent(out) :: localrc

Source Code

  subroutine summary_report_generate (harnDesc, reportFname, localrc)
    type (harness_descriptor), intent(in)  :: harnDesc
    character(len=*),          intent(in)  :: reportFname
    integer,                   intent(out) :: localrc

    integer :: rptLun
    integer :: iostat
    logical :: openstat

    integer :: PdrNo
    integer :: PdrCnt

    integer :: timeStamp(8)

    ! initialize return status
    localrc = ESMF_FAILURE
    
    ! find an open unit number
    call ESMF_UtilIOUnitGet (rptLun, rc=localrc)
    if (ESMF_LogFoundError(localrc, msg="Unable to find available unit.")) &
      return ! bail out

    ! open report file
    open (unit=rptLun, file=reportFname, status='REPLACE', iostat=iostat, action='WRITE')
    if (iostat .NE. 0) then
      print '("error in summ_rpt_generate, unable to open report file - filename = ", A)', &
        reportFname
      go to 90
    end if

    ! get timestamp
    call date_and_time (values=timeStamp)

    ! write top level structure
    write (rptLun, 9000)
    !write (rptLun, 9001)
    write (rptLun, 9005)
    write (rptLun, 9010) timeStamp(1:3), timeStamp(5:7)
    write (rptLun, 9011) adjustL(trim(harnDesc%configPath))
    write (rptLun, 9012) adjustL(trim(harnDesc%topFname))
    write (rptLun, 9013) adjustL(trim(harnDesc%testClass))
    write (rptLun, 9014) trim(harnDesc%reportType)
    write (rptLun, 9015) trim(harnDesc%setupReportType)
    write (rptLun, 9016) harnDesc%numRecords

    ! problem_descriptor_records
    PdrCnt = harnDesc%numRecords
    do PdrNo = 1, PdrCnt
      call summ_rpt_proc_prob_descr_rec (PdrNo, harnDesc%rcrd(PdrNo), rptLun, localrc)
    end do

    ! write trailer
    write (rptLun, 9006)

    localrc = ESMF_SUCCESS

    ! return status & exit
    90 continue

    ! close report file
    inquire (rptLun, opened=openstat)
    if (openstat) then
      close (rptLun)
    end if

    9000 FORMAT ('<?xml version="1.0"?>')
    !9001 FORMAT ('<?xml-stylesheet type="application/xml" href="Harness.xslt"?>')
    9005 FORMAT ('<TopConfig>')
    9006 FORMAT ('</TopConfig>')
    9010 FORMAT ('  <Timestamp>', I4, '/', I2, '/', I2, 2x, I2, ':', I2, ':', I2, '</Timestamp>')
    9011 FORMAT ('  <ConfigPath>', A, '</ConfigPath>')
    9012 FORMAT ('  <TopFname>', A, '</TopFname>')
    9013 FORMAT ('  <TestClass>', A, '</TestClass>')
    9014 FORMAT ('  <ReportType>', A, '</ReportType>')
    9015 FORMAT ('  <SetUpReportType>', A, '</SetUpReportType>')
    9016 FORMAT ('  <PDRCnt>', I3, '</PDRCnt>')

  end subroutine summary_report_generate