! --------------------------------------------------------------------------
! Bernese GPS Software Version 5.3
! --------------------------------------------------------------------------

MODULE d_rxnType

! --------------------------------------------------------------------------
! Purpose:    This module provides data types and common subroutines
!             to read, write and convert RINEX navigation files
! --------------------------------------------------------------------------
!
! Authors:    P. Stebler
!
! Created:    02-Feb-2018
!
! Changes:    02-Feb-2018 ST: Add t_rxnIonCorrPars, t_rxnIonCorrOfSys,
!                             t_rxnIonCorrPerSys, t_rxnTimSysCorrOfSys,
!                             t_rxnTimSysCorrFromSysToSys and t_rxnHdr
!             05-Feb-2018 ST: Add t_rxnBaseConf, t_rxnDataRec, t_rxnInpHdlr,
!                             t_rxnOrb, t_rxnOrbs and t_rxnRdConf
!             07-Feb-2018 ST: Add rxnOutHdlr
!             09-Feb-2018 ST: Add t_rxnHdrAndStat
!             22-Feb-2018 ST: Flatten orbit data structure in
!                             t_rxnDataRec/t_rxnOrbs
!             05-Mar-2018 ST: Add init interface in M_EPOCH,
!                             make init_epoch private
!                             and add init_timWin
!             05-Mar-2018 ST: Add t_rxnConfOfSys, t_rxnConfPerSys,
!                             t_rxnLimits and extend t_rxnBaseConf
!             15-Mar-2018 ST: Add t_rxnBadOrbValFlags
!             15-Mar-2018 ST: Add t_rxnCommonOrbElem
!             15-Mar-2018 ST: Add hasBadFlags to t_rxnBadOrbValFlags
!                             and to t_rxnDataRec
!             16-Mar-2018 ST: Add removeBadRxnDataRecs to t_rxnDataRecs
!             16-Mar-2018 ST: Add wrtSysPrnStr
!             20-Mar-2018 ST: Remove test values for node and mean anomaly
!             21-Mar-2018 ST: Add block names to RINEX nav sys configurations
!             22-Mar-2018 ST: Add posibility to restrict block conf to some prns
!             22-Mar-2018 ST: Add t_rxnConfValEntry
!             28-Mar-2018 ST: Add t_rxnBadOrbValCtrs
!             28-Mar-2018 ST: Rearrange requested epoch and observation window
!             28-Mar-2018 ST: Add Galileo data source priorization
!             29-Mar-2018 ST: Generalize t_sortedInts and t_sortedReals
!                             to t_dynIntArr and t_dynRealArr
!             29-Mar-2018 ST: Add priority to t_rxnDataRec
!             06-Apr-2018 ST: Move outConf and minNavMsgNbr to t_rxnBaseConf
!             11-Apr-2018 ST: Rename t_rxnLimits to t_rxnLimitsPerConfVal
!             11-Apr-2018 ST: Add t_rxnLimits
!             06-Aug-2018 ST: Reinsert test values for node and mean anomaly
!             06-Aug-2018 ST: Add configuration for maximal changes
!                             of orbital elements
!             09-Aug-2018 ST: Rename t_rxnOrbs to t_rxnRawOrbElems
!             09-Aug-2018 ST: Redesigned t_rxnCommonOrbElem
!                             to t_rxnTransfOrbElems
!             09-Aug-2018 ST: Use t_rxnTransfOrbElems in t_rxnDataRec
!             10-Aug-2018 ST: Add d_rxnType::listBad
!             20-Aug-2018 ST: Add d_rxnType::calcNbOfActiveSats
!                             and d_rxnType::calcTotNbOfActiveSats
!             20-Aug-2018 ST: Move o_rxnBase::getMaxPrnForSys
!                             to d_rxnType::calcMaxPrn
!             22-Aug-2018 ST: Split d_rxnType::t_rxnDataRecsPerSvn
!                             to d_rxnType::t_rxnDataRecsPerSys
!                             and d_rxnType::t_rxnDataRecsPerSat
!             22-Aug-2018 ST: Add d_rxnType::firstEphemEpoch
!             23-Aug-2018 ST: Add t_rxnRawOrbElems::exportLegacyEph_nonRS
!                             t_rxnRawOrbElems::exportLegacyEph_RS
!             23-Aug-2018 ST: Clean up and comment d_rxnEnums::t_rxnOrbValIds
!             23-Aug-2018 ST: Add t_rxnRawOrbElems::exportLegacyClk_nonRS
!             06-Sep-2018 ST: Reengineered t_nb_priv to t_nb_rxnType
!                             to be more consistent with Fortran best practices
!             12-Sep-2018 ST: Add d_rxnType::hasAnyBadOrUnknowns
!                             and d_rxnType::hasAnyBadShiftUnknown
!             12-Sep-2018 ST: Rename t_rxnEventCtrs::*Bad
!                             to t_rxnEventCtrs::*Events
!             12-Sep-2018 ST: Rename d_rxnType::removeBadRxnDataRecs
!                             to d_rxnType::removeAnyBadOrUnknowns
!             12-Sep-2018 ST: Remove t_rxnDataRec::listBad
!             12-Sep-2018 ST: No urgent need for t_rxnBadOrbValFlags,
!                             t_rxnBadOrbValCtrs can do this job.
!             13-Sep-2018 ST: Add rateOfInclination_nonRS_rad_s
!                             and extrapolate_nonRS to t_rxnTransfOrbElems
!             13-Sep-2018 ST: Redesign t_rxnBaseConf::minNavMsgNbr
!                             to t_rxnBaseConf::minNavMsgNbrPerSys
!             14-Sep-2018 ST: Redesign l_basFun::indFmt to l_basFun::indentFmt
!             19-Oct-2018 ST: Add getIdx, insertAt and insert to t_rnxDataRecs
!             24-Oct-2018 ST: Add multiple ionospheric correction parameters
!                             per system because of BeiDou.
!             24-Oct-2018 ST: Redesign t_rxnIonCorrPars
!                             to t_rxnIonCorr and t_rxnIonCorrId
!             24-Oct-2018 ST: Redesign t_rxnIonCorrOfSys to t_rxnIonCorrsOfSys
!             24-Oct-2018 ST: Rename t_rxnIonCorrPerSys to t_rxnIonCorrsPerSys
!             24-Oct-2018 ST: Add compare interface
!                             for t_rxnIonCorrId::compare
!             11-Feb-2019 ST: Remove cpy interface and cpy_ routines.
!             21-May-2019 ST: Review SUBROUTINE cpyConstr
!             07-Jun-2019 ST: Use maxRnxSys instead of maxSys (add Indian system)
!             11-Jun-2019 ST: Add isHealthy and isPermanentlyUnhealthy
!                             to d_rxnType.
!                             Add health to t_rxnTransfOrbElems.
!             12-Jun-2019 ST: Add isPermanentlyHealthy,
!                             isRegistered, removeInsufficent,
!                             removeUnregistered, removeUnhealthy
!                             and removeWrongFreqNbs to d_rxnType.
!             14-Jun-2019 ST: Add listUnhealthySats, listUnregisteredEpochs,
!                             listWrongFreqNbEpochs, isWrongFreqNb,
!                             wrtUnregisteredToLfnErr and wrtWrongFreqNbsToLfnErr
!                             to d_rxnType.
!             04-Jul-2019 ST: Remove SHIFT code and mark it with !(shift).
!                             Substituting code is post-commented with !(noshift).
!                             Please remove those parts later on
!                             if no one misses them.
!             10-Jul-2019 ST: Use 'this' as own object variable name
!                             Undo DABS(...) compared to 0d0.
!             23-Oct-2019 ST: Move wrtSysPrnStr part from d_rnxType to m_global.
!             24-Oct-2019 ST: Use a system dependend bit mask in isHealthy.
!                             Change t_rxnTransfOrbElems::health
!                             from REAL(r8b) to INTEGER(i4b).
!             31-Oct-2019 ST: Extract d_rxnType::compare_rxnDataRec
!                             from o_rinexN::processRxnInpRecs.
!             28-Nov-2019 ST: Rename t_rxnDataRec%priority
!                             to t_rxnDataRec%brdDataSrcPrio.
!                             Add t_rxnBaseConf::gpsDataSrcPrio.
!             13-Feb-2019 ST: Add accuracy_m to t_rxnTransfOrbElems.
!                             Add markUnhealtyAsUnknownAccuracy.
!                             Add calcMaxAccuracy for t_rxnDataRecs.
!                             TARGET fixes for NAG.
!             20-Feb-2019 ST: Bugfix health interpretation for SBAS.
!             25-Mar-2020 ST: t_rxnBaseConf is not the right place
!                             to hold a t_rnxOutConf member.
!                             t_rnxOutConf implies RINEX output files
!                             which is e.g. not right for RXN2PRE.
!             29-Mar-2020 ST: Put an interface for calcMaxPrn.
!                             Use 'this' where appropriate.
!                             Add calcBswSatNum interface.
!                             Add t_rxnOsbs.
!                             Add calcBswSatNum, calcSvn, calcOsbs
!                             and getGlonassSlotBrd to t_rxnDataRec.
!             30-Mar-2020 ST: Add t_rxnOsbs::prt and t_rxnOsb.
!             10-Nov-2020 ST: Split t_rnxBaseConf to t_rnxRdHdrConf
!                             and t_rnxRdRecConf.
!             20-Nov-2020 ST: Use of asterisks as format is compiler dependent.
!                             Mainly replaced by '()' and '(1X,A)'.
!             28-Nov-2020 ST: Use t_rnxVers instead of flags in t_rnxHdrLabel.
!             29-Nov-2020 ST: Rename missingHdrRecsWarned to wrongHdrRecsWarned.
!             22-Dec-2020 RD: Transform D_CONST to a protected structure CONST
!             23-Dec-2020 RD: Transform D_SATFRQ to a protected structure SATFRQ
!             18-Jan-2022 ST: Rename t_rxnRawOrbElems ot t_rxnRawRecElems.
!             21-Jan-2022 ST: From RINEX 4 on:
!                             - No more IONOSPHERIC CORR and TIME SYSTEM CORR.
!                             - LEAP SECONDS mandatory.
!                             - REC# / TYPE / VERS also for navigation files.
!                             - New MERGED FILE.
!                             Replace names Crs, Crc, ... by C_rs, C_rc, ...
!                             Change dimension of t_rxnRawOrbElems from 32 to 40.
!             25-Jan-2022 ST: To be able to store the new RINEX 4 nav records:
!                             - Add 6 new attributes to t_rxnDataRec:
!                               recType, msgType, blankElems, timeOffsCode,
!                               sbasId, utcId.
!                             - Add 5 new methods to t_rxnDataRec:
!                               calcTypeSysMssgId, import/exportTypeSvMssg
!                               isLegacyRx2Rx3, setLegacyRx2Rx3FromSys
!                             - Add t_rxnBlankRecElems, maxTypeSysMssgId
!                               and nbRxnRecElems.
!                             Refine compare_rxnDataRec.
!                             Adapt wrtSysPrnStr_rxnDataRec for blank prns.
!             26-Jan-2022 ST: Remove outdated exportLegacyClk_nonRS.
!                             Move code of d_rxnType::exportLegacyEph_RS
!                             into subroutine orbInt.
!                             Move code of d_rxnType::exportLegacyEph_nonRS
!                             into subroutine broadC.
!             02-Feb-2022 ST: To be able to store the new RINEX 4 nav records:
!                             - Refactor t_rxnDataRecsPerSys
!                               to t_rxnDataRecsPerTypeSysMssg.
!                             - Use typeSysMssgId instead of iSys.
!                             - Refactor calcNbOfActiveSats to listActiveSats.
!                             Use t_stringList2 for list routines.
!             03-Feb-2022 ST: Slightly refine BeiDou D1/D2 handling
!                             (still needs recognition of GEO).
!             07-Feb-2022 ST: Add some elements to t_rxnTransfOrbElems.
!                             Rename elements of t_rxnTransfOrbElems to standard.
!             08-Feb-2022 ST: Call calcTransfOrbElems in o_rinexN::rdRxnRec.
!                             Remove calls to calcTransfOrbElems in o_rxnBase.
!                             Remove t_rxnDataRec%transfElemsValid.
!                             Add t_rxnTransfOrbElems%velRel_RS_m_per_s.
!                             Split t_rxnDataRec%clockEpoch and ephemEpoch
!                             into clkEpoOrig, clkEpoUni,
!                             ephEpoOrig and ephEpoUni.
!                             Add t_rxnDataRec%trmEpoOrig and trmEpoUni.
!                             Remove firstEphemEpoch.
!                             Also compare on transmission time.
!             13-Feb-2022 ST: Remove listActiveSats.
!             17-Feb-2022 ST: Add t_typeSysMssg%nbRecLines.
!                             Bugfix D-UTC header label.
!                             According to RINEX 2.12 specification example
!                             still allow deprecated CORR TO SYSTEM TIME
!                             (for RINEX 2.12).
!                             Bugfix: Start t_rxnDataRecsPerSat:ar from 0
!                             since there are now e.g '> STO E   IFNV'
!                             which are identified with prn == 0.
!             18-Feb-2022 ST: Allow prn == 0 in satBlk_rxnDataRec.
!                             No extrapolation in extrapolate_nonRS
!                             if semi major axis <= 0.
!             23-Jan-2023 MK: Remove piece of dust
!             16-Jun-2023 ST/SL: Conforming to specification RINEX-2.txt,
!                                allow CORR TO SYSTEM TIME, DELTA-UTC,
!                                ION ALPHA, ION BETA and LEAP SECONDS already
!                                from version 2 on.
!             23-Jul-2025 ST: Bugfix health flags detection for GPS and QZSS.
!                             Add health flags detection for BeoDou and IRNSS.
!
! Copyright:  Astronomical Institute
!             University of Bern
!             Switzerland
! --------------------------------------------------------------------------

  USE m_bern,     ONLY: i4b, r8b, keyNameLength, longLineLength
  USE l_basFun,   ONLY: appendStr, indentFmt, str
  USE m_test,     ONLY: CHECK_SameInt
  USE m_cpu,      ONLY: cpu_enter, cpu_exit
  USE d_const,    ONLY: CONST
  USE d_satfrq,   ONLY: SATFRQ
  USE d_insModes, ONLY: t_insertMode
  USE m_string,   ONLY: t_string, constr, cpyConstr, destr, push_back, &
                        OPERATOR(==)
  USE m_strList,  ONLY: t_stringList, &
                        calcNextSize, chkIfExitLoop, constr, cpyConstr, destr, &
                        insertAt, nb, push_back, str, &
                        wrtSrErrToLfnErr, wrtSrWarnToLfnErr
  USE m_strList2, ONLY: t_stringList2, wrtSrWarnToLfnErr
  USE m_numTools, ONLY: t_dynIntArr, str
  USE m_tools,    ONLY: t_fileHdlr, t_intPerSys, t_reqEpoch, &
                        constr, cpyConstr, destr
  USE m_global,   ONLY: maxRnxSys, maxSvnSys, &
                        g_strSys3, g_svnSys, getSysStr, &
                        getSysNbr, wrtSysPrnStr
  USE m_time,     ONLY: t_timInt
  USE m_epoch,    ONLY: t_epoch, compare, init, prt, ASSIGNMENT(=), &
                        OPERATOR(-), OPERATOR(==), OPERATOR(/=), &
                        OPERATOR(<), OPERATOR(<=), OPERATOR(>=), OPERATOR(>), &
                        OPERATOR(.epochToReal.), OPERATOR(.realToEpoch.)
  USE d_rnxEnums, ONLY: str, OPERATOR(==), OPERATOR(/=), OPERATOR(<)
  USE d_rnxType,  ONLY: rnxHdrLabelList, rnxVers_0_00, rnxVers_2_00, &
                        rnxVers_2_11_official, rnxVers_2_12, rnxVers_3_05, &
                        rnxVers_4_00, rnxVers_9_99, &
                        t_hdrLabelWithDescr, t_hdrValChkDef, t_rdHdlr, &
                        t_rnxLeapSecs, t_rnxRdHdrConf, t_rnxRdRecConf, &
                        t_rnxGenHdrData, t_rnxHdrLabel, &
                        clear, constr, cpyConstr, destr, &
                        init, maxRnxPrn, prt
  USE o_rnxBase,  ONLY: calcBswSatNum, getAndChkSysNbr
  USE d_rxnEnums, ONLY: t_rxnConfValIdx, rxnConfValIds, &
                        t_rxnMsgType, rxnMsgTypes, &
                        t_rxnRecType, rxnRecTypes, &
                        rxnOrbValIds, &
                        parseRxnMsgType, parseRxnRecType, str, &
                        OPERATOR(==), OPERATOR(/=)
  USE s_alcErr
  USE s_exitRc
  USE s_prn2svn
  USE s_satBlk
  USE s_timSt2

  ! No implicit
  IMPLICIT NONE

#include "COM_CPU.inc"

  ! Save variables
  SAVE

  ! Access rights
  PRIVATE
  PUBLIC :: maxTypeSysMssgId, nbRxnRecElems, rxnHdrLabels, rxnHdrLabelList
  PUBLIC :: typeSysMssgs
  PUBLIC :: t_nb_rxnType, t_rxnBadOrbValCtrs, t_rxnBaseConf, t_rxnBlankRecElems
  PUBLIC :: t_rxnBlockConf, t_rxnConfOfSys, t_rxnConfPerSys, t_rxnConfValEntry
  PUBLIC :: t_rxnDataRec, t_rxnDataRecs, t_rxnDataRecsPerSat
  PUBLIC :: t_rxnDataRecsPerTypeSysMssg, t_rxnHdr, t_rxnHdrAndStat
  PUBLIC :: t_rxnInpHdlr, t_rxnIonCorr, t_rxnIonCorrId, t_rxnIonCorrsOfSys
  PUBLIC :: t_rxnIonCorrsPerSys, t_rxnLimits, t_rxnLimitsPerConfVal, t_rxnOsb
  PUBLIC :: t_rxnOsbs, t_rxnOutHdlr, t_rxnRawRecElems, t_rxnRdConf
  PUBLIC :: t_rxnTimSysCorrFromSysToSys, t_rxnTimSysCorrOfSys
  PUBLIC :: t_rxnTransfOrbElems, t_typeSysMssg
  PUBLIC :: addBad, areLimitsDefined, calcBswSatNum, calcMaxAccuracy, calcMaxPrn
  PUBLIC :: calcOsbs, calcSvn, calcTotNbOfMsgs, calcTypeSysMssgId, clear, compare
  PUBLIC :: constr, cpyConstr, destr, exportTypeSvMssg, extrapolate_nonRS
  PUBLIC :: getElemPtr, getIdx, getLimits, getGlonassSlotBrd
  PUBLIC :: hasAnyBadOrUnknowns, hasBad, hasLimits, hasMessages, hasUnknowns
  PUBLIC :: importTypeSvMssg, incMyNb, init, insert, isHealthy, isLegacyRx2Rx3
  PUBLIC :: isPermanentlyHealthy, isPermanentlyUnhealthy, isRegistered
  PUBLIC :: listBad, listEvents, listUnhealthySats
  PUBLIC :: markUnhealtyAsUnknownAccuracy, nb, prt, push_back
  PUBLIC :: removeAnyBadOrUnknowns, removeUnhealthy, removeUnregistered
  PUBLIC :: removeWrongFreqNbs, reserve, setLegacyRx2Rx3FromSys, setLimits
  PUBLIC :: str, tstModuleRxnType, wrtSysPrnStr, wrtUnregisteredToLfnErr
  PUBLIC :: wrtWrongFreqNbsToLfnErr
  PUBLIC :: OPERATOR(==), OPERATOR(/=)

  ! Module parameters

  ! Module name
  CHARACTER(LEN=*), PARAMETER :: modNam = 'D_RXNTYPE'

  ! Number of elements in navigation records
  INTEGER(i4b), PARAMETER :: nbRxnRecElems = 40

  ! Type to count number of items in a container.
  ! The component %nb_priv of this derived type is PRIVATE.
  !
  ! This is used for containers with a component %nb where one has to take care
  ! of calling the method destr to deallocate components.
  ! It prevents manipulations of the containers %nb from outside.
  !
  ! For some derived types the memory management would break if a user would
  ! manipulate the stored number of entries directly by changing %nb.
  TYPE t_nb_rxnType
    PRIVATE
    INTEGER(i4b) :: nb_priv
  END TYPE t_nb_rxnType

  ! List of predefined RINEX navigation header labels
  TYPE(t_rnxHdrLabel), DIMENSION(17), PARAMETER :: rxnHdrLabelList = [ &
    ! Label:         Label as it is written in the RINEX header.
    ! Ck:            Number of values to configure a check in input file.
    ! definedFrom:   From which RINEX version on the label is defined.
    ! mandatoryFrom: From which RINEX version on the label is mandatory.
    !                rnxVers < 1.00 means not mandatory.
    ! mandatoryTo:   To which RINEX version the label is mandatory.
    !                Ignored if not mandatory.
    ! definedTo:     To which RINEX version the label is defined.
    !                rnxVers_9_99 means it is currently still defined.
    !
    !             Header label
    ! Ck definedFrom   mandatoryFrom mandatoryTo   definedTo
    t_rnxHdrLabel('CORR TO SYSTEM TIME', &
      0, rnxVers_2_00, rnxVers_0_00, rnxVers_0_00, rnxVers_2_12), &

    t_rnxHdrLabel('D-UTC A0,A1,T,W,S,U', &
      0, rnxVers_2_11_official, rnxVers_0_00, &
      rnxVers_0_00, rnxVers_2_11_official), &

    t_rnxHdrLabel('DELTA-UTC: A0,A1,T,W', &
      0, rnxVers_2_00, rnxVers_0_00, rnxVers_0_00, rnxVers_2_11_official), &

    t_rnxHdrLabel('ION ALPHA', &
      0, rnxVers_2_00, rnxVers_0_00, rnxVers_0_00, rnxVers_2_12), &

    t_rnxHdrLabel('ION BETA', &
      0, rnxVers_2_00, rnxVers_0_00, rnxVers_0_00, rnxVers_2_12), &

    t_rnxHdrLabel('IONOSPHERIC CORR', &
      1, rnxVers_2_12, rnxVers_0_00, rnxVers_0_00, rnxVers_3_05), &

    t_rnxHdrLabel('LEAP SECONDS', &
      1, rnxVers_2_00, rnxVers_4_00, rnxVers_9_99, rnxVers_9_99), &

    t_rnxHdrLabel('MERGED FILE', &
      0, rnxVers_4_00, rnxVers_0_00, rnxVers_0_00, rnxVers_9_99), &

    t_rnxHdrLabel('REC # / TYPE / VERS', &
      0, rnxVers_4_00, rnxVers_0_00, rnxVers_0_00, rnxVers_9_99), &

    t_rnxHdrLabel('TIME SYSTEM CORR', &
      3, rnxVers_2_12, rnxVers_0_00, rnxVers_0_00, rnxVers_3_05), &

    rnxHdrLabelList(1), &
    rnxHdrLabelList(2), &
    rnxHdrLabelList(3), &
    rnxHdrLabelList(4), &
    rnxHdrLabelList(5), &
    rnxHdrLabelList(6), &
    rnxHdrLabelList(7) ]

  ! Predefined names for RINEX navigation header labels
  TYPE t_rxnHdrLabels
    TYPE(t_rnxHdrLabel) :: CorrToSysTime
    TYPE(t_rnxHdrLabel) :: D_Utc
    TYPE(t_rnxHdrLabel) :: DeltaUtc
    TYPE(t_rnxHdrLabel) :: IonAlpha
    TYPE(t_rnxHdrLabel) :: IonBeta
    TYPE(t_rnxHdrLabel) :: IonosphericCorr
    TYPE(t_rnxHdrLabel) :: LeapSecs
    TYPE(t_rnxHdrLabel) :: MergedFile
    TYPE(t_rnxHdrLabel) :: RcvNbrTypeVers
    TYPE(t_rnxHdrLabel) :: TimeSystemCorr
  END TYPE t_rxnHdrLabels

  ! Named predefined RINEX navigation header labels
  TYPE(t_rxnHdrLabels), PARAMETER :: rxnHdrLabels = t_rxnHdrLabels( &
    rxnHdrLabelList( 1), rxnHdrLabelList( 2), rxnHdrLabelList( 3), &
    rxnHdrLabelList( 4), rxnHdrLabelList( 5), rxnHdrLabelList( 6), &
    rxnHdrLabelList( 7), rxnHdrLabelList( 8), rxnHdrLabelList( 9), &
    rxnHdrLabelList(10) )

  ! List of RINEX navigation header labels for which the action on
  ! missing mandatory header labels is configurable
!  TYPE(t_hdrValChkDef), DIMENSION(0), PARAMETER :: &
!    mandRxnHdrRecDefs = [ ]

  ! List of RINEX navigation header values for which the action on
  ! inconsistencies between headers is configurable
  TYPE(t_hdrValChkDef), DIMENSION(5), PARAMETER :: &
    inconsRxnHdrValChkDefs = [ &

    t_hdrValChkDef( &
      t_hdrLabelWithDescr('LEAP SECONDS', &
        'Leap seconds'), &
      'leapSecs', 'AOI_LEAP_SEC'), &

    t_hdrValChkDef( &
      t_hdrLabelWithDescr('IONOSPHERIC CORR', &
        'Ionospheric correction parameters'), &
      'ionCorrPars', 'AOI_IONCORRPARS'), &

    t_hdrValChkDef( &
      t_hdrLabelWithDescr('TIME SYSTEM CORR', &
        'Time system correction parameters'), &
      'a0, a1', 'AOI_A0_A1'), &

    t_hdrValChkDef( &
      t_hdrLabelWithDescr('TIME SYSTEM CORR', &
        'Service provider'), &
      'serviceProvider', 'AOI_SERVICE_PROV'), &

    t_hdrValChkDef( &
      t_hdrLabelWithDescr('TIME SYSTEM CORR', &
        'UTC ID'), &
      'utcId', 'AOI_UTC_ID') ]

  ! Identifier for RINEX ionospheric correction.
  !
  ! Methods:
  !   init(this)
  !   compare(obj1, obj2)
  !   OPERATOR(==)
  !   OPERATOR(!=)
  !   prt(this, varNam, indent)
  TYPE t_rxnIonCorrId
    ! Transmission time mark (seconds of week)
    ! converted to hours of day and then to A to X
    !
    ! Mandatory for BeiDou System, optional for other constellations (0)
    CHARACTER(LEN=1) :: transmissionTime

    ! Satellite vehicle ID
    !
    ! Mandatory for BDS, optional for other constellations (0)
    INTEGER(i4b)     :: svId

    ! Alphas or betas
    LOGICAL          :: falseForAlphas_trueForBetas
  END TYPE t_rxnIonCorrId

  ! RINEX ionospheric correction of one GNSS of one type (alphas or betas)
  ! for a given transmission time and a given satellite vehicle ID.
  !
  ! Methods:
  !   init(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnIonCorr
    ! Identifier
    TYPE(t_rxnIonCorrId)    :: id

    ! Parameters
    ! GPS, QZS, BDS and IRN: alpha0-alpha3 or beta0-beta3
    ! GAL: ai0, ai1, ai2, zero
    REAL(r8b), DIMENSION(4) :: parameters
  END TYPE t_rxnIonCorr

  ! RINEX ionospheric corrections of one type (alphas or betas) of one GNSS
  !
  ! Methods:
  !   constr(this, reserveSize)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   clear(this)
  !   reserve(this, reserveSize)
  !   incMyNb(this)
  !   getIdx(this, rxnIonCorrId)
  !   insertAt(this, toInsert, idx)
  !   insert(this, toInsert, insertMode, insertedIdx)
  !   prt(this, varNam, indent)
  TYPE t_rxnIonCorrsOfSys
    ! Current length of the list
    INTEGER(i4b)                              :: nb

    ! The administrated list of RINEX ionospheric corrections
    TYPE(t_rxnIonCorr), DIMENSION(:), POINTER :: ar
  END TYPE t_rxnIonCorrsOfSys

  ! RINEX ionospheric corrections per GNSS
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   clear(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnIonCorrsPerSys
    TYPE(t_rxnIonCorrsOfSys), DIMENSION(0:maxRnxSys -1) :: ar
  END TYPE t_rxnIonCorrsPerSys

  ! RINEX time system transformation parameters of one GNSS
  !
  ! Methods:
  !   init(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnTimSysCorrOfSys
    ! True if defined
    LOGICAL          :: defined

    TYPE(t_epoch)    :: refTime
    REAL(r8b)        :: a0
    REAL(r8b)        :: a1
    CHARACTER(LEN=5) :: serviceProvider
    INTEGER(i4b)     :: utcId
  END TYPE t_rxnTimSysCorrOfSys

  ! RINEX time system transformation parameters from one to another GNSS
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnTimSysCorrFromSysToSys
    ! First  index: from which system
    ! Second index: to which system (abuse: maxRnxSys indicates UTC)
    TYPE(t_rxnTimSysCorrOfSys), DIMENSION(0:maxRnxSys -1, 0: maxRnxSys) :: ar
  END TYPE t_rxnTimSysCorrFromSysToSys

  ! RINEX navigation header.
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   clear(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnHdr
    ! General header data
    TYPE(t_rnxGenHdrData)             :: genData

    ! Number of merged files
    ! < 0: Not in header
    !   0: Blank MERGED FILE header entry
    INTEGER(i4b)                      :: nbMergedFiles

    ! Leap seconds.
    ! Part of the RINEX header record 'LEAP SECONDS'.
    TYPE(t_rnxLeapSecs)               :: leapSecs

    ! Ionospheric corrections per GNSS.
    ! Corresponds to the RINEX header records 'IONOSPHERIC CORR' (Rinex3),
    ! or 'ION ALPHA' and 'ION BETA' (Rinex2, GPS).
    !
    ! No more defined for RINEX 4.
    TYPE(t_rxnIonCorrsPerSys)         :: ionCorrsPerSys

    ! RINEX time system transformation parameters from one to another GNSS.
    ! Corresponds to the RINEX header records 'TIME SYSTEM CORR' (Rinex3),
    ! or 'DELTA-UTC: A0,A1,T,W' (Rinex2, GPS),
    ! or 'CORR TO SYSTEM TIME' (Rinex2, GLONASS, Rinex < V2.11 GEO),
    ! or 'D-UTC: A0,A1,T,W,S,U' (Rinex 2.11, GEO)
    !
    ! No more defined for RINEX 4.
    TYPE(t_rxnTimSysCorrFromSysToSys) :: timSysCorrFromSysToSys
  END TYPE t_rxnHdr

  ! Raw RINEX navigation broadcast record elements for one data record.
  !
  ! Methods:
  !   init(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnRawRecElems
    REAL(r8b), DIMENSION(nbRxnRecElems) :: ar
  END TYPE t_rxnRawRecElems

  ! Blank RINEX navigation broadcast record elements for one data record.
  !
  ! Methods:
  !   init(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnBlankRecElems
    LOGICAL, DIMENSION(nbRxnRecElems) :: ar
  END TYPE t_rxnBlankRecElems

  ! Transformed RINEX navigation orbit elements for one data record.
  !
  ! Methods:
  !   init(this)
  !   extrapolate_nonRS(this, seconds)
  !   prt(this, varNam, indent)
  TYPE t_rxnTransfOrbElems
    INTEGER(i4b) :: health

    ! <= 0d0 means unknown
    REAL(r8b) :: accuracy_m

    REAL(r8b) :: A_m
    REAL(r8b) :: Adot_m_per_s
    REAL(r8b) :: ecc
    REAL(r8b) :: i0_rad
    REAL(r8b) :: Omega0_rad
    REAL(r8b) :: omega_rad

    REAL(r8b) :: deltaN0_nonRS_rad_per_s
    REAL(r8b) :: deltaN0Dot_nonRS_rad_per_s2
    REAL(r8b) :: M0_nonRS_rad
    REAL(r8b) :: iDot_nonRS_rad_per_s
    REAL(r8b) :: OmegaDot_nonRS_rad_per_s

    REAL(r8b) :: C_uc_nonRS_rad, C_us_nonRS_rad
    REAL(r8b) :: C_rc_nonRS_m, C_rs_nonRS_m
    REAL(r8b) :: C_ic_nonRS_rad, C_is_nonRS_rad

    REAL(r8b), DIMENSION(3) :: pos_RS_m
    REAL(r8b), DIMENSION(3) :: vel_RS_m_per_s
    REAL(r8b), DIMENSION(3) :: acc_RS_m_per_s2

    REAL(r8b), DIMENSION(3) :: velRel_RS_m_per_s
  END TYPE t_rxnTransfOrbElems

  ! Flag counter for bad RINEX navigation broadcast orbit values.
  !
  ! Methods:
  !   init(this)
  !   addBad(this, badCtrs)
  !   hasBad(this)
  !   listBad(this, str)
  !   prt(this, varNam, indent)
  TYPE t_rxnBadOrbValCtrs
    INTEGER(i4b) :: ephemEpochs
    INTEGER(i4b) :: semiMajAxis
    INTEGER(i4b) :: nodes
    INTEGER(i4b) :: rateOfNodes
    INTEGER(i4b) :: meanAnomalies
    INTEGER(i4b) :: eccentricities
    INTEGER(i4b) :: inclinations
    INTEGER(i4b) :: perigees
    INTEGER(i4b) :: deltaN0s
    INTEGER(i4b) :: positions
    INTEGER(i4b) :: velocities
  END TYPE t_rxnBadOrbValCtrs

  ! RINEX navigation OSB
  !
  ! Methods:
  !   init(this)
  !   OPERATOR(==)(obj1, obj2)
  !   OPERATOR(!=)(obj1, obj2)
  !   str(this)
  TYPE t_rxnOsb
    CHARACTER(LEN=3) :: obsType
    REAL(r8b)        :: osb
  END TYPE t_rxnOsb

  ! RINEX navigation OSBs
  !
  ! Methods:
  !   init(this)
  !   push_back(this, obsType, osb)
  !   OPERATOR(==)(obj1, obj2)
  !   OPERATOR(!=)(obj1, obj2)
  !   prt(this)
  TYPE t_rxnOsbs
    INTEGER(i4b)                 :: nb
    TYPE(t_rxnOsb), DIMENSION(3) :: osbs
  END TYPE t_rxnOsbs

  ! Record type, GNSS and message type
  ! corresponding to TYPE / SV / MSSG record header.
  TYPE t_typeSysMssg
    TYPE(t_rxnRecType) :: recType
    CHARACTER(LEN=1)   :: sysChr
    TYPE(t_rxnMsgType) :: msgType
    INTEGER(i4b)       :: nbRecLines
    LOGICAL            :: legacy
  END TYPE t_typeSysMssg

  ! Maximal ID for TYPE / SV / MSSG identification
  INTEGER(i4b), PARAMETER :: maxTypeSysMssgId = 40

  ! Combinations of record type, GNSS and message type.
  ! Mainly used to deal with the typeSysMssgId.
  !
  ! BeiDou ephemeries need a special treating,
  ! - D1 is for MEO and IGSO,
  ! - D2 for GEO
  ! - both are legacy
  ! - Solution: use D1D2 instead of D1 or D2 in this table
  TYPE(t_typeSysMssg), DIMENSION(maxTypeSysMssgId) :: typeSysMssgs = [ &
    t_typeSysMssg(rxnRecTypes%EPH, 'G', rxnMsgTypes%LNAV, 7, .TRUE. ), & !  1
    t_typeSysMssg(rxnRecTypes%EPH, 'G', rxnMsgTypes%CNAV, 8, .FALSE.), & !  2
    t_typeSysMssg(rxnRecTypes%EPH, 'G', rxnMsgTypes%CNV2, 9, .FALSE.), & !  3
    t_typeSysMssg(rxnRecTypes%EPH, 'R', rxnMsgTypes%FDMA, 4, .TRUE. ), & !  4
    t_typeSysMssg(rxnRecTypes%EPH, 'E', rxnMsgTypes%INAV, 7, .TRUE. ), & !  5
    t_typeSysMssg(rxnRecTypes%EPH, 'E', rxnMsgTypes%FNAV, 7, .FALSE.), & !  6
    t_typeSysMssg(rxnRecTypes%EPH, 'S', rxnMsgTypes%SBAS, 3, .TRUE. ), & !  7
    t_typeSysMssg(rxnRecTypes%EPH, 'C', rxnMsgTypes%D1D2, 7, .TRUE. ), & !  8
    t_typeSysMssg(rxnRecTypes%EPH, 'C', rxnMsgTypes%CNV1, 9, .FALSE.), & !  9
    t_typeSysMssg(rxnRecTypes%EPH, 'C', rxnMsgTypes%CNV2, 9, .FALSE.), & ! 10
    t_typeSysMssg(rxnRecTypes%EPH, 'C', rxnMsgTypes%CNV3, 8, .FALSE.), & ! 11
    t_typeSysMssg(rxnRecTypes%EPH, 'J', rxnMsgTypes%LNAV, 7, .TRUE. ), & ! 12
    t_typeSysMssg(rxnRecTypes%EPH, 'J', rxnMsgTypes%CNAV, 8, .FALSE.), & ! 13
    t_typeSysMssg(rxnRecTypes%EPH, 'J', rxnMsgTypes%CNV2, 9, .FALSE.), & ! 14
    t_typeSysMssg(rxnRecTypes%EPH, 'I', rxnMsgTypes%LNAV, 7, .TRUE. ), & ! 15

    t_typeSysMssg(rxnRecTypes%STO, 'G', rxnMsgTypes%LNAV, 1, .FALSE.), & ! 16
    t_typeSysMssg(rxnRecTypes%STO, 'G', rxnMsgTypes%CNVX, 1, .FALSE.), & ! 17
    t_typeSysMssg(rxnRecTypes%STO, 'R', rxnMsgTypes%FDMA, 1, .FALSE.), & ! 18
    t_typeSysMssg(rxnRecTypes%STO, 'E', rxnMsgTypes%IFNV, 1, .FALSE.), & ! 19
    t_typeSysMssg(rxnRecTypes%STO, 'S', rxnMsgTypes%SBAS, 1, .FALSE.), & ! 20
    t_typeSysMssg(rxnRecTypes%STO, 'C', rxnMsgTypes%D1D2, 1, .FALSE.), & ! 21
    t_typeSysMssg(rxnRecTypes%STO, 'C', rxnMsgTypes%CNVX, 1, .FALSE.), & ! 22
    t_typeSysMssg(rxnRecTypes%STO, 'J', rxnMsgTypes%LNAV, 1, .FALSE.), & ! 23
    t_typeSysMssg(rxnRecTypes%STO, 'J', rxnMsgTypes%CNVX, 1, .FALSE.), & ! 24
    t_typeSysMssg(rxnRecTypes%STO, 'I', rxnMsgTypes%LNAV, 1, .FALSE.), & ! 25

    t_typeSysMssg(rxnRecTypes%EOP, 'G', rxnMsgTypes%LNAV, 2, .FALSE.), & ! 26
    t_typeSysMssg(rxnRecTypes%EOP, 'G', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 27
    t_typeSysMssg(rxnRecTypes%EOP, 'C', rxnMsgTypes%D1D2, 2, .FALSE.), & ! 28
    t_typeSysMssg(rxnRecTypes%EOP, 'C', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 29
    t_typeSysMssg(rxnRecTypes%EOP, 'J', rxnMsgTypes%LNAV, 2, .FALSE.), & ! 30
    t_typeSysMssg(rxnRecTypes%EOP, 'J', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 31
    t_typeSysMssg(rxnRecTypes%EOP, 'I', rxnMsgTypes%LNAV, 2, .FALSE.), & ! 32

    t_typeSysMssg(rxnRecTypes%ION, 'G', rxnMsgTypes%LNAV, 2, .FALSE.), & ! 33
    t_typeSysMssg(rxnRecTypes%ION, 'G', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 34
    t_typeSysMssg(rxnRecTypes%ION, 'E', rxnMsgTypes%IFNV, 1, .FALSE.), & ! 35
    t_typeSysMssg(rxnRecTypes%ION, 'C', rxnMsgTypes%D1D2, 2, .FALSE.), & ! 36
    t_typeSysMssg(rxnRecTypes%ION, 'C', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 37
    t_typeSysMssg(rxnRecTypes%ION, 'J', rxnMsgTypes%LNAV, 2, .FALSE.), & ! 38
    t_typeSysMssg(rxnRecTypes%ION, 'J', rxnMsgTypes%CNVX, 2, .FALSE.), & ! 39
    t_typeSysMssg(rxnRecTypes%ION, 'I', rxnMsgTypes%LNAV, 2, .FALSE.) ]  ! 40

  ! RINEX navigation data record.
  !
  ! Methods:
  !   init(this)
  !   compare(obj1, obj2)
  !   setLegacyRx2Rx3FromSys(this)
  !   isLegacyRx2Rx3(this)
  !   exportTypeSvMssg(this)
  !   importTypeSvMssg(this, typeSvMssgStr)
  !   calcTypeSysMssgId(this)
  !   hasAnyBadOrUnknowns(this)
  !   hasBad(this)
  !   hasUnknowns(this)
  !   listEvents(this, str)
  !   isHealthy(this)
  !   markUnhealtyAsUnknownAccuracy(this)
  !   satBlk_rxnDataRec(this, iFrq, blkNr)
  !   isRegistered(this)
  !   getGlonassSlotBrd(this)
  !   isWrongFreqNb(this, slotBrd, slotReq)
  !   wrtSysPrnStr(this)
  !   calcBswSatNum(this)
  !   calcSvn(this)
  !   calcOsbs(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnDataRec
    TYPE(t_rxnRecType)        :: recType
    ! -1 if system is unknown for Bernese and shall explicitly be ignorred,
    !    however, rdRxnRecHdr will not deliver such a case.
    ! -2 if sysChr is a white space
    INTEGER(i4b)              :: iSys
    INTEGER(i4b)              :: prn
    TYPE(t_rxnMsgType)        :: msgType

    ! For System Time Offset (STO) messages only
    CHARACTER(LEN=18)         :: stoTimeOffsCode
    CHARACTER(LEN=18)         :: stoSbasId
    CHARACTER(LEN=18)         :: stoUtcId

    ! 0 if no broadcast data source priority was defined
    ! The lower brdDataSrcPrio, the higher the priority
    INTEGER(i4b)              :: brdDataSrcPrio

    ! Time of clock, TOC.
    ! Remains in time system of GNSS, e.g. GPS, UTC or BDT.
    ! This one is directly set from the SV / EPOCH / SV CLK record.
    TYPE(t_epoch)             :: clkEpoOrig
    ! Unified to GPS time system
    TYPE(t_epoch)             :: clkEpoUni

    ! Time of ephemeries, TOE.
    ! Remains in time system of GNSS, e.g. GPS, UTC or BDT.
    TYPE(t_epoch)             :: ephEpoOrig
    ! Unified to GPS time system
    TYPE(t_epoch)             :: ephEpoUni

    ! Time of transmission, TTM.
    ! If it is originally invalid, then it is set to TOE.
    ! Remains in time system of GNSS, e.g. GPS, UTC or BDT.
    TYPE(t_epoch)             :: trmEpoOrig
    ! Unified to GPS time system
    TYPE(t_epoch)             :: trmEpoUni

    TYPE(t_rxnRawRecElems)    :: rawElems
    TYPE(t_rxnBlankRecElems)  :: blankElems
    TYPE(t_rxnTransfOrbElems) :: transfElems
    TYPE(t_rxnBadOrbValCtrs)  :: badValCtrs
    TYPE(t_rxnBadOrbValCtrs)  :: badValChgBtwEpoCtrs
    INTEGER(i4b)              :: unknowns
  END TYPE t_rxnDataRec

  ! Dynamic list of RINEX navigation data records.
  !
  ! With insert you can also build up the array in a sorted manner.
  !
  ! Important details: Method insert sorts according to ephEpo, not clkEpo!
  !                    Method getIdx works relative to ephEpoUni.
  !
  ! Methods:
  !   constr(this, reserveSize)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   reserve(this, reserveSize)
  !   incMyNb(this)
  !   getIdx(this, ephEpoUni)
  !   insertAt(this, toInsert, idx)
  !   insert(this, toInsert, insertMode, insertedIdx)
  !   push_back(this, toAppend)
  !   hasAnyBadOrUnknowns(this)
  !   hasBad(this)
  !   hasUnknowns(this)
  !   isPermanentlyHealthy(this)
  !   isPermanentlyUnhealthy(this)
  !   listUnregisteredEpochs(this)
  !   listWrongFreqNbEpochs(this)
  !   removeAnyBadOrUnknowns(this)
  !   removeUnhealthy(this)
  !   markUnhealtyAsUnknownAccuracy(this)
  !   calcMaxAccuracy(this)
  !   removeUnregistered(this)
  !   removeWrongFreqNbs(this)
  !   wrtUnregisteredToLfnErr(this)
  !   wrtWrongFreqNbsToLfnErr(this)
  !   prt(this)
  TYPE t_rxnDataRecs
    ! Number of lines for the record
    INTEGER(i4b)                              :: nb

    ! The administrated list of navigation data records
    TYPE(t_rxnDataRec), DIMENSION(:), POINTER :: ar
  END TYPE t_rxnDataRecs

  ! Dynamic list of RINEX navigation data records per satellite
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   clear(this)
  !   hasMessages(this)
  !   hasBad(this)
  !   hasUnknowns(this)
  !   calcMaxPrn(this)
  !   calcTotNbOfMsgs(this)
  !   listUnhealthySats(this)
  !   removeUnhealthy(this)
  !   markUnhealtyAsUnknownAccuracy(this)
  !   removeUnregistered(this)
  !   removeWrongFreqNbs(this)
  !   wrtUnregisteredToLfnErr(this)
  !   wrtWrongFreqNbsToLfnErr(this)
  !   prt(this)
  TYPE t_rxnDataRecsPerSat
    TYPE(t_rxnDataRecs), DIMENSION(0:maxRnxPrn) :: ar
  END TYPE t_rxnDataRecsPerSat

  ! Dynamic list of RINEX navigation data records per TYPE / SV / MSSG id
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   clear(this)
  !   hasMessages(this)
  !   hasBad(this)
  !   hasUnknowns(this)
  !   calcTotNbOfMsgs(this)
  !   listUnhealthySats(this)
  !   removeUnhealthy(this)
  !   markUnhealtyAsUnknownAccuracy(this)
  !   removeUnregistered(this)
  !   removeWrongFreqNbs(this)
  !   wrtUnregisteredToLfnErr(this)
  !   wrtWrongFreqNbsToLfnErr(this)
  !   prt(this)
  TYPE t_rxnDataRecsPerTypeSysMssg
    TYPE(t_rxnDataRecsPerSat), DIMENSION(maxTypeSysMssgId) :: ar
  END TYPE t_rxnDataRecsPerTypeSysMssg

  ! A RINEX navigation header and its statistics.
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnHdrAndStat
    TYPE(t_rxnHdr)     :: hdr

    ! Unknown satellites found in observation records
    TYPE(t_stringList) :: unknownSatellites
  END TYPE t_rxnHdrAndStat

  ! Handler for RINEX navitation output files.
  ! Stores information about the output file (name, logical file number),
  ! and its RINEX header.
  !
  ! Methods:
  !   constr(this)
  !   constr(this, lfnOut, outFileName)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnOutHdlr
    TYPE(t_fileHdlr)      :: wrtHdlr
    TYPE(t_rxnHdrAndStat) :: outHdrAndStat
  END TYPE t_rxnOutHdlr

  ! Handler for RINEX navitation input files.
  !
  ! Methods:
  !   constr(this)
  !   constr(this, lfnIn, inpFileName)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnInpHdlr
    ! Information about the input file
    ! (name, logical file number, current line with number)
    TYPE(t_rdHdlr)                            :: rdHdlr

    ! Information about which header records were found
    LOGICAL, DIMENSION(SIZE(rxnHdrLabelList)) :: hdrRecsFound

    ! RINEX header and the corresponding statistics
    TYPE(t_rxnHdrAndStat)                     :: inpHdrAndStat
  END TYPE t_rxnInpHdlr

  ! RINEX navigation configuration entry
  !
  ! Methods:
  !   constr(this)
  !   constr(this, inpKeyName, confValIdx)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   str(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnConfValEntry
    CHARACTER(LEN=keyNameLength) :: inpKeyName
    TYPE(t_rxnConfValIdx)        :: confValIdx
    INTEGER(i4b)                 :: iSys ! -1 for all systems
    TYPE(t_string)               :: blockName
    TYPE(t_stringList)           :: valueStrings
  END TYPE t_rxnConfValEntry

  ! RINEX navigation message limits
  !
  ! Methods:
  !   init(this)
  !   areLimitsDefined(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnLimits
    REAL(r8b), DIMENSION(2) :: minMax
    REAL(r8b)               :: maxAbsChgBtwEpo
    REAL(r8b)               :: addMaxAbsChg_per_s
  END TYPE t_rxnLimits

  ! RINEX navigation message limits per configuration value
  !
  ! Methods:
  !   init(this)
  !   getLimits(this, confValIdx)
  !   setLimits(this, confValIdx, limits)
  !   hasLimits(this, confValIdx)
  !   prt(this, varNam, indent)
  TYPE t_rxnLimitsPerConfVal
    ! Semi-major axis 'a' (min, max), [m]
    TYPE(t_rxnLimits) :: A_m

    ! Norm of sat velocity (min, max), [m/s]
    ! For GLONASS and SBAS/QZSS L1 only
    TYPE(t_rxnLimits) :: velNorm_m_per_s

    ! Node 'Omega0' (min, max), [deg]
    TYPE(t_rxnLimits) :: Omega0_deg

    ! Mean anomaly 'M0' (min, max), [deg]
    TYPE(t_rxnLimits) :: M0_deg

    ! Eccentricity 'e' (min, max), [1]
    TYPE(t_rxnLimits) :: ecc

    ! Inclination 'i0' (min, max), [deg]
    TYPE(t_rxnLimits) :: i0_deg

    ! Perigee 'omega' (min, max), [deg]
    ! For QZSS only
    TYPE(t_rxnLimits) :: omega_deg

    ! Rate of node 'OMEGA DOT' (min, max), [deg/s]
    ! Not for GLONASS or SBAS/QZSS L1
    TYPE(t_rxnLimits) :: OmegaDot_deg_per_s

    ! Correction to mean motion 'Delta n' (min, max), [deg/s]
    ! Not for GLONASS or SBAS/QZSS L1
    TYPE(t_rxnLimits) :: deltaN0_deg_per_s
  END TYPE t_rxnLimitsPerConfVal

  ! Configuration of GNSS block for RINEX navigation messages
  !
  ! Methods:
  !   constr(this)
  !   constr(this, blockName)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnBlockConf
    ! System block name
    TYPE(t_string)              :: blockName

    TYPE(t_reqEpoch)            :: reqEpoch
    TYPE(t_rxnLimitsPerConfVal) :: blockLimits
    TYPE(t_dynIntArr)           :: restrictToPrns
  END TYPE t_rxnBlockConf

  ! Dynamic list for RINEX navigation configuration for one GNSS
  !
  ! Methods:
  !   constr(this, reserveSize)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   nb(this)
  !   clear(this)
  !   reserve(this, reserveSize)
  !   incMyNb(this)
  !   push_back(this, toAppend)
  !   getIdx(this, blockName)
  !   getElemPtr(this, blockName)
  !   prt(this, varNam, indent)
  TYPE t_rxnConfOfSys
    ! Current length of the list
    TYPE(t_nb_rxnType)                          :: nb

    ! The administrated list of GNSS block limits
    TYPE(t_rxnBlockConf), DIMENSION(:), POINTER :: ar
  END TYPE t_rxnConfOfSys

  ! RINEX navigation configuration per GNSS
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnConfPerSys
    TYPE(t_rxnConfOfSys), DIMENSION(0:maxRnxSys -1) :: ar
  END TYPE t_rxnConfPerSys

  ! Configuration for reading RINEX navigation messages.
  !
  ! Methods:
  !   constr(this)
  !   cpyConstr(this, copy)
  !   destr(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnBaseConf
    ! Configuration for reading RINEX header.
    TYPE(t_rnxRdHdrConf)  :: rnxRdHdrConf

    ! Configuration for reading RINEX records.
    !
    ! Remark concerning rnxRdRecConf%actionOnInconsPerHdrVal:
    !   In contrast to RINEX observation files,
    !   RINEX navigation files don't have intermediate partial header entries
    !   between navigation message records.
    TYPE(t_rnxRdRecConf)  :: rnxRdRecConf

    ! Minimal number of navigation messages per system
    TYPE(t_intPerSys)     :: minNavMsgNbrPerSys

    ! GPS broadcast L2 data source priorization (bit encoding)
    TYPE(t_dynIntArr)     :: gpsDataSrcPrio

    ! Galileo broadcast data source priorization (bit encoding)
    ! ()        means no priorization at all
    ! (1)       means I/NAV E1-B navigation messages only
    ! (2)       means F/NAV E5a-I navigation messages only
    ! (4)       means I/NAV E5b-I navigation messages only
    ! (5)       means I/NAV E1-B and E5b-I only, with same priority
    ! (4, 1)    means E1-B and E5b-I, where E5b-I has higher priority
    ! (2, 4, 1) means all messages, E5a-I has highest priority, E1-B has lowest
    TYPE(t_dynIntArr)     :: galDataSrcPrio

    TYPE(t_rxnConfPerSys) :: confPerSys
  END TYPE t_rxnBaseConf

  ! RINEX navigation read configuration
  !
  ! Methods:
  !   init(this)
  !   prt(this, varNam, indent)
  TYPE t_rxnRdConf
    ! Information about which wront header records were already warned
    LOGICAL, DIMENSION(SIZE(rxnHdrLabelList)) :: wrongHdrRecsWarned
  END TYPE t_rxnRdConf

  ! Interfaces to initialize ('construct') or to cpyConstr derived types.
  !
  ! This is meant for derived types which contain PONITERs
  ! or which contain derived types which contain themselfs POINTERs.
  !
  ! In many cases the signature is 'constr(this)',
  ! 'constr(this, reserveSize)', or 'CALL cpyConstr(this, copy)'.
  !
  ! For lists with dynamic memory allocation the dummy variable reserveSize
  ! serves as an initial hint to allocate the array.
  !
  ! For each CALL constr(this, ...) or CALL cpyConstr(this, copy)
  ! a corresponding CALL destr(this) has to be put at the appropriate place.
  !
  ! Best practice: Try to put the CALLs to constr/cpyConstr and destr
  ! in a symmetrical way, either by calling constr in constr,
  ! cpyConstr in cpyConstr and destr in destr
  ! or by pairing constr/cpyConstr with the corresponding destr in the same
  ! program block (PROGRAM, SUBROUTINE, FUNCTIION, loop, ...)
  INTERFACE constr
    MODULE PROCEDURE constr_rxnBaseConf
    MODULE PROCEDURE constr_rxnBlockConf_1
    MODULE PROCEDURE constr_rxnBlockConf_chr
    MODULE PROCEDURE constr_rxnBlockConf_str
    MODULE PROCEDURE constr_rxnConfOfSys
    MODULE PROCEDURE constr_rxnConfPerSys
    MODULE PROCEDURE constr_rxnConfValEntry_1
    MODULE PROCEDURE constr_rxnConfValEntry_2
    MODULE PROCEDURE constr_rxnDataRecs
    MODULE PROCEDURE constr_rxnDataRecsPerSat
    MODULE PROCEDURE constr_rxnDataRecsPerTypeSysMssg
    MODULE PROCEDURE constr_rxnHdr
    MODULE PROCEDURE constr_rxnHdrAndStat
    MODULE PROCEDURE constr_rxnInpHdlr_1
    MODULE PROCEDURE constr_rxnInpHdlr_2
    MODULE PROCEDURE constr_rxnIonCorrsOfSys
    MODULE PROCEDURE constr_rxnIonCorrsPerSys
    MODULE PROCEDURE constr_rxnOutHdlr_1
    MODULE PROCEDURE constr_rxnOutHdlr_2
  END INTERFACE constr

  INTERFACE cpyConstr
    MODULE PROCEDURE cpyConstr_rxnBaseConf
    MODULE PROCEDURE cpyConstr_rxnBlockConf
    MODULE PROCEDURE cpyConstr_rxnConfOfSys
    MODULE PROCEDURE cpyConstr_rxnConfPerSys
    MODULE PROCEDURE cpyConstr_rxnConfValEntry
    MODULE PROCEDURE cpyConstr_rxnDataRecs
    MODULE PROCEDURE cpyConstr_rxnDataRecsPerSat
    MODULE PROCEDURE cpyConstr_rxnDataRecsPerTypeSysMssg
    MODULE PROCEDURE cpyConstr_rxnHdr
    MODULE PROCEDURE cpyConstr_rxnHdrAndStat
    MODULE PROCEDURE cpyConstr_rxnInpHdlr
    MODULE PROCEDURE cpyConstr_rxnIonCorrsOfSys
    MODULE PROCEDURE cpyConstr_rxnIonCorrsPerSys
    MODULE PROCEDURE cpyConstr_rxnOutHdlr
  END INTERFACE cpyConstr

  ! Interface to clean up ('destruct') derived types
  ! which contain themself POINTERs or which contain derived types with POINTERs.
  !
  ! The desired effect is to DEALLOCATE each POINTER in a derived type
  ! and recursively destruct each derived type which are contained in
  ! a derived type.
  !
  ! The signature is 'destr(this)' or 'destr(this)'.
  !
  ! For each constr_{TYPENAME}(...) (above)
  ! a corresponding destr has to be CALLed at the appropriate place.
  !
  ! Best practice: Try to put the CALLs to constr_{TYPENAME}(...) and destr
  ! in a symmetrical way, either by calling constr_ in constr_, destr in destr
  ! or pairing constr_ with the corresponding destr in the same program block
  ! (PROGRAM, SUBROUTINE, FUNCTIION, loop, ...)
  INTERFACE destr
    MODULE PROCEDURE destr_rxnBaseConf
    MODULE PROCEDURE destr_rxnBlockConf
    MODULE PROCEDURE destr_rxnConfOfSys
    MODULE PROCEDURE destr_rxnConfPerSys
    MODULE PROCEDURE destr_rxnConfValEntry
    MODULE PROCEDURE destr_rxnDataRecs
    MODULE PROCEDURE destr_rxnDataRecsPerSat
    MODULE PROCEDURE destr_rxnDataRecsPerTypeSysMssg
    MODULE PROCEDURE destr_rxnHdr
    MODULE PROCEDURE destr_rxnHdrAndStat
    MODULE PROCEDURE destr_rxnInpHdlr
    MODULE PROCEDURE destr_rxnIonCorrsOfSys
    MODULE PROCEDURE destr_rxnIonCorrsPerSys
    MODULE PROCEDURE destr_rxnOutHdlr
  END INTERFACE destr

  ! Interface to initialize simple derived types which don't contain
  ! POINTERs and which don't contain derived types which would contain POINTERs.
  INTERFACE init
    MODULE PROCEDURE init_rxnBadOrbValCtrs
    MODULE PROCEDURE init_rxnBlankRecElems
    MODULE PROCEDURE init_rxnDataRec
    MODULE PROCEDURE init_rxnIonCorr
    MODULE PROCEDURE init_rxnIonCorrId
    MODULE PROCEDURE init_rxnLimits
    MODULE PROCEDURE init_rxnLimitsPerConfVal
    MODULE PROCEDURE init_rxnOsb
    MODULE PROCEDURE init_rxnOsbs
    MODULE PROCEDURE init_rxnRawRecElems
    MODULE PROCEDURE init_rxnRdConf
    MODULE PROCEDURE init_rxnTimSysCorrFromSysToSys
    MODULE PROCEDURE init_rxnTimSysCorrOfSys
    MODULE PROCEDURE init_rxnTransfOrbElems
  END INTERFACE init

  ! Interface to get the number of items in a list if the corresponding
  ! entry in the derived type shall not be modified from outside of the module.
  !
  ! The function 'nb(this)' returns the current number of items in a list
  ! as INTEGER(i4b).
  !
  ! For some derived types the memory management would break if a user would
  ! manipulate the stored number of entries directly by changing %nb.
  !
  ! Therefore the attribute %nb on those members is of TYPE t_nb_rxnType
  ! which is not exported from the module (not PUBLIC).
  INTERFACE nb
    MODULE PROCEDURE nb_rxnConfOfSys
  END INTERFACE nb

  ! Interface to reserve more memory for a list with dynamical memory allocation.
  !
  ! The signature is 'reserve(this, reserveSize)'.
  !
  ! The current size (%nb) of the list is not touched.
  !
  ! If 'reserveSize' is larger than the current size of the underlying
  ! array (SIZE(%ar)), then:
  !   A new array of size 'reserveSize' is allocated,
  !   the used part of the old array (1:%nb) is copied to the new array,
  !   the POINTER (%ar) is switched from the old to the new array
  !   and the old array is deallocated.
  INTERFACE reserve
    MODULE PROCEDURE reserve_rxnConfOfSys
    MODULE PROCEDURE reserve_rxnDataRecs
    MODULE PROCEDURE reserve_rxnIonCorrsOfSys
  END INTERFACE reserve

  ! Interface to increment nb of container and reserve more memory if needed.
  !
  ! The signature is 'incMyNb(this)'.
  INTERFACE incMyNb
    MODULE PROCEDURE incMyNb_rxnConfOfSys
    MODULE PROCEDURE incMyNb_rxnDataRecs
    MODULE PROCEDURE incMyNb_rxnIonCorrsOfSys
  END INTERFACE incMyNb

  ! Interface to clear content.
  !
  ! The signature is 'clear(this)'.
  INTERFACE clear
    MODULE PROCEDURE clear_rxnConfOfSys
    MODULE PROCEDURE clear_rxnDataRecsPerSat
    MODULE PROCEDURE clear_rxnDataRecsPerTypeSysMssg
    MODULE PROCEDURE clear_rxnHdr
    MODULE PROCEDURE clear_rxnIonCorrsOfSys
    MODULE PROCEDURE clear_rxnIonCorrsPerSys
  END INTERFACE clear

  ! Interface to get a value as a string.
  ! The functions str(this) return a string
  ! of appropriate length.
  !
  ! This interface is extensively used e.g.
  !   to perform module tests 'tst_...',
  !   to compose strings via TRIM(str(...))
  !     (e.g. to write error messages with 'wrtToLfnErr' and so on),
  !   to generalize some tasks
  !     (e.g. to register occurences of values with t_idsForKey and t_idsPerKey).
  INTERFACE str
    MODULE PROCEDURE str_rxnConfValEntry
    MODULE PROCEDURE str_rxnOsb
  END INTERFACE str

  ! Interface to write the content of a derived type and its contained
  ! derived types to the standard output in a human readable fashion with
  ! appropriate indentation.
  !
  ! The signature is 'prt(this, varNam, indent)', where varNam serves as a label
  ! and indent is the number of white spaces to indent the content.
  !
  ! If a derived type contains another derived type, then prt of the first type
  ! will contain something like 'CALL prt(this%inner, 'inner', indent +2)'.
  !
  ! This is mainly used for debugging purposes.
  INTERFACE prt
    MODULE PROCEDURE prt_rxnBadOrbValCtrs
    MODULE PROCEDURE prt_rxnBlankRecElems
    MODULE PROCEDURE prt_rxnBlockConf
    MODULE PROCEDURE prt_rxnBaseConf
    MODULE PROCEDURE prt_rxnConfOfSys
    MODULE PROCEDURE prt_rxnConfPerSys
    MODULE PROCEDURE prt_rxnConfValEntry
    MODULE PROCEDURE prt_rxnDataRec
    MODULE PROCEDURE prt_rxnDataRecs
    MODULE PROCEDURE prt_rxnDataRecsPerSat
    MODULE PROCEDURE prt_rxnDataRecsPerTypeSysMssg
    MODULE PROCEDURE prt_rxnHdr
    MODULE PROCEDURE prt_rxnHdrAndStat
    MODULE PROCEDURE prt_rxnInpHdlr
    MODULE PROCEDURE prt_rxnIonCorr
    MODULE PROCEDURE prt_rxnIonCorrId
    MODULE PROCEDURE prt_rxnIonCorrsOfSys
    MODULE PROCEDURE prt_rxnIonCorrsPerSys
    MODULE PROCEDURE prt_rxnLimits
    MODULE PROCEDURE prt_rxnLimitsPerConfVal
    MODULE PROCEDURE prt_rxnRawRecElems
    MODULE PROCEDURE prt_rxnOsbs
    MODULE PROCEDURE prt_rxnOutHdlr
    MODULE PROCEDURE prt_rxnRdConf
    MODULE PROCEDURE prt_rxnTimSysCorrFromSysToSys
    MODULE PROCEDURE prt_rxnTimSysCorrOfSys
    MODULE PROCEDURE prt_rxnTransfOrbElems
  END INTERFACE

  ! Interface to compare values
  !
  ! The signature is compare(obj1, obj2)
  !
  ! Returns
  !   -1 if obj1 < obj2
  !    0 if obj1 == obj2
  !    1 if obj1 > obj2
  INTERFACE compare
    MODULE PROCEDURE compare_rxnDataRec
    MODULE PROCEDURE compare_rxnIonCorrId
  END INTERFACE

  ! Operator interface for equality.
  ! The operation 'obj1 == obj2' returns a LOGICAL.
  INTERFACE OPERATOR(==)
    MODULE PROCEDURE eq_rxnIonCorrId
    MODULE PROCEDURE eq_rxnOsb
    MODULE PROCEDURE eq_rxnOsbs
  END INTERFACE

  ! Operator interface for inequality
  ! The operation 'obj1 /= obj2' returns a LOGICAL.
  INTERFACE OPERATOR(/=)
    MODULE PROCEDURE ne_rxnIonCorrId
    MODULE PROCEDURE ne_rxnOsb
    MODULE PROCEDURE ne_rxnOsbs
  END INTERFACE

  ! Interface to get the index into a list.
  !
  ! The function 'getIdx(this, someKey)' returns an index as INTEGER(i4b).
  ! This index then corresponds to the element '%ar(index)'.
  !
  ! The function returns 0
  ! if 'someKey' doesn't correspond to an entry in the list.
  INTERFACE getIdx
    MODULE PROCEDURE getIdx_rxnConfOfSys
    MODULE PROCEDURE getIdx_rxnDataRecs
    MODULE PROCEDURE getIdx_rxnIonCorrsOfSys
  END INTERFACE

  ! Interface to append a new value to a list.
  !
  ! The signature is 'push_back(this, toAppend)'.
  !
  ! If the list is implemented with dynamical memory management,
  ! 'resize' will be called if the current size of the array would no more fit.
  !
  ! This is also the place where 'cpyConstr' is called if appropriate.
  INTERFACE push_back
    MODULE PROCEDURE push_back_rxnConfOfSys
    MODULE PROCEDURE push_back_rxnDataRecs
    MODULE PROCEDURE push_back_rxnOsbs_1
    MODULE PROCEDURE push_back_rxnOsbs_2
  END INTERFACE

  ! Interface to get an entry of the list which corresponds to 'someKey'.
  !
  ! The function 'getElemPtr(this, someKey)' returns an element.
  !
  ! If 'someKey' doesn't correspond to an entry in the list,
  ! a new entry which corresponds to 'someKey' is appended.
  INTERFACE getElemPtr
    MODULE PROCEDURE getElemPtr_rxnConfOfSys
  END INTERFACE

  ! Interface to insert an element at a specific index.
  !
  ! The signature is 'insertAt(this, toInsert, idx)'.
  !
  ! If idx <= 1,      the behaviour is insertAt(this, toInsert, 1)
  ! If idx > this%nb, the behaviour is insertAt(this, toInsert, this%nb +1)
  !                   which is the same as push_back(this, toAppend)
  INTERFACE insertAt
    MODULE PROCEDURE insertAt_rxnDataRecs
    MODULE PROCEDURE insertAt_rxnIonCorrsOfSys
  END INTERFACE

  ! Interface to insert an element at the appropriate place.
  !
  ! If mode is insertModes%pushBack,
  !   the element is appended at the end. This variant is for convenience.
  ! If mode is insertModes%sortedIfNotYet,
  !   the element is sorted into the container as long as it is not already in.
  !   The element is (silently) not inserted if it is already in the container.
  ! If mode is insertModes%sortedMulti,
  !   the same element can be sorted into the container multiple times
  !   and then also appears multiple times in the container.
  ! If mode is insertModes%sortedUniqe,
  !   the element is sorted into the container.
  !   The same element can be inserted only once,
  !   otherwise the program is stopped with an error message.
  !
  ! The signatures are 'insert(this, toInsert, insertMode)',
  ! and 'insert(this, toInsert, insertMode, insertedIdx)'
  INTERFACE insert
    MODULE PROCEDURE insert_rxnDataRecs
    MODULE PROCEDURE insert_rxnIonCorrsOfSys
  END INTERFACE

  INTERFACE hasMessages
    MODULE PROCEDURE hasMessages_rxnDataRecsPerSat
    MODULE PROCEDURE hasMessages_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE hasAnyBadOrUnknowns
    MODULE PROCEDURE hasAnyBadOrUnknowns_rxnDataRec
    MODULE PROCEDURE hasAnyBadOrUnknowns_rxnDataRecs
  END INTERFACE

  INTERFACE hasBad
    MODULE PROCEDURE hasBad_rxnBadOrbValCtrs
    MODULE PROCEDURE hasBad_rxnDataRec
    MODULE PROCEDURE hasBad_rxnDataRecs
    MODULE PROCEDURE hasBad_rxnDataRecsPerSat
    MODULE PROCEDURE hasBad_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE hasUnknowns
    MODULE PROCEDURE hasUnknowns_rxnDataRec
    MODULE PROCEDURE hasUnknowns_rxnDataRecs
    MODULE PROCEDURE hasUnknowns_rxnDataRecsPerSat
    MODULE PROCEDURE hasUnknowns_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE wrtSysPrnStr
    MODULE PROCEDURE wrtSysPrnStr_rxnDataRec
  END INTERFACE

  INTERFACE calcMaxPrn
    MODULE PROCEDURE calcMaxPrn_rxnDataRecsPerSat
  END INTERFACE

  INTERFACE calcTotNbOfMsgs
    MODULE PROCEDURE calcTotNbOfMsgs_rxnDataRecsPerSat
    MODULE PROCEDURE calcTotNbOfMsgs_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE listUnhealthySats
    MODULE PROCEDURE listUnhealthySats_rxnDataRecsPerSat
    MODULE PROCEDURE listUnhealthySats_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE removeUnhealthy
    MODULE PROCEDURE removeUnhealthy_rxnDataRecs
    MODULE PROCEDURE removeUnhealthy_rxnDataRecsPerSat
    MODULE PROCEDURE removeUnhealthy_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE markUnhealtyAsUnknownAccuracy
    MODULE PROCEDURE markUnhealtyAsUnknownAccuracy_rxnDataRec
    MODULE PROCEDURE markUnhealtyAsUnknownAccuracy_rxnDataRecs
    MODULE PROCEDURE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerSat
    MODULE PROCEDURE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE removeUnregistered
    MODULE PROCEDURE removeUnregistered_rxnDataRecs
    MODULE PROCEDURE removeUnregistered_rxnDataRecsPerSat
    MODULE PROCEDURE removeUnregistered_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE removeWrongFreqNbs
    MODULE PROCEDURE removeWrongFreqNbs_rxnDataRecs
    MODULE PROCEDURE removeWrongFreqNbs_rxnDataRecsPerSat
    MODULE PROCEDURE removeWrongFreqNbs_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE wrtUnregisteredToLfnErr
    MODULE PROCEDURE wrtUnregisteredToLfnErr_rxnDataRecs
    MODULE PROCEDURE wrtUnregisteredToLfnErr_rxnDataRecsPerSat
    MODULE PROCEDURE wrtUnregisteredToLfnErr_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE wrtWrongFreqNbsToLfnErr
    MODULE PROCEDURE wrtWrongFreqNbsToLfnErr_rxnDataRecs
    MODULE PROCEDURE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerSat
    MODULE PROCEDURE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerTypeSysMssg
  END INTERFACE

  INTERFACE calcBswSatNum
    MODULE PROCEDURE calcBswSatNum_rxnDataRec
  END INTERFACE

CONTAINS

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! General PUBLIC subroutines and functions
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE tstModuleRxnType()
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tstModuleRxnType'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, '(1X,A)') 'Test subroutines/functions of module ' // modNam

    CALL tst_rxnBaseConf_mem()
    CALL tst_rxnBlockConf_mem()
    CALL tst_rxnConfOfSys_mem()
    CALL tst_rxnConfPerSys_mem()
    CALL tst_rxnConfValEntry_mem()
    CALL tst_rxnDataRecs_mem()
    CALL tst_rxnDataRecsPerSat_mem()
    CALL tst_rxnDataRecsPerTypeSysMssg_mem()
    CALL tst_rxnHdr_mem()
    CALL tst_rxnHdrAndStat_mem()
    CALL tst_rxnInpHdlr_mem()
    CALL tst_rxnIonCorrsOfSys_mem()
    CALL tst_rxnIonCorrsPerSys_mem()
    CALL tst_rxnOutHdlr_mem()

    CALL tst_compare_rxnDataRec()

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tstModuleRxnType

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnBadOrbValCtrs
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnBadOrbValCtrs(this)
    TYPE(t_rxnBadOrbValCtrs), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnBadOrbValCtrs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%ephemEpochs = 0
    this%semiMajAxis = 0
    this%nodes = 0
    this%rateOfNodes = 0
    this%meanAnomalies = 0
    this%eccentricities = 0
    this%inclinations = 0
    this%perigees = 0
    this%deltaN0s = 0
    this%positions = 0
    this%velocities = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnBadOrbValCtrs

  ! --------------------------------------------------------------------------
  FUNCTION hasBad_rxnBadOrbValCtrs(this) RESULT(res)
    TYPE(t_rxnBadOrbValCtrs), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasBad_rxnBadOrbValCtrs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res =  this%ephemEpochs > 0 &
      .OR. this%semiMajAxis > 0 &
      .OR. this%nodes > 0 &
      .OR. this%rateOfNodes > 0 &
      .OR. this%meanAnomalies > 0 &
      .OR. this%eccentricities > 0 &
      .OR. this%inclinations > 0 &
      .OR. this%perigees > 0 &
      .OR. this%deltaN0s > 0 &
      .OR. this%positions > 0 &
      .OR. this%velocities > 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasBad_rxnBadOrbValCtrs

  ! --------------------------------------------------------------------------
  SUBROUTINE listBad(this, badList)
    TYPE(t_rxnBadOrbValCtrs), INTENT(IN)    :: this
    TYPE(t_string),           INTENT(INOUT) :: badList
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':listBad'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%ephemEpochs > 0) CALL push_back(badList, ' ephemEpochs')
    IF (this%semiMajAxis > 0) CALL push_back(badList, ' semiMajAxis')
    IF (this%nodes > 0) CALL push_back(badList, ' nodes')
    IF (this%rateOfNodes > 0) CALL push_back(badList, ' rateOfNodes')
    IF (this%meanAnomalies > 0) CALL push_back(badList, ' meanAnomalies')
    IF (this%eccentricities > 0) CALL push_back(badList, ' eccentricities')
    IF (this%inclinations > 0) CALL push_back(badList, ' inclinations')
    IF (this%perigees > 0) CALL push_back(badList, ' perigees')
    IF (this%deltaN0s > 0) CALL push_back(badList, ' deltaN0s')
    IF (this%positions > 0) CALL push_back(badList, ' positions')
    IF (this%velocities > 0) CALL push_back(badList, ' velocities')

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listBad

  ! --------------------------------------------------------------------------
  SUBROUTINE addBad(this, badCtrs)
    TYPE(t_rxnBadOrbValCtrs), INTENT(INOUT) :: this
    TYPE(t_rxnBadOrbValCtrs), INTENT(IN)    :: badCtrs
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':addBad'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%ephemEpochs = this%ephemEpochs +badCtrs%ephemEpochs
    this%semiMajAxis = this%semiMajAxis +badCtrs%semiMajAxis
    this%nodes = this%nodes +badCtrs%nodes
    this%rateOfNodes = this%rateOfNodes +badCtrs%rateOfNodes
    this%meanAnomalies = this%meanAnomalies +badCtrs%meanAnomalies
    this%eccentricities = this%eccentricities +badCtrs%eccentricities
    this%inclinations = this%inclinations +badCtrs%inclinations
    this%perigees = this%perigees +badCtrs%perigees
    this%deltaN0s = this%deltaN0s +badCtrs%deltaN0s
    this%positions = this%positions +badCtrs%positions
    this%velocities = this%velocities +badCtrs%velocities

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE addBad

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnBadOrbValCtrs(this, varNam, indent)
    TYPE(t_rxnBadOrbValCtrs), INTENT(IN) :: this
    CHARACTER(LEN=*),         INTENT(IN) :: varNam
    INTEGER(i4b),             INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnBadOrbValCtrs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'ephemEpochs = ' // TRIM(str(this%ephemEpochs))

    WRITE(*, indentFmt(indent +2)) &
      'semiMajAxis = ' // TRIM(str(this%semiMajAxis))

    WRITE(*, indentFmt(indent +2)) &
      'nodes = ' // TRIM(str(this%nodes))

    WRITE(*, indentFmt(indent +2)) &
      'rateOfNodes = ' // TRIM(str(this%rateOfNodes))

    WRITE(*, indentFmt(indent +2)) &
      'meanAnomalies = ' // TRIM(str(this%meanAnomalies))

    WRITE(*, indentFmt(indent +2)) &
      'eccentricities = ' // TRIM(str(this%eccentricities))

    WRITE(*, indentFmt(indent +2)) &
      'inclinations = ' // TRIM(str(this%inclinations))

    WRITE(*, indentFmt(indent +2)) &
      'perigees = ' // TRIM(str(this%perigees))

    WRITE(*, indentFmt(indent +2)) &
      'deltaN0s = ' // TRIM(str(this%deltaN0s))

    WRITE(*, indentFmt(indent +2)) &
      'positions = ' // TRIM(str(this%positions))

    WRITE(*, indentFmt(indent +2)) &
      'velocities = ' // TRIM(str(this%velocities))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnBadOrbValCtrs

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnBaseConf
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnBaseConf(this)
    TYPE(t_rxnBaseConf), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnBaseConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(this%rnxRdHdrConf)

    CALL constr(this%rnxRdRecConf, rxnHdrLabelList, inconsRxnHdrValChkDefs)

    CALL init(this%minNavMsgNbrPerSys, 1)

    CALL constr(this%gpsDataSrcPrio, 0)
    CALL constr(this%galDataSrcPrio, 0)

    CALL constr(this%confPerSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnBaseConf

  ! -------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnBaseConf(this, copy)
    TYPE(t_rxnBaseConf), INTENT(IN)  :: this
    TYPE(t_rxnBaseConf), INTENT(OUT) :: copy
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnBaseConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    copy%minNavMsgNbrPerSys = this%minNavMsgNbrPerSys

    CALL cpyConstr(this%rnxRdHdrConf, copy%rnxRdHdrConf)
    CALL cpyConstr(this%rnxRdRecConf, copy%rnxRdRecConf)
    CALL cpyConstr(this%gpsDataSrcPrio, copy%gpsDataSrcPrio)
    CALL cpyConstr(this%galDataSrcPrio, copy%galDataSrcPrio)
    CALL cpyConstr(this%confPerSys, copy%confPerSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnBaseConf

  ! -------------------------------------------------------------------------
  SUBROUTINE destr_rxnBaseConf(this)
    TYPE(t_rxnBaseConf), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnBaseConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%rnxRdHdrConf)
    CALL destr(this%rnxRdRecConf)
    CALL destr(this%gpsDataSrcPrio)
    CALL destr(this%galDataSrcPrio)
    CALL destr(this%confPerSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnBaseConf

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnBaseConf(this, varNam, indent)
    TYPE(t_rxnBaseConf), INTENT(IN) :: this
    CHARACTER(LEN=*),    INTENT(IN) :: varNam
    INTEGER(i4b),        INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnBaseConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%rnxRdHdrConf, 'rnxRdHdrConf', indent +2)
    CALL prt(this%rnxRdRecConf, 'rnxRdRecConf', indent +2)

    CALL prt(this%minNavMsgNbrPerSys, 'minNavMsgNbrPerSys', indent +2)

    WRITE(*, indentFmt(indent +2)) &
      'gpsDataSrcPrio = ' // TRIM(str(this%gpsDataSrcPrio))

    WRITE(*, indentFmt(indent +2)) &
      'galDataSrcPrio = ' // TRIM(str(this%galDataSrcPrio))

    CALL prt(this%confPerSys, 'confPerSys', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnBaseConf

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnBlankRecElems
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnBlankRecElems(this)
    TYPE(t_rxnBlankRecElems), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnBlankRecElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%ar(:) = .FALSE.

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnBlankRecElems

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnBlankRecElems(this, varNam, indent)
    TYPE(t_rxnBlankRecElems), INTENT(IN) :: this
    CHARACTER(LEN=*),       INTENT(IN) :: varNam
    INTEGER(i4b),           INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnBlankRecElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'ar = ' // TRIM(str(this%ar))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnBlankRecElems

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnBlockConf
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnBlockConf_1(this)
    TYPE(t_rxnBlockConf), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnBlockConf_1'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(this%blockName)
    CALL constr(this%reqEpoch)
    CALL init(this%blockLimits)
    CALL constr(this%restrictToPrns, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnBlockConf_1

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnBlockConf_chr(this, blockName)
    TYPE(t_rxnBlockConf), INTENT(OUT) :: this
    CHARACTER(LEN=*),     INTENT(IN)  :: blockName
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnBlockConf_chr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(this%blockName, blockName)
    CALL constr(this%reqEpoch)
    CALL init(this%blockLimits)
    CALL constr(this%restrictToPrns, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnBlockConf_chr

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnBlockConf_str(this, blockName)
    TYPE(t_rxnBlockConf), INTENT(OUT) :: this
    TYPE(t_string),       INTENT(IN)  :: blockName
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnBlockConf_str'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL cpyConstr(blockName, this%blockName)
    CALL constr(this%reqEpoch)
    CALL init(this%blockLimits)
    CALL constr(this%restrictToPrns, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnBlockConf_str

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnBlockConf(this, copy)
    TYPE(t_rxnBlockConf), INTENT(IN)  :: this
    TYPE(t_rxnBlockConf), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnBlockConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL cpyConstr(this%blockName, copy%blockName)
    CALL cpyConstr(this%reqEpoch, copy%reqEpoch)

    copy%blockLimits = this%blockLimits

    CALL cpyConstr(this%restrictToPrns, copy%restrictToPrns)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnBlockConf

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnBlockConf(this)
    TYPE(t_rxnBlockConf), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnBlockConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%blockName)
    CALL destr(this%reqEpoch)
    CALL destr(this%restrictToPrns)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnBlockConf

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnBlockConf(this, varNam, indent)
    TYPE(t_rxnBlockConf), INTENT(IN) :: this
    CHARACTER(LEN=*),     INTENT(IN) :: varNam
    INTEGER(i4b),         INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnBlockConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam // ', blockName = ' // TRIM(str(this%blockName))

    CALL prt(this%reqEpoch, 'reqEpoch', indent +2)

    CALL prt(this%blockLimits, 'blockLimits', indent +2)

    WRITE(*, indentFmt(indent)) &
      'restrictToPrns = ' // TRIM(str(this%restrictToPrns))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnBlockConf

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnConfOfSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnConfOfSys(this, reserveSize)
    TYPE(t_rxnConfOfSys), INTENT(OUT) :: this
    INTEGER(i4b),         INTENT(IN)  :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnConfOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%nb%nb_priv = 0
    NULLIFY(this%ar)
    CALL reserve(this, reserveSize)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnConfOfSys(this, copy)
    TYPE(t_rxnConfOfSys), INTENT(IN)  :: this
    TYPE(t_rxnConfOfSys), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnConfOfSys'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(copy, this%nb%nb_priv)

    copy%nb%nb_priv = this%nb%nb_priv

    DO idx = 1, this%nb%nb_priv
      CALL cpyConstr(this%ar(idx), copy%ar(idx))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnConfOfSys(this)
    TYPE(t_rxnConfOfSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnConfOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (ASSOCIATED(this%ar)) THEN
      CALL clear(this)
      DEALLOCATE(this%ar)
    ENDIF

    this%nb%nb_priv = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnConfOfSys

  ! --------------------------------------------------------------------------
  INTEGER(i4b) FUNCTION nb_rxnConfOfSys(this) RESULT(nb)
    TYPE(t_rxnConfOfSys), INTENT(IN) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':nb_rxnConfOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    nb = this%nb%nb_priv

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION nb_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnConfOfSys(this)
    TYPE(t_rxnConfOfSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':clear_rxnConfOfSys'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO idx = 1, this%nb%nb_priv
      CALL destr(this%ar(idx))
    ENDDO

    this%nb%nb_priv = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE reserve_rxnConfOfSys(this, reserveSize)
    TYPE(t_rxnConfOfSys), INTENT(INOUT) :: this
    INTEGER(i4b),         INTENT(IN)    :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':reserve_rxnConfOfSys'

    ! Local variables
    TYPE(t_rxnBlockConf), DIMENSION(:), POINTER :: copy

    INTEGER(i4b) :: iac, idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (.NOT. ASSOCIATED(this%ar)) THEN
      ALLOCATE (this%ar(reserveSize), STAT = iac)
      CALL alcErr(iac, 'this%ar', [reserveSize], srName)

    ELSEIF (SIZE(this%ar) < reserveSize) THEN
      ALLOCATE (copy(reserveSize), STAT = iac)
      CALL alcErr(iac, 'copy', [reserveSize], srName)

      DO idx = 1, this%nb%nb_priv
        CALL cpyConstr(this%ar(idx), copy(idx))
        CALL destr(this%ar(idx))
      ENDDO

      DEALLOCATE(this%ar)

      this%ar => copy
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE reserve_rxnConfOfSys

  ! -------------------------------------------------------------------------
  SUBROUTINE incMyNb_rxnConfOfSys(this)
    TYPE(t_rxnConfOfSys), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':incMyNb_rxnConfOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%nb%nb_priv >= SIZE(this%ar)) THEN
      CALL reserve(this, calcNextSize(this%nb%nb_priv))
    ENDIF

    this%nb%nb_priv = this%nb%nb_priv +1

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE incMyNb_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE push_back_rxnConfOfSys(this, toAppend)
    TYPE(t_rxnConfOfSys), INTENT(INOUT) :: this
    TYPE(t_rxnBlockConf), INTENT(IN)    :: toAppend
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':push_back_rxnConfOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL incMyNb(this)

    CALL cpyConstr(toAppend, this%ar(this%nb%nb_priv))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE push_back_rxnConfOfSys

  ! --------------------------------------------------------------------------
  FUNCTION getIdx_rxnConfOfSys(this, searchKey) RESULT(res)
    TYPE(t_rxnConfOfSys), INTENT(IN) :: this
    CHARACTER(LEN=*),     INTENT(IN) :: searchKey

    ! Returns 0 if not found
    INTEGER(i4b) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getIdx_rxnConfOfSys'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = 0

    DO idx = 1, this%nb%nb_priv
      IF (this%ar(idx)%blockName == searchKey) THEN
        res = idx
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getIdx_rxnConfOfSys

  ! --------------------------------------------------------------------------
  FUNCTION getElemPtr_rxnConfOfSys(this, searchKey) RESULT(getElemPtr)
    TYPE(t_rxnConfOfSys), TARGET, INTENT(INOUT) :: this
    CHARACTER(LEN=*),             INTENT(IN)    :: searchKey

    ! Returns:
    TYPE(t_rxnBlockConf), POINTER :: getElemPtr
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getElemPtr_rxnConfOfSys'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(getElemPtr)

    idx = getIdx(this, searchKey)

    IF (idx > 0) THEN
      getElemPtr => this%ar(idx)
    ELSE
      CALL incMyNb(this)
      getElemPtr => this%ar(this%nb%nb_priv)
      CALL constr(getElemPtr, searchKey)
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getElemPtr_rxnConfOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnConfOfSys(this, varNam, indent)
    TYPE(t_rxnConfOfSys), INTENT(IN) :: this
    CHARACTER(LEN=*),     INTENT(IN) :: varNam
    INTEGER(i4b),         INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnConfOfSys'

    ! Local variables
    INTEGER(i4b) :: iLine

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam // ': nb = ' // TRIM(str(this%nb%nb_priv))

    DO iLine = 1, this%nb%nb_priv
      CALL prt(this%ar(iLine), 'ar(' // TRIM(str(iLine)) // ')', indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnConfOfSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnConfPerSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnConfPerSys(this)
    TYPE(t_rxnConfPerSys), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnConfPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL constr(this%ar(iSys), 3)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnConfPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnConfPerSys(this, copy)
    TYPE(t_rxnConfPerSys), INTENT(IN)  :: this
    TYPE(t_rxnConfPerSys), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnConfPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL cpyConstr(this%ar(iSys), copy%ar(iSys))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnConfPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnConfPerSys(this)
    TYPE(t_rxnConfPerSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnConfPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL destr(this%ar(iSys))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnConfPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnConfPerSys(this, varNam, indent)
    TYPE(t_rxnConfPerSys), INTENT(IN) :: this
    CHARACTER(LEN=*),      INTENT(IN) :: varNam
    INTEGER(i4b),          INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnConfPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    DO iSys = 0, maxRnxSys -1
      CALL prt(this%ar(iSys), 'ar(' // TRIM(str(iSys)) // ')', indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnConfPerSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnConfValEntry
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnConfValEntry_1(this)
    TYPE(t_rxnConfValEntry), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnConfValEntry_1'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%inpKeyName = ''
    this%confValIdx = rxnConfValIds%None
    this%iSys = -2

    CALL constr(this%blockName)
    CALL constr(this%valueStrings, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnConfValEntry_1

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnConfValEntry_2(this, inpKeyName, confValIdx)
    TYPE(t_rxnConfValEntry), INTENT(OUT) :: this
    CHARACTER(LEN=*),        INTENT(IN)  :: inpKeyName
    TYPE(t_rxnConfValIdx),   INTENT(IN)  :: confValIdx
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnConfValEntry_2'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%inpKeyName = inpKeyName
    this%confValIdx = confValIdx
    this%iSys = -2

    CALL constr(this%blockName)
    CALL constr(this%valueStrings, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnConfValEntry_2

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnConfValEntry(this, copy)
    TYPE(t_rxnConfValEntry), INTENT(IN)  :: this
    TYPE(t_rxnConfValEntry), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':cpyConstr_rxnConfValEntry'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    copy%inpKeyName = this%inpKeyName
    copy%confValIdx = this%confValIdx
    copy%iSys = this%iSys

    CALL cpyConstr(this%blockName, copy%blockName)
    CALL cpyConstr(this%valueStrings, copy%valueStrings)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnConfValEntry

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnConfValEntry(this)
    TYPE(t_rxnConfValEntry), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnConfValEntry'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%blockName)
    CALL destr(this%valueStrings)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnConfValEntry

  ! --------------------------------------------------------------------------
  FUNCTION str_rxnConfValEntry(this) RESULT(res)
    TYPE(t_rxnConfValEntry), INTENT(IN) :: this

    ! Returns
    CHARACTER(LEN=longLineLength) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':str_rxnConfValEntry'

    ! Local variables
    INTEGER(i4b) :: posToAppend

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = ''
    posToAppend = 1

    CALL appendStr(res, posToAppend, &
      'inpKeyName = ' // TRIM(this%inpKeyName) &
      // ', confValIdx = ' // TRIM(str(this%confValIdx)) &
      // ', satellite system = ' // TRIM(getSysStr(this%iSys)) &
      // ', blockName = ' // TRIM(str(this%blockName)) &
      // ', valueStrings = ' // TRIM(str(this%valueStrings)))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION str_rxnConfValEntry

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnConfValEntry(this, varNam, indent)
    TYPE(t_rxnConfValEntry), INTENT(IN) :: this
    CHARACTER(LEN=*),        INTENT(IN) :: varNam
    INTEGER(i4b),            INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnConfValEntry'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'inpKeyName = ' // this%inpKeyName

    WRITE(*, indentFmt(indent +2)) &
      'confValIdx = ' // TRIM(str(this%confValIdx))

    WRITE(*, indentFmt(indent +2)) &
      'iSys = ' // TRIM(str(this%iSys)) &
      // ' => satellite system = ' // TRIM(getSysStr(this%iSys))

    WRITE(*, indentFmt(indent +2)) &
      'blockName = ' // TRIM(str(this%blockName))

    CALL prt(this%valueStrings, 'valueStrings', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnConfValEntry

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnDataRec
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnDataRec(this)
    TYPE(t_rxnDataRec), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%recType          = rxnRecTypes%unknown
    this%iSys             = -2
    this%prn              = -1
    this%msgType          = rxnMsgTypes%unknown
    this%stoTimeOffsCode  = ''
    this%stoSbasId        = ''
    this%stoUtcId         = ''
    this%brdDataSrcPrio   = 0

    CALL init(this%clkEpoOrig)
    CALL init(this%clkEpoUni)
    CALL init(this%ephEpoOrig)
    CALL init(this%ephEpoUni)
    CALL init(this%trmEpoOrig)
    CALL init(this%trmEpoUni)
    CALL init(this%rawElems)
    CALL init(this%blankElems)
    CALL init(this%transfElems)
    CALL init(this%badValCtrs)
    CALL init(this%badValChgBtwEpoCtrs)

    this%unknowns = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION exportTypeSvMssg(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns e.g. '> EPH G01 LNAV'
    CHARACTER(LEN=14) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':exportTypeSvMssg'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = '> ' // str(this%recType) // ' ' &
      // wrtSysPrnStr(this) // ' ' // str(this%msgType)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION exportTypeSvMssg

  ! --------------------------------------------------------------------------
  FUNCTION importTypeSvMssg(this, typeSvMssgStr) RESULT(succeeded)
    TYPE(t_rxnDataRec), INTENT(INOUT) :: this

    ! E.g. '> EPH G01 LNAV'
    CHARACTER(LEN=*),   INTENT(IN)    :: typeSvMssgStr

    ! Returns
    LOGICAL :: succeeded
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':importTypeSvMssg'

    ! Local variables
    CHARACTER(LEN=14) :: typeSvMssgStrCpy

    INTEGER(i4b) :: ios

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    typeSvMssgStrCpy = &
      typeSvMssgStr(1:MIN(LEN(typeSvMssgStr), LEN(typeSvMssgStrCpy)))

    succeeded = typeSvMssgStrCpy(1:1) == '>'

    this%recType = parseRxnRecType(typeSvMssgStrCpy(3:5))

    succeeded = succeeded .AND. this%recType /= rxnRecTypes%unknown

    ! -1 if system is unknown for Bernese and shall explicitly be ignorred
    ! -2 if sysChr is a white space
    this%iSys = getAndChkSysNbr(typeSvMssgStrCpy(7:7), .TRUE.)

    READ(typeSvMssgStrCpy(8:9), '(I2)', ioStat = ios) this%prn
    succeeded = succeeded .AND. ios == 0

    this%msgType = parseRxnMsgType(typeSvMssgStrCpy(10:))

    succeeded = succeeded .AND. this%msgType /= rxnMsgTypes%unknown

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION importTypeSvMssg

  ! --------------------------------------------------------------------------
  SUBROUTINE setLegacyRx2Rx3FromSys(this)
    TYPE(t_rxnDataRec), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':setLegacyRx2Rx3FromSys'

    ! Local variables
    TYPE(t_typeSysMssg) :: typeSysMssg

    CHARACTER(LEN=1) :: sysChr

    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%recType = rxnRecTypes%EPH
    this%msgType = rxnMsgTypes%unknown

    IF (this%iSys < 0 .OR. this%iSys >= maxRnxSys) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    sysChr = g_svnSys(this%iSys)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      typeSysMssg = typeSysMssgs(typeSysMssgId)

      IF (typeSysMssg%recType /= rxnRecTypes%EPH) CYCLE
      IF (typeSysMssg%sysChr /= sysChr) CYCLE

      IF (typeSysMssg%legacy) THEN
        this%msgType = typeSysMssg%msgType
        EXIT
      ENDIF

    ENDDO

    ! Legacy BeiDou ephemeries need a special treating.
    ! - D1 is for MEO and IGSO,
    ! - D2 for GEO
    IF (this%msgType == rxnMsgTypes%D1D2) THEN
      ! TODO: Recognize GEO and put them to D2 instead of D1
      this%msgType = rxnMsgTypes%D1
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE setLegacyRx2Rx3FromSys

  ! --------------------------------------------------------------------------
  FUNCTION isLegacyRx2Rx3(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isLegacyRx2Rx3'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    IF (this%recType /= rxnRecTypes%EPH) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    typeSysMssgId = calcTypeSysMssgId(this)

    IF (typeSysMssgId <= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = typeSysMssgs(typeSysMssgId)%legacy

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isLegacyRx2Rx3

  ! --------------------------------------------------------------------------
  FUNCTION calcTypeSysMssgId(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns 1 to maxTypeSysMssgId, 0 if failed
    INTEGER(I4b) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcTypeSysMssgId'

    ! Local variables
    TYPE(t_typeSysMssg) :: typeSysMssg

    ! BeiDou needs a tweak
    TYPE(t_rxnMsgType) :: msgType

    CHARACTER(LEN=1) :: sysChr

    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = 0

    IF (this%iSys < 0 .OR. this%iSys >= maxRnxSys) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    sysChr = g_svnSys(this%iSys)

    msgType = this%msgType

    ! BeiDou legacy ephemeries records need special handling.
    IF (msgType == rxnMsgTypes%D1 .OR. msgType == rxnMsgTypes%D2) THEN
      msgType = rxnMsgTypes%D1D2
    ENDIF

    DO typeSysMssgId = 1, maxTypeSysMssgId
      typeSysMssg = typeSysMssgs(typeSysMssgId)

      IF (typeSysMssg%recType /= this%recType) CYCLE
      IF (typeSysMssg%sysChr /= sysChr) CYCLE

      IF (typeSysMssg%msgType == msgType) THEN
        res = typeSysMssgId
        EXIT
      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcTypeSysMssgId

  ! --------------------------------------------------------------------------
  FUNCTION hasAnyBadOrUnknowns_rxnDataRec(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasAnyBadOrUnknowns_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = hasBad(this%badValCtrs) &
      .OR. hasBad(this%badValChgBtwEpoCtrs) &
      .OR. hasUnknowns(this)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasAnyBadOrUnknowns_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION hasBad_rxnDataRec(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasBad_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = hasBad(this%badValCtrs) .OR. hasBad(this%badValChgBtwEpoCtrs)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasBad_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION hasUnknowns_rxnDataRec(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasUnknowns_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = this%unknowns > 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasUnknowns_rxnDataRec

  ! --------------------------------------------------------------------------
  SUBROUTINE listEvents(this, eventsList)
    TYPE(t_rxnDataRec), INTENT(IN)    :: this
    TYPE(t_string),     INTENT(INOUT) :: eventsList
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':listEvents'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%unknowns > 0) CALL push_back(eventsList, ' unknowns')

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listEvents

  ! --------------------------------------------------------------------------
  FUNCTION isHealthy(this) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isHealthy'

    ! Local variables
    CHARACTER(LEN=1) :: sysChr

    INTEGER(i4b) :: unhealthy

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%recType /= rxnRecTypes%EPH) THEN
      res = .TRUE.
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    unhealthy = this%transfElems%health

    sysChr = g_svnSys(this%iSys)

    SELECT CASE (sysChr)

      CASE ('G', 'J')
        ! GPS, QZSS
        IF (this%msgType == rxnMsgTypes%CNAV) THEN
          unhealthy = IAND(unhealthy, 1 + 2 + 4)
        ELSEIF(this%msgType == rxnMsgTypes%CNV2) THEN
          unhealthy = IAND(unhealthy, 1)
        ELSE ! LNAV, L1NV
          unhealthy = IAND(unhealthy, 1 + 2 + 4 + 8 + 16 + 32)
        ENDIF

      CASE ('R')
        ! GLONASS
        unhealthy = IAND(unhealthy, 1) ! BROADCAST ORBIT - 1

      CASE ('E')
        ! Galileo
        unhealthy = IAND(unhealthy, 1 + 8 + 64)

      CASE ('S')
        ! SBAS
        IF (IAND(unhealthy, 16) > 0) THEN
          ! No health information available, see e.g. recommendation in specification
          ! RINEX 4.01, 5.4.7 EPH Navigation message for SBAS satellites
          unhealthy = 0
        ELSE
          unhealthy = IAND(unhealthy, 1 + 2 + 4 + 8)
        ENDIF

      CASE ('C')
        ! BeiDou
        IF (this%msgType == rxnMsgTypes%CNV1 &
          .OR. this%msgType == rxnMsgTypes%CNV2 &
          .OR. this%msgType == rxnMsgTypes%CNV3) THEN

          unhealthy = IAND(unhealthy, 1 + 2)
        ELSE ! D1, D2
          unhealthy = IAND(unhealthy, 1)
        ENDIF

      CASE ('I')
        ! IRNSS
        unhealthy = IAND(unhealthy, 1 + 2)

      CASE DEFAULT
        CALL wrtSrErrToLfnErr(srName, &
          "Dear programmer: Case for system character '" // sysChr // "' not handled")
        CALL exitRc(2)

    END SELECT

    res = unhealthy == 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isHealthy


  ! --------------------------------------------------------------------------
  SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRec(this)
    TYPE(t_rxnDataRec), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':markUnhealtyAsUnknownAccuracy_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%recType /= rxnRecTypes%EPH) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    IF (.NOT. isHealthy(this)) this%transfElems%accuracy_m = 0d0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRec

  ! --------------------------------------------------------------------------
  SUBROUTINE satBlk_rxnDataRec(this, iFrq, blkNr)
  ! --------------------------------------------------------------------------
  ! Reads SATELL file
  ! --------------------------------------------------------------------------
    TYPE(t_rxnDataRec), INTENT(IN)  :: this
    INTEGER(i4b),       INTENT(OUT) :: iFrq
    INTEGER(i4b),       INTENT(OUT) :: blkNr
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':satBlk_rxnDataRec'

    ! Local variables
    INTEGER(i4b) :: satNum

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    iFrq  = 0
    blkNr = -1

    IF (this%iSys < 0 .OR. this%iSys >= maxSvnSys &
      .OR. this%prn < 0 .OR. this%prn > maxRnxPrn) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    satNum = calcBswSatNum(this)

    ! Reads SATELL file
    CALL satBlk(satNum, .epochToReal. (this%clkEpoUni), iFrq, blkNr)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE satBlk_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION isRegistered(this) RESULT(res)
  ! --------------------------------------------------------------------------
  ! Reads SATELL file
  ! --------------------------------------------------------------------------
    TYPE(t_rxnDataRec), INTENT(IN) :: this
    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isRegistered'

    ! Local variables
    INTEGER(i4b) :: blkNr, slotReq

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    ! Reads SATELL file
    CALL satBlk_rxnDataRec(this, slotReq, blkNr)

    res = blkNr /= 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isRegistered

  ! --------------------------------------------------------------------------
  FUNCTION getGlonassSlotBrd(this) RESULT(slotBrd)
    TYPE(t_rxnDataRec), INTENT(IN)  :: this

    ! Returns
    ! 0 if system is not GLONASS
    INTEGER(i4b) :: slotBrd
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getGlonassSlotBrd'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (g_svnSys(this%iSys) == 'R') THEN

      slotBrd = FLOOR(this%rawElems%ar(rxnOrbValIds%FreqNb_Accuracy%oi))

      ! TODO: This line stems from GTBRDG.f.
      !       No clue about it's consequences.
      IF (slotBrd > 24) slotBrd = slotBrd -256

    ELSE

      slotBrd = 0

    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getGlonassSlotBrd

  ! --------------------------------------------------------------------------
  FUNCTION isWrongFreqNb(this, slotBrd, slotReq) RESULT(res)
  ! --------------------------------------------------------------------------
  ! Reads SATELL file
  ! --------------------------------------------------------------------------
    TYPE(t_rxnDataRec), INTENT(IN)  :: this
    INTEGER(i4b),       INTENT(OUT) :: slotBrd
    INTEGER(i4b),       INTENT(OUT) :: slotReq

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isWrongFreqNb'

    ! Local variables
    INTEGER(i4b) :: blkNr

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (g_svnSys(this%iSys) /= 'R') THEN
      res = .FALSE.
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    ! From here on: GLONASS only

    slotBrd = getGlonassSlotBrd(this)

    ! Reads SATELL file
    CALL satBlk_rxnDataRec(this, slotReq, blkNr)

    res = blkNr /= 0 .AND. slotBrd /= slotReq

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isWrongFreqNb

  ! --------------------------------------------------------------------------
  FUNCTION compare_rxnDataRec(obj1, obj2) RESULT(res)
    TYPE(t_rxnDataRec), INTENT(IN) :: obj1, obj2

    ! Returns
    !   -1 if obj1 < obj2
    !    0 if obj1 == obj2
    !    1 if obj1 > obj2
    INTEGER(i4b) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':compare_rxnDataRec'

    ! Local variables
    LOGICAL :: hasBad1, hasBad2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = compare(obj1%recType%rt, obj2%recType%rt)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = compare(obj1%iSys, obj2%iSys)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = compare(obj1%prn, obj2%prn)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = compare(obj1%msgType%mt, obj2%msgType%mt)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    ! a younger (larger) ephemeris epoch has more weight
    res = compare(obj1%ephEpoOrig, obj2%ephEpoOrig)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    hasBad1 = hasBad(obj1)
    hasBad2 = hasBad(obj2)

    IF (hasBad1 .AND. (.NOT. hasBad2)) THEN
      ! obj2 has more weight since it has no bad values
      res = -1
    ELSEIF((.NOT. hasBad1) .AND. hasBad2) THEN
      ! obj1 has more weight since it has no bad values
      res = 1
    ENDIF

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    ! Lower value has higher weight
    res = MIN(MAX(obj2%brdDataSrcPrio -obj1%brdDataSrcPrio, -1), 1)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = compare(obj1%trmEpoOrig, obj2%trmEpoOrig)

    IF (res /= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = compare(obj1%clkEpoOrig, obj2%clkEpoOrig)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION compare_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION wrtSysPrnStr_rxnDataRec(this) RESULT(sysPrnStr)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns blank prn (sys char only) if this%prn <= 0
    CHARACTER(LEN=3) :: sysPrnStr
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':wrtSysPrnStr_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%prn > 0) THEN
      sysPrnStr = wrtSysPrnStr(this%iSys, this%prn)
    ELSE
      sysPrnStr = g_svnSys(this%iSys)
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION wrtSysPrnStr_rxnDataRec

  ! --------------------------------------------------------------------------
  PURE FUNCTION calcBswSatNum_rxnDataRec(this) RESULT(satNum)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    INTEGER(i4b) :: satNum
  ! --------------------------------------------------------------------------

    satNum = calcBswSatNum(this%iSys, this%prn)

    RETURN
  END FUNCTION calcBswSatNum_rxnDataRec

  ! --------------------------------------------------------------------------
  FUNCTION calcSvn(this) RESULT(svn)
    TYPE(t_rxnDataRec), INTENT(IN) :: this

    ! Returns
    CHARACTER(LEN=4) :: svn
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcSvn'

    ! Local variables
    TYPE(t_timInt) :: timInt

    INTEGER(i4b) :: irc

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL prn2svn( &
      0, calcBswSatNum(this), .epochToReal. this%clkEpoUni, svn, timInt, irc)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcSvn

  ! --------------------------------------------------------------------------
  FUNCTION calcOsbs(this) RESULT(osbs)
    TYPE(t_rxnDataRec), INTENT(IN)  :: this

    ! Returns
    TYPE(t_rxnOsbs) :: osbs
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcOsbs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(osbs)

    IF (.NOT. isLegacyRx2Rx3(this)) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    SELECT CASE (g_svnSys(this%iSys))

      CASE ('G')
        CALL calcOsbs_G(this, osbs)

      ! CASE ('R')
        ! Necessairy \delta \tau _N is not delivered by RINEX V2/V3 for GLONASS

      CASE ('E')
        CALL calcOsbs_E(this, osbs)

      ! CASE ('S')
        ! No information for SBAS

      CASE ('C')
        CALL calcOsbs_C(this, osbs)

      ! CASE ('J')
        ! QZSS doesn't transmit any information

      ! CASE ('I')
        ! No frequencies for IRNSS in CONST file

      CASE DEFAULT

    END SELECT

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcOsbs

  ! --------------------------------------------------------------------------
  SUBROUTINE calcOsbs_G(this, osbs)
    TYPE(t_rxnDataRec), INTENT(IN)    :: this
    TYPE(t_rxnOsbs),    INTENT(INOUT) :: osbs
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcOsbs_G'

    ! Local variables
    REAL(r8b) :: f1sqr, f2sqr, tgd

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    f1sqr = SATFRQ%freq(1) **2 ! f_1^2
    f2sqr = SATFRQ%freq(2) **2 ! f_2^2

    tgd = this%rawElems%ar(rxnOrbValIds%TGD_BGDE5a_TGD1_SISAIoc1%oi)

    CALL push_back(osbs, 'C1W', 0d0)
    CALL push_back(osbs, 'C2W', tgd *(f1sqr - f2sqr) /f2sqr)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE calcOsbs_G

  ! --------------------------------------------------------------------------
  SUBROUTINE calcOsbs_E(this, osbs)
    TYPE(t_rxnDataRec), INTENT(IN)    :: this
    TYPE(t_rxnOsbs),    INTENT(INOUT) :: osbs
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcOsbs_E'

    ! Local variables
    REAL(r8b) :: bgd_E5a_E1, bgd_E5b_E1, f1sqr, f5aSqr, f5bSqr

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(osbs)

    f1sqr  = SATFRQ%freqE(1) **2 ! f_1^2
    f5aSqr = SATFRQ%freqE(3) **2 ! f_{5a}^2
    f5bSqr = SATFRQ%freqE(4) **2 ! f_{5b}^2

    bgd_E5a_E1 = this%rawElems%ar(rxnOrbValIds%TGD_BGDE5a_TGD1_SISAIoc1%oi)

    bgd_E5b_E1 = &
      this%rawElems%ar(rxnOrbValIds%IODC1_BGDE5b_TGD2_URAINED2_SISAIoc2%oi)

    CALL push_back(osbs, 'C1C', 0d0)
    CALL push_back(osbs, 'C5Q', bgd_E5a_E1 *(f1sqr - f5aSqr) /f5aSqr)
    CALL push_back(osbs, 'C7Q', bgd_E5b_E1 *(f1sqr - f5bSqr) /f5bSqr)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE calcOsbs_E

  ! --------------------------------------------------------------------------
  SUBROUTINE calcOsbs_C(this, osbs)
    TYPE(t_rxnDataRec), INTENT(IN)    :: this
    TYPE(t_rxnOsbs),    INTENT(INOUT) :: osbs
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcOsbs_C'

    ! Local variables
    REAL(r8b) :: tgd1, tgd2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(osbs)

    tgd1 = this%rawElems%ar(rxnOrbValIds%TGD_BGDE5a_TGD1_SISAIoc1%oi)
    tgd2 = this%rawElems%ar(rxnOrbValIds%IODC1_BGDE5b_TGD2_URAINED2_SISAIoc2%oi)

    CALL push_back(osbs, 'C6I', 0d0)
    CALL push_back(osbs, 'C2I', tgd1)
    CALL push_back(osbs, 'C7I', tgd2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE calcOsbs_C

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnDataRec(this, varNam, indent)
    TYPE(t_rxnDataRec), INTENT(IN) :: this
    CHARACTER(LEN=*),   INTENT(IN) :: varNam
    INTEGER(i4b),       INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnDataRec'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'recType = ' // TRIM(str(this%recType))

    WRITE(*, indentFmt(indent +2)) &
      'iSys = ' // TRIM(str(this%iSys))

    WRITE(*, indentFmt(indent +2)) &
      'prn = ' // TRIM(str(this%prn))

    WRITE(*, indentFmt(indent +2)) &
      'msgType = ' // TRIM(str(this%msgType))

    WRITE(*, indentFmt(indent +2)) &
      'stoTimeOffsCode = ' // TRIM(this%stoTimeOffsCode)

    WRITE(*, indentFmt(indent +2)) &
      'stoSbasId = ' // TRIM(this%stoSbasId)

    WRITE(*, indentFmt(indent +2)) &
      'stoUtcId = ' // TRIM(this%stoUtcId)

    WRITE(*, indentFmt(indent +2)) &
      'brdDataSrcPrio = ' // TRIM(str(this%brdDataSrcPrio))

    CALL prt(this%clkEpoOrig, 'clkEpoOrig', indent +2)
    CALL prt(this%clkEpoUni, 'clkEpoUni', indent +2)
    CALL prt(this%ephEpoOrig, 'ephEpoOrig', indent +2)
    CALL prt(this%ephEpoUni, 'ephEpoUni', indent +2)
    CALL prt(this%trmEpoOrig, 'trmEpoOrig', indent +2)
    CALL prt(this%trmEpoUni, 'trmEpoUni', indent +2)
    CALL prt(this%rawElems, 'rawElems', indent +2)
    CALL prt(this%blankElems, 'blankElems', indent +2)
    CALL prt(this%transfElems, 'transfElems', indent +2)
    CALL prt(this%badValCtrs, 'badValCtrs', indent +2)
    CALL prt(this%badValChgBtwEpoCtrs, 'badValChgBtwEpoCtrs', indent +2)

    WRITE(*, indentFmt(indent +2)) &
      'unknowns = ' // TRIM(str(this%unknowns))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnDataRec

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnDataRecs
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnDataRecs(this, reserveSize)
    TYPE(t_rxnDataRecs), INTENT(OUT) :: this
    INTEGER(i4b),        INTENT(IN)  :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnDataRecs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%nb = 0
    NULLIFY(this%ar)
    CALL reserve(this, reserveSize)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnDataRecs(this, copy)
    TYPE(t_rxnDataRecs), INTENT(IN)  :: this
    TYPE(t_rxnDataRecs), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnDataRecs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(copy, this%nb)

    copy%nb = this%nb
    copy%ar(1:this%nb) = this%ar(1:this%nb)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnDataRecs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (ASSOCIATED(this%ar)) DEALLOCATE(this%ar)

    this%nb = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE reserve_rxnDataRecs(this, reserveSize)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
    INTEGER(i4b),        INTENT(IN)    :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':reserve_rxnDataRecs'

    ! Local variables
    TYPE(t_rxnDataRec), DIMENSION(:), POINTER :: copy

    INTEGER(i4b) :: iac

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (.NOT. ASSOCIATED(this%ar)) THEN
      ALLOCATE (this%ar(reserveSize), STAT = iac)
      CALL alcErr(iac, 'this%ar', [reserveSize], srName)

    ELSEIF (SIZE(this%ar) < reserveSize) THEN
      ALLOCATE (copy(reserveSize), STAT = iac)
      CALL alcErr(iac, 'copy', [reserveSize], srName)

      copy(1:this%nb) = this%ar(1:this%nb)

      DEALLOCATE(this%ar)

      this%ar => copy
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE reserve_rxnDataRecs

  ! -------------------------------------------------------------------------
  SUBROUTINE incMyNb_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':incMyNb_rxnDataRecs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%nb >= SIZE(this%ar)) THEN
      CALL reserve(this, calcNextSize(this%nb))
    ENDIF

    this%nb = this%nb +1

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE incMyNb_rxnDataRecs

  ! -------------------------------------------------------------------------
  FUNCTION getIdx_rxnDataRecs(this, ephEpoUni) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this
    TYPE(t_epoch),       INTENT(IN) :: ephEpoUni

    ! Returns 0 if not found
    INTEGER(i4b) :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getIdx_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = 0

    DO idx = 1, this%nb
      IF (this%ar(idx)%ephEpoUni == ephEpoUni) THEN
        res = idx
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getIdx_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE push_back_rxnDataRecs(this, toAppend)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
    TYPE(t_rxnDataRec),  INTENT(IN)    :: toAppend
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':push_back_rxnDataRecs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL incMyNb(this)

    this%ar(this%nb) = toAppend

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE push_back_rxnDataRecs

  ! -------------------------------------------------------------------------
  SUBROUTINE insertAt_rxnDataRecs(this, toInsert, idx)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
    TYPE(t_rxnDataRec),  INTENT(IN)    :: toInsert
    INTEGER(i4b),        INTENT(IN)    :: idx
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':insertAt_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: saveIdx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL incMyNb(this)

    saveIdx = MAX(1, MIN(this%nb, idx))

    ! TYPE t_rxnDataRec is directly copyable
    this%ar(saveIdx +1:this%nb) = this%ar(saveIdx:this%nb -1)

    this%ar(saveIdx) = toInsert

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN

  END SUBROUTINE insertAt_rxnDataRecs

  ! -------------------------------------------------------------------------
  SUBROUTINE insert_rxnDataRecs(this, toInsert, insertMode, insertedIdx)
    TYPE(t_rxnDataRecs),    INTENT(INOUT) :: this
    TYPE(t_rxnDataRec),     INTENT(IN)    :: toInsert
    TYPE(t_insertMode),     INTENT(IN)    :: insertMode
    INTEGER(i4b), OPTIONAL, INTENT(OUT)   :: insertedIdx
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':insert_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: idx, insertIdx

    LOGICAL :: exitLoop

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    insertIdx = this%nb +1

    DO idx = 1, this%nb

      exitLoop = chkIfExitLoop( &
        insertIdx, idx, compare(this%ar(idx)%ephEpoOrig, toInsert%ephEpoOrig), &
        insertMode, srName)

      IF (exitLoop) EXIT

    ENDDO

    IF (insertIdx > 0) CALL insertAt(this, toInsert, insertIdx)

    IF (PRESENT(insertedIdx)) insertedIdx = insertIdx

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN

  END SUBROUTINE insert_rxnDataRecs

  ! --------------------------------------------------------------------------
  FUNCTION hasAnyBadOrUnknowns_rxnDataRecs(this) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasAnyBadOrUnknowns_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO iRec = 1, this%nb
      res = hasAnyBadOrUnknowns(this%ar(iRec))

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasAnyBadOrUnknowns_rxnDataRecs

  ! --------------------------------------------------------------------------
  FUNCTION hasBad_rxnDataRecs(this) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasBad_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO iRec = 1, this%nb
      res = hasBad(this%ar(iRec))

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasBad_rxnDataRecs

  ! --------------------------------------------------------------------------
  FUNCTION hasUnknowns_rxnDataRecs(this) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasUnknowns_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO iRec = 1, this%nb
      res = hasUnknowns(this%ar(iRec))

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasUnknowns_rxnDataRecs

  ! -------------------------------------------------------------------------
  FUNCTION isPermanentlyHealthy(this) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns
    ! .TRUE. if no data records
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isPermanentlyHealthy'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .TRUE.

    DO idx = 1, this%nb
      IF (.NOT. isHealthy(this%ar(idx))) THEN
        res = .FALSE.
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isPermanentlyHealthy

  ! -------------------------------------------------------------------------
  FUNCTION isPermanentlyUnhealthy(this) RESULT(res)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns
    ! .FALSE. if no data records
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':isPermanentlyUnhealthy'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%nb <= 0) THEN
      res = .FALSE.
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    res = .TRUE.

    DO idx = 1, this%nb
      IF (isHealthy(this%ar(idx))) THEN
        res = .FALSE.
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION isPermanentlyUnhealthy

  ! -------------------------------------------------------------------------
  SUBROUTINE listUnregisteredEpochs(this, epoStrs)
    TYPE(t_rxnDataRecs), TARGET, INTENT(IN)    :: this
    TYPE(t_stringList2),         INTENT(INOUT) :: epoStrs
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':listUnregisteredEpochs'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    CHARACTER(LEN=19) :: fromEpoStr

    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    IF (this%nb <= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    fromEpoStr = ''

    DO idx = 1, this%nb

      rxnDataRec => this%ar(idx)

      IF (isRegistered(rxnDataRec)) THEN
        CALL closeEpoIntervall(rxnDataRec%ephEpoUni, fromEpoStr, epoStrs, '')
        fromEpoStr = ''
      ELSEIF (fromEpoStr == '') THEN
        CALL timSt2(1, rxnDataRec%ephEpoUni, fromEpoStr)
      ENDIF

    ENDDO

    CALL closeEpoIntervall(this%ar(this%nb)%ephEpoUni, fromEpoStr, epoStrs, '')

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listUnregisteredEpochs

  ! -------------------------------------------------------------------------
  SUBROUTINE listWrongFreqNbEpochs(this, msgs)
  ! -------------------------------------------------------------------------
  ! List msgs will be empty for other systems than GLONASS
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecs), TARGET, INTENT(IN)    :: this
    TYPE(t_stringList2),         INTENT(INOUT) :: msgs
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':listWrongFreqNbEpochs'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    CHARACTER(LEN=90) :: lastMsg, currMsg
    CHARACTER(LEN=19) :: fromEpoStr

    INTEGER(i4b) :: slotBrd, slotReq, idx

    LOGICAL :: isWrong

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    IF (this%nb <= 0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    fromEpoStr = ''
    lastMsg = ''

    DO idx = 1, this%nb

      rxnDataRec => this%ar(idx)

      isWrong = isWrongFreqNb(rxnDataRec, slotBrd, slotReq)

      IF (isWrong) THEN
        currMsg = "broadcast frequency slot (" // TRIM(str(slotBrd)) &
          // ") does not correspond to requested frequency slot (" &
          // TRIM(str(slotReq)) // ")"
      ELSE
        currMsg = ''
      ENDIF

      IF (currMsg /= lastMsg) THEN
        CALL closeEpoIntervall(rxnDataRec%ephEpoUni, fromEpoStr, msgs, lastMsg)
        fromEpoStr = ''
      ENDIF

      IF (isWrong .AND. fromEpoStr == '') THEN
        CALL timSt2(1, rxnDataRec%ephEpoUni, fromEpoStr)
      ENDIF

      lastMsg = currMsg

    ENDDO

    CALL closeEpoIntervall( &
      this%ar(this%nb)%ephEpoUni, fromEpoStr, msgs, lastMsg)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listWrongFreqNbEpochs

  ! -------------------------------------------------------------------------
  SUBROUTINE removeAnyBadOrUnknowns(this)
    TYPE(t_rxnDataRecs), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeAnyBadOrUnknowns'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    INTEGER(i4b) :: oldNb, iDataRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    oldNb = this%nb

    this%nb = 0

    DO iDataRec = 1, oldNb

      rxnDataRec => this%ar(iDataRec)

      IF (.NOT. hasAnyBadOrUnknowns(rxnDataRec)) THEN
        CALL push_back(this, rxnDataRec)
      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeAnyBadOrUnknowns

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnhealthy_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnhealthy_rxnDataRecs'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    INTEGER(i4b) :: oldNb, iDataRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    oldNb = this%nb

    this%nb = 0

    DO iDataRec = 1, oldNb

      rxnDataRec => this%ar(iDataRec)

      IF (isHealthy(rxnDataRec)) THEN
        CALL push_back(this, rxnDataRec)
      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnhealthy_rxnDataRecs

  ! -------------------------------------------------------------------------
  SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':markUnhealtyAsUnknownAccuracy_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: iDataRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iDataRec = 1, this%nb
      CALL markUnhealtyAsUnknownAccuracy(this%ar(iDataRec))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecs

  ! -------------------------------------------------------------------------
  FUNCTION calcMaxAccuracy(this) RESULT(maxAccuracy_m)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this

    ! Returns maximal accuracy [m] or 0d0 if there are any unknown accuracies
    REAL(r8b) :: maxAccuracy_m
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':calcMaxAccuracy'

    ! Local variables
    REAL(r8b) :: accuracy_m

    INTEGER(i4b) :: iDataRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    maxAccuracy_m = 0d0

    DO iDataRec = 1, this%nb
      accuracy_m = this%ar(iDataRec)%transfElems%accuracy_m

      IF (accuracy_m <= 0) THEN
        ! Interpreted as unknown accuracy
        maxAccuracy_m = 0d0
        EXIT
      ENDIF

      maxAccuracy_m = MAX(maxAccuracy_m, accuracy_m)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcMaxAccuracy

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnregistered_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnregistered_rxnDataRecs'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    INTEGER(i4b) :: oldNb, iDataRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    oldNb = this%nb

    this%nb = 0

    DO iDataRec = 1, oldNb

      rxnDataRec => this%ar(iDataRec)

      IF (isRegistered(rxnDataRec)) THEN
        CALL push_back(this, rxnDataRec)
      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnregistered_rxnDataRecs

  ! -------------------------------------------------------------------------
  SUBROUTINE removeWrongFreqNbs_rxnDataRecs(this)
  ! -------------------------------------------------------------------------
  ! Calling removeWrongFreqNbs for other systems than GLONASS has no effect
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecs), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeWrongFreqNbs_rxnDataRecs'

    ! Local variables
    TYPE(t_rxnDataRec), POINTER :: rxnDataRec

    INTEGER(i4b) :: slotBrd, slotReq, iDataRec, oldNb

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRec)

    oldNb = this%nb

    this%nb = 0

    DO iDataRec = 1, oldNb

      rxnDataRec => this%ar(iDataRec)

      IF (.NOT. isWrongFreqNb(rxnDataRec, slotBrd, slotReq)) THEN
        CALL push_back(this, rxnDataRec)
      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeWrongFreqNbs_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecs(this)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtUnregisteredToLfnErr_rxnDataRecs'

    ! Local variables
    TYPE(t_stringList2) :: epoStrs

    CHARACTER(LEN=3) :: sysPrnStr

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL listUnregisteredEpochs(this, epoStrs)

    IF (epoStrs%nb() > 0) THEN

      sysPrnStr = wrtSysPrnStr(this%ar(1))

      CALL wrtSrWarnToLfnErr(srName, &
        'Satellite ' // sysPrnStr &
        // ' not registered in satellite information file', &
        ' Epochs: ' // TRIM(epoStrs%str()))

    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecs(this)
  ! --------------------------------------------------------------------------
  ! No effect for other systems than GLONASS
  ! --------------------------------------------------------------------------
    TYPE(t_rxnDataRecs), INTENT(IN) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtWrongFreqNbsToLfnErr_rxnDataRecs'

    ! Local variables
    TYPE(t_stringList2) :: msgs

    CHARACTER(LEN=3) :: sysPrnStr

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL listWrongFreqNbEpochs(this, msgs)

    IF (msgs%nb() > 0) THEN

      sysPrnStr = wrtSysPrnStr(this%ar(1))

      CALL msgs%insertAt( &
        'Satellite ' // sysPrnStr &
        // ' has inconsistent frequency slot numbers:', &
        1)

      CALL wrtSrWarnToLfnErr(srName, msgs)

    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecs

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnDataRecs(this, varNam, indent)
    TYPE(t_rxnDataRecs), INTENT(IN) :: this
    CHARACTER(LEN=*),    INTENT(IN) :: varNam
    INTEGER(i4b),        INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnDataRecs'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    DO iRec = 1, this%nb
      CALL prt(this%ar(iRec), 'ar(' // TRIM(str(iRec)) // ')', indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnDataRecs

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnDataRecsPerSat
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL constr(this%ar(prn), 0)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnDataRecsPerSat(this, copy)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN)  :: this
    TYPE(t_rxnDataRecsPerSat), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':cpyConstr_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL cpyConstr(this%ar(prn), copy%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL destr(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':clear_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      this%ar(prn)%nb = 0
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  FUNCTION hasMessages_rxnDataRecsPerSat(this) RESULT(res)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasMessages_rxnDataRecsPerSat'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO prn = 0, maxRnxPrn
      res = this%ar(prn)%nb > 0

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasMessages_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  FUNCTION hasBad_rxnDataRecsPerSat(this) RESULT(res)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasBad_rxnDataRecsPerSat'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO prn = 0, maxRnxPrn
      res = hasBad(this%ar(prn))

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasBad_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  FUNCTION hasUnknowns_rxnDataRecsPerSat(this) RESULT(res)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasUnknowns_rxnDataRecsPerSat'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO prn = 0, maxRnxPrn
      res = hasUnknowns(this%ar(prn))

      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasUnknowns_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  FUNCTION calcMaxPrn_rxnDataRecsPerSat(this) RESULT(maxPrn)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this

    ! Returns -1 if no satellite.
    INTEGER(i4b) :: maxPrn
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':calcMaxPrn_rxnDataRecsPerSat'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    maxPrn = -1

    DO prn = maxRnxPrn, 0, -1
      IF (this%ar(prn)%nb > 0) THEN
        maxPrn = prn
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcMaxPrn_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  FUNCTION calcTotNbOfMsgs_rxnDataRecsPerSat(this) RESULT(totNbOfMsgs)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this

    ! Returns
    INTEGER(i4b) :: totNbOfMsgs
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':calcTotNbOfMsgs_rxnDataRecsPerSat'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    totNbOfMsgs = 0

    DO prn = 0, maxRnxPrn
      totNbOfMsgs = totNbOfMsgs +this%ar(prn)%nb
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcTotNbOfMsgs_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE listUnhealthySats_rxnDataRecsPerSat( &
    iSys, this, permanentlyUnh, temporarilyUnh)

    INTEGER(i4b),                      INTENT(IN)    :: iSys
    TYPE(t_rxnDataRecsPerSat), TARGET, INTENT(IN)    :: this
    TYPE(t_stringList2),               INTENT(INOUT) :: permanentlyUnh
    TYPE(t_stringList2),               INTENT(INOUT) :: temporarilyUnh
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':listUnhealthySats_rxnDataRecsPerSat'

    ! Local variables
    TYPE(t_rxnDataRecs), POINTER :: rxnDataRecs

    CHARACTER(LEN=3)  :: sysPrnStr

    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    NULLIFY(rxnDataRecs)

    DO prn = 0, maxRnxPrn
      rxnDataRecs => this%ar(prn)

      sysPrnStr = wrtSysPrnStr(iSys, prn)

      IF (isPermanentlyUnhealthy(rxnDataRecs)) THEN

        CALL permanentlyUnh%push_back(sysPrnStr)

      ELSEIF (.NOT. isPermanentlyHealthy(rxnDataRecs)) THEN

        CALL temporarilyUnh%push_back(sysPrnStr)

      ENDIF

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listUnhealthySats_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnhealthy_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnhealthy_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL removeUnhealthy(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnhealthy_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':markUnhealtyAsUnknownAccuracy_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL markUnhealtyAsUnknownAccuracy(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnregistered_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnregistered_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL removeUnregistered(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnregistered_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE removeWrongFreqNbs_rxnDataRecsPerSat(this)
  ! -------------------------------------------------------------------------
  ! Calling removeWrongFreqNbs for other systems than GLONASS has no effect
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecsPerSat), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeWrongFreqNbs_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL removeWrongFreqNbs(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeWrongFreqNbs_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecsPerSat(this)
    TYPE(t_rxnDataRecsPerSat), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtUnregisteredToLfnErr_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL wrtUnregisteredToLfnErr(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecsPerSat

  ! -------------------------------------------------------------------------
  SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerSat(this)
  ! -------------------------------------------------------------------------
  ! No effect for other systems than GLONASS
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecsPerSat), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtWrongFreqNbsToLfnErr_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO prn = 0, maxRnxPrn
      CALL wrtWrongFreqNbsToLfnErr(this%ar(prn))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerSat

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnDataRecsPerSat(this, varNam, indent)
    TYPE(t_rxnDataRecsPerSat), INTENT(IN) :: this
    CHARACTER(LEN=*),          INTENT(IN) :: varNam
    INTEGER(i4b),              INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnDataRecsPerSat'

    ! Local variables
    INTEGER(i4b) :: prn

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) varNam

    DO prn = 0, maxRnxPrn
      CALL prt(this%ar(prn), 'ar(' // TRIM(str(prn)) // ')', indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnDataRecsPerSat

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnDataRecsPerTypeSysMssg
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':constr_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL constr(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnDataRecsPerTypeSysMssg(this, copy)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN)  :: this
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':cpyConstr_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL cpyConstr(this%ar(typeSysMssgId), copy%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':destr_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL destr(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':clear_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL clear(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  FUNCTION hasMessages_rxnDataRecsPerTypeSysMssg(this) RESULT(res)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasMessages_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO typeSysMssgId = 1, maxTypeSysMssgId
      res = hasMessages(this%ar(typeSysMssgId))
      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasMessages_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  FUNCTION hasBad_rxnDataRecsPerTypeSysMssg(this) RESULT(res)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN) :: this
    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasBad_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO typeSysMssgId = 1, maxTypeSysMssgId
      res = hasBad(this%ar(typeSysMssgId))
      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasBad_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  FUNCTION hasUnknowns_rxnDataRecsPerTypeSysMssg(this) RESULT(res)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':hasUnknowns_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    DO typeSysMssgId = 1, maxTypeSysMssgId
      res = hasUnknowns(this%ar(typeSysMssgId))
      IF (res) EXIT
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasUnknowns_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  FUNCTION calcTotNbOfMsgs_rxnDataRecsPerTypeSysMssg(this) RESULT(totNbOfMsgs)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN) :: this
    ! Returns
    INTEGER(i4b) :: totNbOfMsgs
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':calcTotNbOfMsgs_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    ! ---------------
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    totNbOfMsgs = 0

    DO typeSysMssgId = 1, maxTypeSysMssgId
      totNbOfMsgs = totNbOfMsgs + calcTotNbOfMsgs(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION calcTotNbOfMsgs_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE listUnhealthySats_rxnDataRecsPerTypeSysMssg( &
    this, permanentlyUnh, temporarilyUnh)

    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN)    :: this
    TYPE(t_stringList2),               INTENT(INOUT) :: permanentlyUnh
    TYPE(t_stringList2),               INTENT(INOUT) :: temporarilyUnh
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':listUnhealthySats_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: iSys, typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      iSys = getSysNbr(typeSysMssgs(typeSysMssgId)%sysChr)
      IF (iSys < 0) CYCLE
      CALL listUnhealthySats( &
        iSys, this%ar(typeSysMssgId), permanentlyUnh, temporarilyUnh)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE listUnhealthySats_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnhealthy_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnhealthy_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL removeUnhealthy(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnhealthy_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':markUnhealtyAsUnknownAccuracy_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL markUnhealtyAsUnknownAccuracy(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE markUnhealtyAsUnknownAccuracy_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE removeUnregistered_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeUnregistered_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL removeUnregistered(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeUnregistered_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE removeWrongFreqNbs_rxnDataRecsPerTypeSysMssg(this)
  ! -------------------------------------------------------------------------
  ! Calling removeWrongFreqNbs for other systems than GLONASS has no effect
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecsPerTypeSysMssg), TARGET, INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':removeWrongFreqNbs_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      IF (typeSysMssgs(typeSysMssgId)%sysChr /= 'R') CYCLE
      CALL removeWrongFreqNbs(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE removeWrongFreqNbs_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecsPerTypeSysMssg(this)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtUnregisteredToLfnErr_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL wrtUnregisteredToLfnErr(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtUnregisteredToLfnErr_rxnDataRecsPerTypeSysMssg

  ! -------------------------------------------------------------------------
  SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerTypeSysMssg(this)
  ! -------------------------------------------------------------------------
  ! No effect for other systems than GLONASS
  ! -------------------------------------------------------------------------
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':wrtWrongFreqNbsToLfnErr_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO typeSysMssgId = 1, maxTypeSysMssgId
      IF (typeSysMssgs(typeSysMssgId)%sysChr /= 'R') CYCLE
      CALL wrtWrongFreqNbsToLfnErr(this%ar(typeSysMssgId))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE wrtWrongFreqNbsToLfnErr_rxnDataRecsPerTypeSysMssg

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnDataRecsPerTypeSysMssg(this, varNam, indent)
    TYPE(t_rxnDataRecsPerTypeSysMssg), INTENT(IN) :: this
    CHARACTER(LEN=*),                  INTENT(IN) :: varNam
    INTEGER(i4b),                      INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':prt_rxnDataRecsPerTypeSysMssg'

    ! Local variables
    INTEGER(i4b) :: typeSysMssgId

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) varNam

    DO typeSysMssgId = 1, maxTypeSysMssgId
      CALL prt( &
        this%ar(typeSysMssgId), 'typeSysMssgId = ' // str(typeSysMssgId), indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnDataRecsPerTypeSysMssg

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnHdr
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnHdr(this)
    TYPE(t_rxnHdr), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnHdr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(this%genData)

    this%nbMergedFiles = -1

    CALL init(this%leapSecs)
    CALL constr(this%ionCorrsPerSys)
    CALL init(this%timSysCorrFromSysToSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnHdr

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnHdr(this, copy)
    TYPE(t_rxnHdr), INTENT(IN)  :: this
    TYPE(t_rxnHdr), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnHdr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL cpyConstr(this%genData, copy%genData)

    copy%nbMergedFiles = this%nbMergedFiles
    copy%leapSecs      = this%leapSecs

    CALL cpyConstr(this%ionCorrsPerSys, copy%ionCorrsPerSys)

    copy%timSysCorrFromSysToSys = this%timSysCorrFromSysToSys

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnHdr

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnHdr(this)
    TYPE(t_rxnHdr), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnHdr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%genData)
    CALL destr(this%ionCorrsPerSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnHdr

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnHdr(this)
    TYPE(t_rxnHdr), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':clear_rxnHdr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL clear(this%genData)

    this%nbMergedFiles = -1

    CALL init(this%leapSecs)
    CALL clear(this%ionCorrsPerSys)
    CALL init(this%timSysCorrFromSysToSys)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnHdr

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnHdr(this, varNam, indent)
    TYPE(t_rxnHdr),   INTENT(IN) :: this
    CHARACTER(LEN=*), INTENT(IN) :: varNam
    INTEGER(i4b),     INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnHdr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%genData, 'genData', indent +2)

    WRITE(*, indentFmt(indent)) &
      varNam // 'nbMergedFiles = ' // str(this%nbMergedFiles)

    CALL prt(this%leapSecs, 'leapSecs', indent +2)
    CALL prt(this%ionCorrsPerSys, 'ionCorrsPerSys', indent +2)
    CALL prt(this%timSysCorrFromSysToSys, 'timSysCorrFromSysToSys', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnHdr

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnHdrAndStat
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnHdrAndStat(this)
    TYPE(t_rxnHdrAndStat), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnHdrAndStat'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(this%hdr)
    CALL constr(this%unknownSatellites, 0)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnHdrAndStat

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnHdrAndStat(this, copy)
    TYPE(t_rxnHdrAndStat), INTENT(IN)  :: this
    TYPE(t_rxnHdrAndStat), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnHdrAndStat'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL cpyConstr(this%hdr, copy%hdr)
    CALL cpyConstr(this%unknownSatellites, copy%unknownSatellites)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnHdrAndStat

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnHdrAndStat(this)
    TYPE(t_rxnHdrAndStat), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnHdrAndStat'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%hdr)
    CALL destr(this%unknownSatellites)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnHdrAndStat

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnHdrAndStat(this, varNam, indent)
    TYPE(t_rxnHdrAndStat), INTENT(IN) :: this
    CHARACTER(LEN=*),      INTENT(IN) :: varNam
    INTEGER(i4b),          INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnHdrAndStat'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%hdr, 'hdr', indent +2)
    CALL prt(this%unknownSatellites, 'unknownSatellites', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnHdrAndStat

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnInpHdlr
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnInpHdlr_1(this)
    TYPE(t_rxnInpHdlr), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnInpHdlr_1'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%rdHdlr)

    this%hdrRecsFound(:) = .FALSE.

    CALL constr(this%inpHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnInpHdlr_1

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnInpHdlr_2(this, lfnIn, inpFileName)
    TYPE(t_rxnInpHdlr), INTENT(OUT) :: this
    INTEGER(i4b),       INTENT(IN)  :: lfnIn
    CHARACTER(LEN=*),   INTENT(IN)  :: inpFileName
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnInpHdlr_2'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%rdHdlr, lfnIn, inpFileName)

    this%hdrRecsFound(:) = .FALSE.

    CALL constr(this%inpHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnInpHdlr_2

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnInpHdlr(this, copy)
    TYPE(t_rxnInpHdlr), INTENT(IN)  :: this
    TYPE(t_rxnInpHdlr), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnInpHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    copy%rdHdlr = this%rdHdlr

    copy%hdrRecsFound(:) = this%hdrRecsFound(:)

    CALL cpyConstr(this%inpHdrAndStat, copy%inpHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnInpHdlr

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnInpHdlr(this)
    TYPE(t_rxnInpHdlr), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnInpHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%inpHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnInpHdlr

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnInpHdlr(this, varNam, indent)
    TYPE(t_rxnInpHdlr), INTENT(IN) :: this
    CHARACTER(LEN=*),   INTENT(IN) :: varNam
    INTEGER(i4b),       INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnInpHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'hdrRecsFound = ' // TRIM(str(this%hdrRecsFound))

    CALL prt(this%rdHdlr, 'rdHdlr', indent +2)
    CALL prt(this%inpHdrAndStat, 'inpHdrAndStat', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnInpHdlr

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnIonCorr
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnIonCorr(this)
    TYPE(t_rxnIonCorr), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnIonCorr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%id)

    this%parameters(:) = 0d0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnIonCorr

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnIonCorr(this, varNam, indent)
    TYPE(t_rxnIonCorr), INTENT(IN) :: this
    CHARACTER(LEN=*),   INTENT(IN) :: varNam
    INTEGER(i4b),       INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnIonCorr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%id, 'id', indent +2)

    WRITE(*, indentFmt(indent +2)) &
      'parameters = ' // TRIM(str(this%parameters))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnIonCorr

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnIonCorrId
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnIonCorrId(this)
    TYPE(t_rxnIonCorrId), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnIonCorrId'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%transmissionTime = ''
    this%svId = 0
    this%falseForAlphas_trueForBetas = .FALSE.

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnIonCorrId

  ! -------------------------------------------------------------------------
  FUNCTION compare_rxnIonCorrId(obj1, obj2) RESULT(res)
    TYPE(t_rxnIonCorrId), INTENT(IN) :: obj1, obj2

    ! Returns
    !   -1 if obj1 < obj2
    !    0 if obj1 == obj2
    !    1 if obj1 > obj2
    INTEGER(i4b) :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':compare_rxnIonCorrId'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (obj1%transmissionTime < obj2%transmissionTime) THEN
      res = -1
    ELSEIF (obj1%transmissionTime > obj2%transmissionTime) THEN
      res = 1
    ELSEIF (obj1%svId < obj2%svId) THEN
      res = -1
    ELSEIF (obj1%svId > obj2%svId) THEN
      res = 1
    ELSEIF (.NOT. obj1%falseForAlphas_trueForBetas &
      .AND. obj2%falseForAlphas_trueForBetas) THEN
      res = -1
    ELSEIF (obj1%falseForAlphas_trueForBetas &
      .AND. .NOT. obj2%falseForAlphas_trueForBetas) THEN
      res = 1
    ELSE
      res = 0
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION compare_rxnIonCorrId

  ! -------------------------------------------------------------------------
  FUNCTION eq_rxnIonCorrId(obj1, obj2) RESULT(res)
    TYPE(t_rxnIonCorrId), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':eq_rxnIonCorrId'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = compare(obj1, obj2) == 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION eq_rxnIonCorrId

  ! -------------------------------------------------------------------------
  FUNCTION ne_rxnIonCorrId(obj1, obj2) RESULT(res)
    TYPE(t_rxnIonCorrId), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':ne_rxnIonCorrId'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .NOT. obj1 == obj2

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION ne_rxnIonCorrId

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnIonCorrId(this, varNam, indent)
    TYPE(t_rxnIonCorrId), INTENT(IN) :: this
    CHARACTER(LEN=*),     INTENT(IN) :: varNam
    INTEGER(i4b),         INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnIonCorrId'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam // ', transmissionTime = ' // TRIM(this%transmissionTime)

    WRITE(*, indentFmt(indent +2)) &
      'svId = ' // TRIM(str(this%svId))

    WRITE(*, indentFmt(indent +2)) &
      'falseForAlphas_trueForBetas = ' &
      // TRIM(str(this%falseForAlphas_trueForBetas))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnIonCorrId

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnIonCorrsOfSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnIonCorrsOfSys(this, reserveSize)
    TYPE(t_rxnIonCorrsOfSys), INTENT(OUT) :: this
    INTEGER(i4b),             INTENT(IN)  :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnIonCorrsOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%nb = 0
    NULLIFY(this%ar)
    CALL reserve(this, reserveSize)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnIonCorrsOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnIonCorrsOfSys(this, copy)
    TYPE(t_rxnIonCorrsOfSys), INTENT(IN)  :: this
    TYPE(t_rxnIonCorrsOfSys), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':cpyConstr_rxnIonCorrsOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(copy, this%nb)

    copy%nb = this%nb
    copy%ar(1:this%nb) = this%ar(1:this%nb)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnIonCorrsOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnIonCorrsOfSys(this)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnIonCorrsOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (ASSOCIATED(this%ar)) DEALLOCATE(this%ar)

    this%nb = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnIonCorrsOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnIonCorrsOfSys(this)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':clear_rxnIonCorrsOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%nb = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnIonCorrsOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE reserve_rxnIonCorrsOfSys(this, reserveSize)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
    INTEGER(i4b),             INTENT(IN)    :: reserveSize
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':reserve_rxnIonCorrsOfSys'

    ! Local variables
    TYPE(t_rxnIonCorr), DIMENSION(:), POINTER :: copy

    INTEGER(i4b) :: iac

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (.NOT. ASSOCIATED(this%ar)) THEN
      ALLOCATE (this%ar(reserveSize), STAT = iac)
      CALL alcErr(iac, 'this%ar', [reserveSize], srName)

    ELSEIF (SIZE(this%ar) < reserveSize) THEN
      ALLOCATE (copy(reserveSize), STAT = iac)
      CALL alcErr(iac, 'copy', [reserveSize], srName)

      copy(1:this%nb) = this%ar(1:this%nb)

      DEALLOCATE(this%ar)

      this%ar => copy
    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE reserve_rxnIonCorrsOfSys

  ! -------------------------------------------------------------------------
  SUBROUTINE incMyNb_rxnIonCorrsOfSys(this)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':incMyNb_rxnIonCorrsOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%nb >= SIZE(this%ar)) THEN
      CALL reserve(this, calcNextSize(this%nb))
    ENDIF

    this%nb = this%nb +1

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE incMyNb_rxnIonCorrsOfSys

  ! -------------------------------------------------------------------------
  FUNCTION getIdx_rxnIonCorrsOfSys(this, rxnIonCorrId) RESULT(res)
    TYPE(t_rxnIonCorrsOfSys), INTENT(IN) :: this
    TYPE(t_rxnIonCorrId),     INTENT(IN) :: rxnIonCorrId

    ! Returns 0 if not found
    INTEGER(i4b) :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getIdx_rxnIonCorrsOfSys'

    ! Local variables
    INTEGER(i4b) :: idx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = 0

    DO idx = 1, this%nb
      IF (this%ar(idx)%id == rxnIonCorrId) THEN
        res = idx
        EXIT
      ENDIF
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getIdx_rxnIonCorrsOfSys

  ! -------------------------------------------------------------------------
  SUBROUTINE insertAt_rxnIonCorrsOfSys(this, toInsert, idx)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
    TYPE(t_rxnIonCorr),       INTENT(IN)    :: toInsert
    INTEGER(i4b),             INTENT(IN)    :: idx
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':insertAt_rxnIonCorrsOfSys'

    ! Local variables
    INTEGER(i4b) :: saveIdx

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL incMyNb(this)

    saveIdx = MAX(1, MIN(this%nb, idx))

    ! TYPE t_rxnIonCorr is directly copyable
    this%ar(saveIdx +1:this%nb) = this%ar(saveIdx:this%nb -1)

    this%ar(saveIdx) = toInsert

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN

  END SUBROUTINE insertAt_rxnIonCorrsOfSys

  ! -------------------------------------------------------------------------
  SUBROUTINE insert_rxnIonCorrsOfSys(this, toInsert, insertMode, insertedIdx)
    TYPE(t_rxnIonCorrsOfSys), INTENT(INOUT) :: this
    TYPE(t_rxnIonCorr),       INTENT(IN)    :: toInsert
    TYPE(t_insertMode),       INTENT(IN)    :: insertMode
    INTEGER(i4b),   OPTIONAL, INTENT(OUT)   :: insertedIdx
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':insert_rxnIonCorrsOfSys'

    ! Local variables
    INTEGER(i4b) :: idx, insertIdx

    LOGICAL :: exitLoop

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    insertIdx = this%nb +1

    DO idx = 1, this%nb

      exitLoop = chkIfExitLoop( &
        insertIdx, idx, compare(this%ar(idx)%id, toInsert%id), &
        insertMode, srName)

      IF (exitLoop) EXIT

    ENDDO

    IF (insertIdx > 0) CALL insertAt(this, toInsert, insertIdx)

    IF (PRESENT(insertedIdx)) insertedIdx = insertIdx

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN

  END SUBROUTINE insert_rxnIonCorrsOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnIonCorrsOfSys(this, varNam, indent)
    TYPE(t_rxnIonCorrsOfSys), INTENT(IN) :: this
    CHARACTER(LEN=*),         INTENT(IN) :: varNam
    INTEGER(i4b),             INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnIonCorrsOfSys'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    DO iRec = 1, this%nb
      CALL prt(this%ar(iRec), 'ar(' // TRIM(str(iRec)) // ')', indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnIonCorrsOfSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnIonCorrsPerSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnIonCorrsPerSys(this)
    TYPE(t_rxnIonCorrsPerSys), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnIonCorrsPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL constr(this%ar(iSys), 0)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnIonCorrsPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnIonCorrsPerSys(this, copy)
    TYPE(t_rxnIonCorrsPerSys), INTENT(IN)  :: this
    TYPE(t_rxnIonCorrsPerSys), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':cpyConstr_rxnIonCorrsPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL cpyConstr(this%ar(iSys), copy%ar(iSys))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnIonCorrsPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnIonCorrsPerSys(this)
    TYPE(t_rxnIonCorrsPerSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnIonCorrsPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL destr(this%ar(iSys))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnIonCorrsPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE clear_rxnIonCorrsPerSys(this)
    TYPE(t_rxnIonCorrsPerSys), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':clear_rxnIonCorrsPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iSys = 0, maxRnxSys -1
      CALL clear(this%ar(iSys))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE clear_rxnIonCorrsPerSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnIonCorrsPerSys(this, varNam, indent)
    TYPE(t_rxnIonCorrsPerSys), INTENT(IN) :: this
    CHARACTER(LEN=*),         INTENT(IN) :: varNam
    INTEGER(i4b),             INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnIonCorrsPerSys'

    ! Local variables
    INTEGER(i4b) :: iSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) varNam

    DO iSys = 0, maxRnxSys -1
      CALL prt(this%ar(iSys), g_strSys3(iSys), indent +2)
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnIonCorrsPerSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnLimits
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnLimits(this)
    TYPE(t_rxnLimits), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnLimits'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%minMax = [-1d20, 1d20]
    this%maxAbsChgBtwEpo = 1d20
    this%addMaxAbsChg_per_s = 1d40

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnLimits

  ! --------------------------------------------------------------------------
  FUNCTION areLimitsDefined(this) RESULT(res)
    TYPE(t_rxnLimits), INTENT(IN) :: this

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':areLimitsDefined'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = this%minMax(1) > -1d20 .OR. this%minMax(2) < 1d20 &
      .OR. this%maxAbsChgBtwEpo < 1d20 .OR. this%addMaxAbsChg_per_s < 1d40

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION areLimitsDefined

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnLimits(this, varNam, indent)
    TYPE(t_rxnLimits), INTENT(IN) :: this
    CHARACTER(LEN=*),  INTENT(IN) :: varNam
    INTEGER(i4b),      INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnLimits'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'minimum = ' // TRIM(str(this%minMax(1)))

    WRITE(*, indentFmt(indent +2)) &
      'maximum = ' // TRIM(str(this%minMax(2)))

    WRITE(*, indentFmt(indent +2)) &
      'maxAbsChgBtwEpo = ' // TRIM(str(this%maxAbsChgBtwEpo))

    WRITE(*, indentFmt(indent +2)) &
      'addMaxAbsChg_per_s = ' // TRIM(str(this%addMaxAbsChg_per_s))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnLimits

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnLimitsPerConfVal
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnLimitsPerConfVal(this)
    TYPE(t_rxnLimitsPerConfVal), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnLimitsPerConfVal'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%A_m)
    CALL init(this%velNorm_m_per_s)
    CALL init(this%Omega0_deg)
    CALL init(this%M0_deg)
    CALL init(this%ecc)
    CALL init(this%i0_deg)
    CALL init(this%omega_deg)
    CALL init(this%OmegaDot_deg_per_s)
    CALL init(this%deltaN0_deg_per_s)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnLimitsPerConfVal

  ! --------------------------------------------------------------------------
  FUNCTION getLimits(this, confValIdx) RESULT(limits)
    TYPE(t_rxnLimitsPerConfVal), INTENT(IN) :: this
    TYPE(t_rxnConfValIdx),       INTENT(IN) :: confValIdx

    ! Returns
    TYPE(t_rxnLimits) :: limits
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':getLimits'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    SELECT CASE (confValIdx%ci)
      CASE(rxnConfValIds%SemiMajAxis%ci)
        limits = this%A_m

      CASE(rxnConfValIds%VelNorm%ci)
        limits = this%velNorm_m_per_s

      CASE(rxnConfValIds%Node%ci)
        limits = this%Omega0_deg

      CASE(rxnConfValIds%MeanAnomaly%ci)
        limits = this%M0_deg

      CASE(rxnConfValIds%Eccentricity%ci)
        limits = this%ecc

      CASE(rxnConfValIds%Inclination%ci)
        limits = this%i0_deg

      CASE(rxnConfValIds%Perigee%ci)
        limits = this%omega_deg

      CASE(rxnConfValIds%RateOfNode%ci)
        limits = this%OmegaDot_deg_per_s

      CASE(rxnConfValIds%DeltaN0%ci)
        limits = this%deltaN0_deg_per_s

      CASE DEFAULT
        CALL init(limits)

    END SELECT

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION getLimits

  ! --------------------------------------------------------------------------
  SUBROUTINE setLimits(this, confValIdx, limits)
    TYPE(t_rxnLimitsPerConfVal), INTENT(INOUT) :: this
    TYPE(t_rxnConfValIdx),       INTENT(IN)    :: confValIdx
    TYPE(t_rxnLimits),           INTENT(IN)    :: limits
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':setLimits'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    SELECT CASE (confValIdx%ci)
      CASE(rxnConfValIds%SemiMajAxis%ci)
        this%A_m = limits

      CASE(rxnConfValIds%VelNorm%ci)
        this%velNorm_m_per_s = limits

      CASE(rxnConfValIds%Node%ci)
        this%Omega0_deg = limits

      CASE(rxnConfValIds%MeanAnomaly%ci)
        this%M0_deg = limits

      CASE(rxnConfValIds%Eccentricity%ci)
        this%ecc = limits

      CASE(rxnConfValIds%Inclination%ci)
        this%i0_deg = limits

      CASE(rxnConfValIds%Perigee%ci)
        this%omega_deg = limits

      CASE(rxnConfValIds%RateOfNode%ci)
        this%OmegaDot_deg_per_s = limits

      CASE(rxnConfValIds%DeltaN0%ci)
        this%deltaN0_deg_per_s = limits

    END SELECT

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE setLimits

  ! --------------------------------------------------------------------------
  FUNCTION hasLimits(this, confValIdx) RESULT(res)
    TYPE(t_rxnLimitsPerConfVal), INTENT(IN) :: this
    TYPE(t_rxnConfValIdx),       INTENT(IN) :: confValIdx

    ! Returns
    LOGICAL :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':hasLimits'

    ! Local variables
    TYPE(t_rxnLimits) :: limits

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    limits = getLimits(this, confValIdx)

    res = areLimitsDefined(limits)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION hasLimits

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnLimitsPerConfVal(this, varNam, indent)
    TYPE(t_rxnLimitsPerConfVal), INTENT(IN) :: this
    CHARACTER(LEN=*),            INTENT(IN) :: varNam
    INTEGER(i4b),                INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnLimitsPerConfVal'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%A_m, 'A [m]', indent +2)
    CALL prt(this%velNorm_m_per_s, 'velNorm [m/s]', indent +2)
    CALL prt(this%Omega0_deg, 'Omega0 [deg]', indent +2)
    CALL prt(this%M0_deg, 'M0 [deg]', indent +2)
    CALL prt(this%ecc, 'eccentricity', indent +2)
    CALL prt(this%i0_deg, 'i0 [deg]', indent +2)
    CALL prt(this%omega_deg, 'omega [deg]', indent +2)
    CALL prt(this%OmegaDot_deg_per_s, 'OmegaDot [deg/s]', indent +2)
    CALL prt(this%deltaN0_deg_per_s, 'deltaN0 [deg/s]', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnLimitsPerConfVal

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnOsb
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnOsb(this)
    TYPE(t_rxnOsb), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnOsb'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%obsType = ''
    this%osb     = 0d0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnOsb

  ! -------------------------------------------------------------------------
  FUNCTION eq_rxnOsb(obj1, obj2) RESULT(res)
    TYPE(t_rxnOsb), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':eq_rxnOsb'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = obj1%obsType == obj2%obsType .AND. obj1%osb == obj2%osb

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION eq_rxnOsb

  ! -------------------------------------------------------------------------
  FUNCTION ne_rxnOsb(obj1, obj2) RESULT(res)
    TYPE(t_rxnOsb), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':ne_rxnOsb'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .NOT. obj1 == obj2

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION ne_rxnOsb

  ! --------------------------------------------------------------------------
  FUNCTION str_rxnOsb(this) RESULT(res)
    TYPE(t_rxnOsb), INTENT(IN) :: this

    ! Returns
    CHARACTER(LEN=21 +5) :: res
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':str_rxnOsb'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = this%obsType // ' ' // TRIM(str(this%osb))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION str_rxnOsb

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnOsbs
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnOsbs(this)
    TYPE(t_rxnOsbs), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnOsbs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%nb = 0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnOsbs

  ! --------------------------------------------------------------------------
  SUBROUTINE push_back_rxnOsbs_1(this, rxnOsb)
    TYPE(t_rxnOsbs),  INTENT(INOUT) :: this
    TYPE(t_rxnOsb),   INTENT(IN)    :: rxnOsb
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':push_back_rxnOsbs_1'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (this%nb > SIZE(this%osbs)) THEN
      CALL wrtSrErrToLfnErr(srName, &
        'Not more than ' // str(SIZE(this%osbs)) // ' OSBs supported in t_rxnOsb')

      CALL exitRc(2)
    ENDIF

    this%nb = this%nb +1

    this%osbs(this%nb) = rxnOsb

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE push_back_rxnOsbs_1

  ! --------------------------------------------------------------------------
  SUBROUTINE push_back_rxnOsbs_2(this, obsType, osb)
    TYPE(t_rxnOsbs),  INTENT(INOUT) :: this
    CHARACTER(LEN=3), INTENT(IN)    :: obsType
    REAL(r8b),        INTENT(IN)    :: osb
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':push_back_rxnOsbs_2'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL push_back(this, t_rxnOsb(obsType, osb))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE push_back_rxnOsbs_2

  ! -------------------------------------------------------------------------
  FUNCTION eq_rxnOsbs(obj1, obj2) RESULT(res)
    TYPE(t_rxnOsbs), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':eq_rxnOsbs'

    ! Local variables
    INTEGER(i4b) :: iOsb

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .FALSE.

    IF (obj1%nb /= obj2%nb) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    DO iOsb = 1, obj1%nb
      IF (obj1%osbs(iOsb) /= obj2%osbs(iOsb)) THEN
        IF (srfDebug) CALL cpu_exit(srName)
        RETURN
      ENDIF
    ENDDO

    res = .TRUE.

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION eq_rxnOsbs

  ! -------------------------------------------------------------------------
  FUNCTION ne_rxnOsbs(obj1, obj2) RESULT(res)
    TYPE(t_rxnOsbs), INTENT(IN) :: obj1, obj2

    ! Returns
    LOGICAL :: res
  ! -------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':ne_rxnOsbs'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    res = .NOT. obj1 == obj2

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION ne_rxnOsbs

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnOsbs(this, varNam, indent)
    TYPE(t_rxnOsbs),  INTENT(IN) :: this
    CHARACTER(LEN=*), INTENT(IN) :: varNam
    INTEGER(i4b),     INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnOsbs'

    ! Local variables
    INTEGER(i4b) :: iRec

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) 'nb = ' // str(this%nb)

    DO iRec = 1, this%nb
      WRITE(*, indentFmt(indent +2)) &
        'osbs(' // str(iRec) // ') = ' // TRIM(str(this%osbs(iRec)))
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnOsbs

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnOutHdlr
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnOutHdlr_1(this)
    TYPE(t_rxnOutHdlr), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnOutHdlr_1'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%wrtHdlr)
    CALL constr(this%outHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnOutHdlr_1

  ! --------------------------------------------------------------------------
  SUBROUTINE constr_rxnOutHdlr_2(this, lfnOut, outFileName)
    TYPE(t_rxnOutHdlr), INTENT(OUT) :: this
    INTEGER(i4b),       INTENT(IN)  :: lfnOut
    CHARACTER(LEN=*),   INTENT(IN)  :: outFileName
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':constr_rxnOutHdlr_2'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(this%wrtHdlr, lfnOut, outFileName)
    CALL constr(this%outHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE constr_rxnOutHdlr_2

  ! --------------------------------------------------------------------------
  SUBROUTINE cpyConstr_rxnOutHdlr(this, copy)
    TYPE(t_rxnOutHdlr), INTENT(IN)  :: this
    TYPE(t_rxnOutHdlr), INTENT(OUT) :: copy
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':cpyConstr_rxnOutHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    copy%wrtHdlr = this%wrtHdlr

    CALL cpyConstr(this%outHdrAndStat, copy%outHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE cpyConstr_rxnOutHdlr

  ! --------------------------------------------------------------------------
  SUBROUTINE destr_rxnOutHdlr(this)
    TYPE(t_rxnOutHdlr), INTENT(INOUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':destr_rxnOutHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL destr(this%outHdrAndStat)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE destr_rxnOutHdlr

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnOutHdlr(this, varNam, indent)
    TYPE(t_rxnOutHdlr), INTENT(IN) :: this
    CHARACTER(LEN=*),   INTENT(IN) :: varNam
    INTEGER(i4b),       INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnOutHdlr'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    CALL prt(this%wrtHdlr, 'wrtHdlr', indent +2)
    CALL prt(this%outHdrAndStat, 'outHdrAndStat', indent +2)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnOutHdlr

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnRawRecElems
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnRawRecElems(this)
    TYPE(t_rxnRawRecElems), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnRawRecElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%ar(:) = 0d0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnRawRecElems

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnRawRecElems(this, varNam, indent)
    TYPE(t_rxnRawRecElems), INTENT(IN) :: this
    CHARACTER(LEN=*),       INTENT(IN) :: varNam
    INTEGER(i4b),           INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnRawRecElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'ar = ' // TRIM(str(this%ar))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnRawRecElems

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnRdConf
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnRdConf(this)
    TYPE(t_rxnRdConf), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnRdConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%wrongHdrRecsWarned(:) = .FALSE.

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnRdConf

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnRdConf(this, varNam, indent)
    TYPE(t_rxnRdConf), INTENT(IN) :: this
    CHARACTER(LEN=*),  INTENT(IN) :: varNam
    INTEGER(i4b),      INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnRdConf'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'wrongHdrRecsWarned = ' // TRIM(str(this%wrongHdrRecsWarned))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnRdConf

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnTimSysCorrFromSysToSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnTimSysCorrFromSysToSys(this)
    TYPE(t_rxnTimSysCorrFromSysToSys), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':init_rxnTimSysCorrFromSysToSys'

    ! Local variables
    INTEGER(i4b) :: iFromSys, iToSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    DO iFromSys = 0, maxRnxSys -1
      DO iToSys = 0, maxRnxSys
        CALL init(this%ar(iFromSys, iToSys))
      ENDDO
    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnTimSysCorrFromSysToSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnTimSysCorrFromSysToSys(this, varNam, indent)
    TYPE(t_rxnTimSysCorrFromSysToSys), INTENT(IN) :: this
    CHARACTER(LEN=*),                  INTENT(IN) :: varNam
    INTEGER(i4b),                      INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':prt_rxnTimSysCorrFromSysToSys'

    ! Local variables
    INTEGER(i4b) :: iFromSys, iToSys

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) varNam

    DO iFromSys = 0, maxRnxSys -1
      DO iToSys = 0, maxRnxSys -1

        CALL prt(this%ar(iFromSys, iToSys), &
          'from ' // g_strSys3(iFromSys) // ' to ' // g_strSys3(iToSys), &
          indent +2)

      ENDDO

      CALL prt(this%ar(iFromSys, maxRnxSys), &
        'from ' // g_strSys3(iFromSys) // ' to UTC', &
        indent +2)

    ENDDO

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnTimSysCorrFromSysToSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnTimSysCorrOfSys
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnTimSysCorrOfSys(this)
    TYPE(t_rxnTimSysCorrOfSys), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnTimSysCorrOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%defined = .FALSE.

    CALL init(this%refTime)

    this%a0 = 0d0
    this%a1 = 0d0
    this%serviceProvider = ''
    this%utcId = -1

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnTimSysCorrOfSys

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnTimSysCorrOfSys(this, varNam, indent)
    TYPE(t_rxnTimSysCorrOfSys), INTENT(IN) :: this
    CHARACTER(LEN=*),           INTENT(IN) :: varNam
    INTEGER(i4b),               INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnTimSysCorrOfSys'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'defined = ' // TRIM(str(this%defined))

    CALL prt(this%refTime, 'refTime', indent +2)

    WRITE(*, indentFmt(indent +2)) &
      'a0 = ' // TRIM(str(this%a0))

    WRITE(*, indentFmt(indent +2)) &
      'a1 = ' // TRIM(str(this%a1))

    WRITE(*, indentFmt(indent +2)) &
      'serviceProvider = "' // TRIM(this%serviceProvider) // '"'

    WRITE(*, indentFmt(indent +2)) &
      'utcId = ' // TRIM(str(this%utcId))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnTimSysCorrOfSys

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! Subroutines and functions for TYPE t_rxnTransfOrbElems
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE init_rxnTransfOrbElems(this)
    TYPE(t_rxnTransfOrbElems), INTENT(OUT) :: this
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':init_rxnTransfOrbElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    this%health = 0
    this%accuracy_m = 0d0

    this%A_m = 0d0
    this%Adot_m_per_s = 0d0
    this%ecc = 0d0
    this%i0_rad = 0d0
    this%Omega0_rad = 0d0
    this%omega_rad = 0d0

    this%deltaN0_nonRS_rad_per_s = 0d0
    this%deltaN0Dot_nonRS_rad_per_s2 = 0d0
    this%M0_nonRS_rad = 0d0
    this%iDot_nonRS_rad_per_s = 0d0
    this%OmegaDot_nonRS_rad_per_s = 0d0

    this%C_uc_nonRS_rad = 0d0
    this%C_us_nonRS_rad = 0d0
    this%C_rc_nonRS_m = 0d0
    this%C_rs_nonRS_m = 0d0
    this%C_ic_nonRS_rad = 0d0
    this%C_is_nonRS_rad = 0d0

    this%pos_RS_m(:) = 0d0
    this%vel_RS_m_per_s(:) = 0d0
    this%acc_RS_m_per_s2(:) = 0d0

    this%velRel_RS_m_per_s(:) = 0d0

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE init_rxnTransfOrbElems

  ! -------------------------------------------------------------------------
  FUNCTION extrapolate_nonRS(transfElems, seconds) RESULT(extrTransfElems)
    TYPE(t_rxnTransfOrbElems), INTENT(IN) :: transfElems
    REAL(r8b),                 INTENT(IN) :: seconds

    ! Returns
    TYPE(t_rxnTransfOrbElems) :: extrTransfElems
  ! -------------------------------------------------------------------------

    ! Local Parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':extrapolate_nonRS'

    ! Local variables
    REAL(r8b) :: meanAnomalyRate_rad_per_s

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    extrTransfElems = transfElems

    IF (extrTransfElems%A_m <= 0d0) THEN
      IF (srfDebug) CALL cpu_exit(srName)
      RETURN
    ENDIF

    ! Compute change in first elements in the time interval
    extrTransfElems%i0_rad = extrTransfElems%i0_rad &
      +extrTransfElems%iDot_nonRS_rad_per_s *seconds

    extrTransfElems%Omega0_rad = extrTransfElems%Omega0_rad &
      +extrTransfElems%OmegaDot_nonRS_rad_per_s *seconds

    meanAnomalyRate_rad_per_s = &
      DSQRT(CONST%GM /extrTransfElems%A_m**3) &
      +extrTransfElems%deltaN0_nonRS_rad_per_s &
      +0.5d0*extrTransfElems%deltaN0Dot_nonRS_rad_per_s2*seconds

    extrTransfElems%M0_nonRS_rad = &
      extrTransfElems%M0_nonRS_rad &
      +meanAnomalyRate_rad_per_s *seconds

    extrTransfElems%A_m = extrTransfElems%A_m &
     +extrTransfElems%Adot_m_per_s * seconds

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END FUNCTION extrapolate_nonRS

  ! --------------------------------------------------------------------------
  SUBROUTINE prt_rxnTransfOrbElems(this, varNam, indent)
    TYPE(t_rxnTransfOrbElems), INTENT(IN) :: this
    CHARACTER(LEN=*),          INTENT(IN) :: varNam
    INTEGER(i4b),              INTENT(IN) :: indent
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':prt_rxnTransfOrbElems'

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    WRITE(*, indentFmt(indent)) &
      varNam

    WRITE(*, indentFmt(indent +2)) &
      'health = ' // TRIM(str(this%health))

    WRITE(*, indentFmt(indent +2)) &
      'accuracy [m] = ' // TRIM(str(this%accuracy_m))

    WRITE(*, indentFmt(indent +2)) &
      'A [m] = ' // TRIM(str(this%A_m))

    WRITE(*, indentFmt(indent +2)) &
      'Adot [m/s] = ' // TRIM(str(this%Adot_m_per_s))

    WRITE(*, indentFmt(indent +2)) &
      'ecc = ' // TRIM(str(this%ecc))

    WRITE(*, indentFmt(indent +2)) &
      'i0 [rad] = ' // TRIM(str(this%i0_rad))

    WRITE(*, indentFmt(indent +2)) &
      'Omega0 [rad] = ' // TRIM(str(this%Omega0_rad))

    WRITE(*, indentFmt(indent +2)) &
      'omega [rad] = ' // TRIM(str(this%omega_rad))

    WRITE(*, indentFmt(indent +2)) &
      'deltaN0 for non-(GLO,SBAS) [rad/s] = ' &
      // TRIM(str(this%deltaN0_nonRS_rad_per_s))

    WRITE(*, indentFmt(indent +2)) &
      'deltaN0Dot for non-(GLO,SBAS) [rad/s²] = ' &
      // TRIM(str(this%deltaN0Dot_nonRS_rad_per_s2))

    WRITE(*, indentFmt(indent +2)) &
      'mean anomaly for non-(GLO,SBAS) [rad] = ' &
      // TRIM(str(this%M0_nonRS_rad))

    WRITE(*, indentFmt(indent +2)) &
      'rate of inclination for non-(GLO,SBAS) [rad/s] = ' &
      // TRIM(str(this%iDot_nonRS_rad_per_s))

    WRITE(*, indentFmt(indent +2)) &
      'rate of node for non-(GLO,SBAS) [rad/s] = ' &
      // TRIM(str(this%OmegaDot_nonRS_rad_per_s))

    WRITE(*, indentFmt(indent +2)) &
      'C_uc, C_us for non-(GLO,SBAS) [rad] = ' &
      // TRIM(str(this%C_uc_nonRS_rad)) // ', ' // TRIM(str(this%C_us_nonRS_rad))

    WRITE(*, indentFmt(indent +2)) &
      'C_rc, C_rs for non-(GLO,SBAS) [m] = ' &
      // TRIM(str(this%C_rc_nonRS_m)) // ', ' // TRIM(str(this%C_rs_nonRS_m))

    WRITE(*, indentFmt(indent +2)) &
      'C_ic, Ci_s for non-(GLO,SBAS) [rad] = ' &
      // TRIM(str(this%C_ic_nonRS_rad)) // ', ' // TRIM(str(this%C_is_nonRS_rad))

    WRITE(*, indentFmt(indent +2)) &
      'position for (GLO,SBAS) [m] = ' // TRIM(str(this%pos_RS_m))

    WRITE(*, indentFmt(indent +2)) &
      'velocity for (GLO,SBAS) [m/s] = ' // TRIM(str(this%vel_RS_m_per_s))

    WRITE(*, indentFmt(indent +2)) &
      'acceleration for (GLO,SBAS) [m/s] = ' // TRIM(str(this%acc_RS_m_per_s2))

    WRITE(*, indentFmt(indent +2)) &
      'rel. velocity for (GLO,SBAS) [m/s] = ' // TRIM(str(this%velRel_RS_m_per_s))

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE prt_rxnTransfOrbElems

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! General PRIVATE subroutines and functions
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! --------------------------------------------------------------------------
  SUBROUTINE closeEpoIntervall(currentEpo, fromEpoStr, epoStrs, msg)
    TYPE(t_epoch),       INTENT(IN)    :: currentEpo
    CHARACTER(LEN=*),    INTENT(IN)    :: fromEpoStr
    TYPE(t_stringList2), INTENT(INOUT) :: epoStrs
    CHARACTER(LEN=*),    INTENT(IN)    :: msg
  ! --------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':closeEpoIntervall'

    ! Local variables
    CHARACTER(LEN=LEN(msg) +2) :: msgToAppend
    CHARACTER(LEN=19)          :: toEpoStr

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    IF (fromEpoStr /= '') THEN

      CALL timSt2(1, currentEpo, toEpoStr)

      msgToAppend = ''

      IF (msg /= '') THEN
        msgToAppend = ': ' // msg
      ENDIF

      IF (toEpoStr == fromEpoStr) THEN
        CALL epoStrs%push_back(fromEpoStr // ' ' // msgToAppend)
      ELSE
        CALL epoStrs%push_back(fromEpoStr // ' to ' // toEpoStr // msgToAppend)
      ENDIF

    ENDIF

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE closeEpoIntervall

  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------
  ! TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TE
  ! -----------------------------------------------------------------------------
  ! Test routines
  ! -----------------------------------------------------------------------------
  ! TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TE
  ! -----------------------------------------------------------------------------
  ! -----------------------------------------------------------------------------

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnBaseConf_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnBaseConf_mem'

    ! Local variables
    TYPE(t_rxnBaseConf) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnBaseConf_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnBlockConf_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnBlockConf_mem'

    ! Local variables
    TYPE(t_rxnBlockConf) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnBlockConf_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnConfOfSys_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnConfOfSys_mem'

    ! Local variables
    TYPE(t_rxnConfOfSys) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj, 2)
    CALL constr(tstObj2, 3)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnConfOfSys_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnConfPerSys_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnConfPerSys_mem'

    ! Local variables
    TYPE(t_rxnConfPerSys) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnConfPerSys_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnConfValEntry_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnConfValEntry_mem'

    ! Local variables
    TYPE(t_rxnConfValEntry) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnConfValEntry_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnDataRecs_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnDataRecs_mem'

    ! Local variables
    TYPE(t_rxnDataRecs) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj, 3)
    CALL constr(tstObj2, 2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnDataRecs_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnDataRecsPerSat_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':tst_rxnDataRecsPerSat_mem'

    ! Local variables
    TYPE(t_rxnDataRecsPerSat) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnDataRecsPerSat_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnDataRecsPerTypeSysMssg_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':tst_rxnDataRecsPerTypeSysMssg_mem'

    ! Local variables
    TYPE(t_rxnDataRecsPerTypeSysMssg) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnDataRecsPerTypeSysMssg_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnHdr_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnHdr_mem'

    ! Local variables
    TYPE(t_rxnHdr) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnHdr_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnHdrAndStat_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnHdrAndStat_mem'

    ! Local variables
    TYPE(t_rxnHdrAndStat) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnHdrAndStat_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnInpHdlr_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnInpHdlr_mem'

    ! Local variables
    TYPE(t_rxnInpHdlr) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnInpHdlr_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnIonCorrsOfSys_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnIonCorrsOfSys_mem'

    ! Local variables
    TYPE(t_rxnIonCorrsOfSys) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj, 3)
    CALL constr(tstObj2, 2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnIonCorrsOfSys_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnIonCorrsPerSys_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = &
      modNam // ':tst_rxnIonCorrsPerSys_mem'

    ! Local variables
    TYPE(t_rxnIonCorrsPerSys) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnIonCorrsPerSys_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_rxnOutHdlr_mem()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_rxnOutHdlr_mem'

    ! Local variables
    TYPE(t_rxnOutHdlr) :: tstObj, tstObj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL constr(tstObj)
    CALL constr(tstObj2)
    CALL destr(tstObj)
    CALL cpyConstr(tstObj2, tstObj)
    CALL destr(tstObj2)
    CALL destr(tstObj)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_rxnOutHdlr_mem

  ! -----------------------------------------------------------------------------
  SUBROUTINE tst_compare_rxnDataRec()
  ! -----------------------------------------------------------------------------

    ! Local parameters
    CHARACTER(LEN=*), PARAMETER :: srName = modNam // ':tst_compare_rxnDataRec'

    ! Local variables
    TYPE(t_rxnDataRec) :: obj1, obj2

    ! DEBUG: entry
    IF (srfDebug) CALL cpu_enter(srName)

    CALL init(obj1)
    CALL init(obj2)

    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj1, obj2), 0)

    obj1%clkEpoOrig = .realToEpoch.(50000d0)
    obj2%clkEpoOrig = .realToEpoch.(50001d0)

    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj1, obj2), -1)
    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj2, obj1), 1)

    obj1%brdDataSrcPrio = 1
    obj2%brdDataSrcPrio = 3

    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj1, obj2), 1)
    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj2, obj1), -1)

    obj1%ephEpoOrig = .realToEpoch.(50001d0)
    obj2%ephEpoOrig = .realToEpoch.(50002d0)

    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj1, obj2), -1)
    CALL CHECK_SameInt(srName, __LINE__, '', compare(obj2, obj1), 1)

    ! DEBUG: exit
    IF (srfDebug) CALL cpu_exit(srName)

    RETURN
  END SUBROUTINE tst_compare_rxnDataRec

END MODULE d_rxnType
