Index: /trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcedit.cpp	(revision 9944)
+++ /trunk/BNC/src/rinex/reqcedit.cpp	(revision 9945)
@@ -224,4 +224,19 @@
   t_rnxObsFile outObsFile(_outObsFileName, t_rnxObsFile::output);
 
+
+  // Put together all run by date entries
+  // ------------------------------------
+  QStringList runByDate;
+  if (_rnxVersion >= 4.0 && _rnxObsFiles.size() > 1) {
+    for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
+      t_rnxObsFile* rnxObsFile = _rnxObsFiles[ii];
+      QStringListIterator itRunByDt(rnxObsFile->runByDate());
+      while (itRunByDt.hasNext()) {
+        runByDate.append(itRunByDt.next());
+      }
+    }
+    runByDate.removeDuplicates();
+  }
+
   // Select observation types
   // ------------------------
@@ -307,5 +322,5 @@
     if (ii == 0) {
       outObsFile.setHeader(obsFile->header(), int(_rnxVersion), &useObsTypes,
-          &phaseShifts, &gloBiases, &gloSlots);
+          &phaseShifts, &gloBiases, &gloSlots, &runByDate);
       if (_begTime.valid() && _begTime > outObsFile.startTime()) {
         outObsFile.setStartTime(_begTime);
@@ -403,5 +418,4 @@
     }
   }
-
 
   const ColumnVector& obsFileAntNEU = obsFile.antNEU();
@@ -539,7 +553,8 @@
     return;
   }
-  // Concatenate all comments
-  // ------------------------
+  // Concatenate all comments and all run by date lines
+  // --------------------------------------------------
   QStringList comments;
+  QStringList runByDate;
   bncSettings settings;
   QString comment = settings.value("reqcComment").toString();
@@ -555,6 +570,11 @@
       comments.append(itCmnt.next());
     }
+    QStringListIterator itRunByDt(rnxNavFile.runByDate());
+    while (itRunByDt.hasNext()) {
+      runByDate.append(itRunByDt.next());
+    }
   }
   comments.removeDuplicates();
+  runByDate.removeDuplicates();
 
   // Read Ephemerides
@@ -611,4 +631,7 @@
       outNavFile.setVersion(defaultRnxNavVersion2);
     }
+    if (!haveGPS && haveGlonass) {
+      outNavFile.setVersion(defaultRnxNavVersion2);
+    }
   }
 
@@ -634,4 +657,7 @@
   if (!runBy.isEmpty()) {
     txtMap["RUN BY"]  = runBy;
+  }
+  if (!runByDate.empty()) {
+	  txtMap["RUN BY DATE"] = runByDate.join("\\n");
   }
   if (!comments.isEmpty()) {
@@ -667,8 +693,28 @@
       continue;
     }
+
+    if (outNavFile.version() < 3.0) {
+  	  if (outNavFile.glonass() && eph->type() != t_eph::GLONASS) {
+  	    continue;
+  	  }
+  	  if (!outNavFile.glonass() && eph->type() != t_eph::GPS) {
+  	    continue;
+      }
+    }
+
+    if (outNavFile.version() < 4.0) {
+      if (eph->navType() == t_eph::CNAV ||
+          eph->navType() == t_eph::CNV1 ||
+          eph->navType() == t_eph::CNV2 ||
+          eph->navType() == t_eph::CNV3) {
+        continue;
+      }
+    }
+
     if (outNavFile.version() >= 4.0 &&
         eph->navType() == t_eph::undefined) { // input files < version 4.0
       continue;
     }
+
     outNavFile.writeEph(eph);
   }
Index: /trunk/BNC/src/rinex/rnxnavfile.cpp
===================================================================
--- /trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 9944)
+++ /trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 9945)
@@ -82,4 +82,7 @@
     else if (key == "COMMENT") {
       _comments.append(value.trimmed());
+    }
+    else if (key == "PGM / RUN BY / DATE") {
+      _runByDate.append(value.trimmed());
     }
   }
@@ -303,4 +306,5 @@
   QString     runBy = BNC_CORE->userName();
   QStringList comments;
+  QStringList runByDate;
 
   if (txtMap) {
@@ -310,4 +314,7 @@
       if      (it.key() == "RUN BY") {
         runBy = it.value();
+      }
+      else if (it.key() == "RUN BY DATE") {
+    	  runByDate = it.value().split("\\n", QString::SkipEmptyParts);
       }
       else if (it.key() == "COMMENT") {
@@ -370,4 +377,9 @@
 
   if (version() >= 4.0) {
+    QStringListIterator itRunByDt(runByDate);
+    while (itRunByDt.hasNext()) {
+      *_stream << itRunByDt.next().trimmed().left(60).leftJustified(60)
+	       << "PGM / RUN BY / DATE\n";
+	}
     *_stream << QString("%1").arg(leapSecs, 6, 10, QLatin1Char(' ')).left(60).leftJustified(60)
         << "LEAP SECONDS\n";
@@ -382,5 +394,4 @@
   }
 
-
   *_stream << QString()
     .leftJustified(60)
@@ -391,12 +402,4 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_rnxNavFile::writeEph(const t_eph* eph) {
-  if (version() < 4.0) {
-    if (eph->navType() == t_eph::CNAV ||
-        eph->navType() == t_eph::CNV1 ||
-        eph->navType() == t_eph::CNV2 ||
-        eph->navType() == t_eph::CNV3) {
-      return;
-    }
-  }
   *_stream << eph->toString(version());
 }
Index: /trunk/BNC/src/rinex/rnxnavfile.h
===================================================================
--- /trunk/BNC/src/rinex/rnxnavfile.h	(revision 9944)
+++ /trunk/BNC/src/rinex/rnxnavfile.h	(revision 9945)
@@ -54,4 +54,5 @@
     t_eph::e_type _satSys;
     QStringList _comments;
+    QStringList _runByDate;
   };
 
@@ -65,4 +66,5 @@
   bool   glonass() const {return _header._glonass;}
   QStringList comments() const {return _header._comments;}
+  QStringList runByDate() const {return _header._runByDate;}
   t_eph::e_type satSystem() const {return _header._satSys;}
   void   setGlonass(bool glo) {_header._glonass = glo;}
Index: /trunk/BNC/src/rinex/rnxobsfile.cpp
===================================================================
--- /trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 9944)
+++ /trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 9945)
@@ -110,4 +110,7 @@
       in >> _version;
     }
+    else if (key == "PGM / RUN BY / DATE") {
+      _runByDate.append(value.trimmed());
+    }
     else if (key == "MARKER NAME") {
       _markerName = value;
@@ -320,5 +323,5 @@
     _usedSystems += QChar(it.key());
   }
-  
+
   return success;
 }
@@ -406,5 +409,6 @@
                          const QStringList* phaseShifts,
                          const QStringList* gloBiases,
-                         const QStringList* gloSlots) {
+                         const QStringList* gloSlots,
+                         const QStringList* runByDate) {
 
   _version = versionFromInt(version);
@@ -596,4 +600,16 @@
     }
   }
+  if (_version >= 4.0) {
+    // set run by date entries
+    if (!runByDate || runByDate->empty()) {
+      _runByDate = header._runByDate;
+    }
+    else {
+      foreach (const QString &str, *runByDate) {
+        _runByDate.append(str);
+      }
+    }
+  }
+
 }
 
@@ -604,12 +620,16 @@
 
   QStringList newComments;
+  QStringList runByDate;
   QString     runBy = BNC_CORE->userName();
 
   if (txtMap) {
-   QMapIterator<QString, QString> it(*txtMap);
+    QMapIterator<QString, QString> it(*txtMap);
     while (it.hasNext()) {
       it.next();
       if      (it.key() == "RUN BY") {
         runBy = it.value();
+      }
+      else if (it.key() == "RUN BY DATE") {
+    	  runByDate = it.value().split("\\n", QString::SkipEmptyParts);
       }
       else if ((it.key().indexOf("COMMENT")) != -1) {
@@ -634,4 +654,11 @@
            << "PGM / RUN BY / DATE\n";
 
+  if (_version >= 4.0) {
+    QStringListIterator itRunByDt(_runByDate);
+    while (itRunByDt.hasNext()) {
+      *stream << itRunByDt.next().trimmed().left(60).leftJustified(60)
+          << "PGM / RUN BY / DATE\n";
+    }
+  }
   QStringListIterator itCmnt(_comments + newComments);
   while (itCmnt.hasNext()) {
@@ -882,4 +909,6 @@
 }
 
+//
+////////////////////////////////////////////////////////////////////////////
 QStringList t_rnxObsHeader::obsTypes(char sys) const {
   if (_obsTypes.contains(sys)) {
Index: /trunk/BNC/src/rinex/rnxobsfile.h
===================================================================
--- /trunk/BNC/src/rinex/rnxobsfile.h	(revision 9944)
+++ /trunk/BNC/src/rinex/rnxobsfile.h	(revision 9945)
@@ -57,5 +57,6 @@
   void        set(const t_rnxObsHeader& header, int version,
                   const QStringList* useObsTypes = 0, const QStringList* phaseShifts = 0,
-                  const QStringList* gloBiases = 0, const QStringList* gloSlots = 0);
+                  const QStringList* gloBiases = 0, const QStringList* gloSlots = 0,
+                  const QStringList* runByDate = 0);
   int         numSys() const;
   char        system(int iSys) const;
@@ -69,4 +70,5 @@
   QStringList gloBiases() const;
   QStringList gloSlots() const;
+  QStringList runByDate() const {return _runByDate;}
   void        write(QTextStream* stream, const QMap<QString, QString>* txtMap = 0) const;
   bncTime     startTime() const {return _startTime;}
@@ -93,4 +95,5 @@
   QStringList     _stationInformation;
   QStringList     _comments;
+  QStringList     _runByDate;
   ColumnVector    _antNEU;
   ColumnVector    _antXYZ;
@@ -162,4 +165,5 @@
   QStringList gloBiases() const {return _header.gloBiases();}
   QStringList gloSlots() const {return _header.gloSlots();}
+  QStringList runByDate() const {return _header.runByDate();}
   const QString& antennaName() const {return _header._antennaName;}
   const QString& antennaNumber() const {return _header._antennaNumber;}
@@ -192,5 +196,5 @@
   const ColumnVector& antBSG() const {return _header._antBSG;}
 
-  const bncTime&      startTime() const {return _header._startTime;}
+  const bncTime& startTime() const {return _header._startTime;}
   void  setStartTime(const bncTime& startTime) {_header._startTime = startTime;}
 
@@ -208,6 +212,6 @@
   void setHeader(const t_rnxObsHeader& header, int version,
       const QStringList* useObsTypes = 0, const QStringList* phaseShifts = 0,
-      const QStringList* gloBiases = 0, const QStringList* gloSlots = 0) {
-    _header.set(header, version, useObsTypes, phaseShifts, gloBiases, gloSlots);
+      const QStringList* gloBiases = 0, const QStringList* gloSlots = 0, const QStringList* runByDate = 0) {
+    _header.set(header, version, useObsTypes, phaseShifts, gloBiases, gloSlots, runByDate);
   }
 
