Index: trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C	(revision 7528)
@@ -72,5 +72,6 @@
 // has to be removed from the database
 //
-// If nothing failes 1 is returned. In the case of an error 0 is returned.
+// If nothing failes 1 is returned. In the case of an error 2 and if
+// there's no connection to the database 0 is returned.
 // This is needed for the scripts that execute the macro.
 //
@@ -813,5 +814,5 @@
     TSQLResult *res = serv.Query(query);
     if (!res)
-        return 0;
+        return 2;
 
     //build blocks of runs, which have the same values
@@ -875,5 +876,5 @@
     res = serv.Query(query);
     if (!res)
-        return 0;
+        return 2;
 
     cout << "old sequences: " << flush;
@@ -911,8 +912,8 @@
         cout << "sequ: " << obj->GetName() << " deleting... " << endl;
         if (!DeleteSequence(serv, datapath, sequpath, atoi(obj->GetName()), dummy))
-            return 0;
-    }
-
-    return rc ? 1 : 0;
+            return 2;
+    }
+
+    return rc ? 1 : 2;
 }
 
@@ -936,5 +937,5 @@
     TSQLResult *res = serv.Query(query);
     if (!res)
-        return 0;
+        return 2;
 
     //execute buildsequenceentries for all dates
Index: trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C	(revision 7528)
@@ -38,5 +38,6 @@
 // from there the runnumbers
 //
-// the macro returns 0, if a file is missing, and 1 if all files are there
+// the macro returns 0, if there's no connection to the database, 2, if a
+// file is missing, and 1 if all files are there
 // the return value is checked by the script, that executes the macro
 //
Index: trunk/MagicSoft/Mars/datacenter/macros/checkstardone.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/checkstardone.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/checkstardone.C	(revision 7528)
@@ -36,6 +36,6 @@
 //  .x checkstardone.C+("sequencenumber")
 //
-// the macro returns 0, if for the sequence star is not done, and 1 if star
-// has been done
+// the macro returns 0, if there's no connection to the database, 2, if a
+// file is missing, and 1 if all files are there
 // the return value is checked by the script, that executes the macro
 //
Index: trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/doexclusions.C	(revision 7528)
@@ -53,4 +53,7 @@
 // condition in this example), the line is commented out
 //
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
+//
 /////////////////////////////////////////////////////////////////////////////
 #include <iostream>
@@ -136,7 +139,8 @@
     if (startrun<0 || stoprun<0)
     {
-        cout << "wrong format of date" << endl;
-        return 0;
-    }
+        cout << "wrong format of runno" << endl;
+        return 2;
+    }
+    //if no run for date is available, GetRunNumber() returns 0
     if (startrun==0 || stoprun==0)
         return 1;
@@ -153,6 +157,6 @@
     if (!res)
     {
-        cout << "Error - could not do any automatic excludes" << endl;
-        return 0;
+        cout << "Error - could not do any automatic excludes." << endl;
+        return 2;
     }
 
@@ -173,6 +177,6 @@
         if (!res)
         {
-            cout << "Error" << endl;
-            return 0;
+            cout << "Error - could not get importance." << endl;
+            return 2;
         }
 
@@ -210,5 +214,5 @@
         {
             cout << "Error - no runs to exclude" << endl;
-            return 0;
+            return 2;
         }
 
@@ -227,5 +231,5 @@
                 {
                     cout << "Error - could not insert exclusion" << endl;
-                    return 0;
+                    return 2;
                 }
                 delete res;
Index: trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C	(revision 7528)
@@ -55,5 +55,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -115,5 +116,5 @@
     {
         cout << "ERROR - Could not find file " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -121,5 +122,5 @@
     {
         cout << "ERROR - Reading of MBadPixelsCam failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -147,5 +148,8 @@
 
     if (unsin<0 || unsout<0 || unrin<0 || unrout<0 || isoin<0 || isoout<0 || clumax<0)
-        return 0;
+    {
+        cout << "ERROR - one of the pixel values < 0." << endl;
+        return 2;
+    }
 
     //     MHCamera hist(geom);
@@ -158,5 +162,8 @@
     MStatusArray arr;
     if (arr.Read()<=0)
-        return 0;
+    {
+        cout << "ERROR - could not read MStatusArray." << endl;
+        return 2;
+    }
 
     TH1 *h;
@@ -167,5 +174,5 @@
     {
         cout << "WARNING - Could not find histogram HRelTimeHiGainArea0." << endl;
-        return 0;
+        return 2;
     }
 
@@ -183,5 +190,5 @@
     {
         cout << "WARNING - Could not find histogram HRelTimeHiGainArea1." << endl;
-        return 0;
+        return 2;
     }
 
@@ -199,5 +206,5 @@
     {
         cout << "WARNING - Could not find MHCamera TotalConv." << endl;
-        return 0;
+        return 2;
     }
 
@@ -221,5 +228,5 @@
     {
         cout << "WARNING - Could get sequence# from filename: " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -289,5 +296,5 @@
 
     if (dummy)
-        return 0;
+        return 1;
 
     TSQLResult *res = serv.Query(query);
@@ -295,5 +302,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
     delete res;
Index: trunk/MagicSoft/Mars/datacenter/macros/filldotraw.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/filldotraw.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/filldotraw.C	(revision 7528)
@@ -51,5 +51,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -153,5 +154,5 @@
     const Int_t key = MagicNumber(serv, h);
     if (key<0)
-        return 0;
+        return 2;
 
     TString query(Form("UPDATE RunData SET fMagicNumberKEY=%d, fFormatVersion=%d WHERE fRunNumber=%d",
@@ -162,5 +163,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
 
@@ -215,5 +216,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
 
@@ -247,5 +248,5 @@
     {
         cout << "ERROR - there's are " << count << " files. " << endl;
-        return 0;
+        return 2;
     }
 
Index: trunk/MagicSoft/Mars/datacenter/macros/fillganymed.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillganymed.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillganymed.C	(revision 7528)
@@ -48,5 +48,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -107,5 +108,5 @@
     {
         cout << "ERROR - Could not find file " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -117,5 +118,5 @@
     {
         cout << "WARNING - Reading of MAlphaFitter failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -133,5 +134,5 @@
     {
         cout << "ERROR - Reading of MStatusDisplay failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -140,5 +141,5 @@
     {
         cout << "WARNING - Reading of Theta failed." << endl;
-        return kFALSE;
+        return 2;
     }
 
@@ -151,5 +152,5 @@
     {
         cout << "WARNING - Could get dataset# from filename: " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -203,5 +204,5 @@
     cout << "q: " << query << endl;
     if (dummy)
-        return 0;
+        return 1;
 
     TSQLResult *res = serv.Query(query);
@@ -209,5 +210,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
     return 1;
Index: trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 7528)
@@ -52,5 +52,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -79,5 +80,5 @@
     {
         cout << "ERROR - Could not find file " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -100,5 +101,5 @@
     {
         cout << "ERROR - Reading of MStatusDisplay failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -107,5 +108,5 @@
     {
         cout << "WARNING - Reading of PedRMS;avg failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -114,5 +115,5 @@
     {
         cout << "WARNING - Reading of PulsePos;avg failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -133,5 +134,5 @@
         cout << "MeanPedRMS inner " << meanrmsi << endl;
         cout << "MeanPedRMS outer " << meanrmso << endl;
-        return 0;
+        return 2;
     }
 
@@ -143,5 +144,5 @@
     {
         cout << "WARNING - Reading of Interp'd;avg failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -154,5 +155,5 @@
         cout << "MeanInterp'd inner " << meansigi << endl;
         cout << "MeanInterp'd outer " << meansigo << endl;
-        return 0;
+        return 2;
     }
 
@@ -168,5 +169,5 @@
         cout << "PulsePos'd mean " << meanpul << endl;
         cout << "PulsePos'd rms  " << rmspul << endl;
-        return 0;
+        return 2;
     }
 
@@ -180,5 +181,5 @@
         cout << "WARNING - Sequ# empty" << endl;
         cout << "Sequ# " << sequence << endl;
-        return 0;
+        return 2;
     }
 
@@ -226,5 +227,5 @@
 
     if (dummy)
-        return 0;
+        return 1;
 
     TSQLResult *res = serv.Query(query);
@@ -232,5 +233,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
 
Index: trunk/MagicSoft/Mars/datacenter/macros/fillsinope.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillsinope.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillsinope.C	(revision 7528)
@@ -54,5 +54,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -136,5 +137,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return kFALSE;
+        return 2;
     }
     delete res;
@@ -168,5 +169,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
 
@@ -186,5 +187,5 @@
         {
             cout << "ERROR - Query failed: " << query << endl;
-            return 0;
+            return 2;
         }
     }
@@ -201,5 +202,5 @@
     //process dat-file
     rc=Process(serv, fname, runno, kFALSE, dummy);
-    if (rc==0)
+    if (rc==2)
         return rc;
 
Index: trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 7528)
@@ -52,5 +52,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -113,5 +114,5 @@
     {
         cout << "ERROR - Could not find file " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -121,5 +122,5 @@
     {
         cout << "ERROR - Reading of MStatusDisplay failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -128,5 +129,5 @@
     {
         cout << "WARNING - Reading of MHHillas failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -135,5 +136,5 @@
     {
         cout << "WARNING - Reading of MHMuon failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -165,5 +166,5 @@
     {
         cout << "WARNING - Reading of Islands failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -176,5 +177,5 @@
     {
         cout << "WARNING - Reading of EffOnTheta failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -189,5 +190,5 @@
     {
         cout << "WARNING - Reading of ProjDeltaT failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -199,5 +200,5 @@
     {
         cout << "WARNING - Reading of Humidity failed." << endl;
-        return 0;
+        return 2;
     }
 
@@ -210,5 +211,5 @@
     {
         cout << "WARNING - Could get sequence# from filename: " << fname << endl;
-        return 0;
+        return 2;
     }
 
@@ -268,5 +269,5 @@
 
     if (dummy)
-        return 0;
+        return 1;
 
     TSQLResult *res = serv.Query(query);
@@ -274,5 +275,5 @@
     {
         cout << "ERROR - Query failed: " << query << endl;
-        return 0;
+        return 2;
     }
 
Index: trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C	(revision 7528)
@@ -46,5 +46,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -121,5 +122,5 @@
     TSQLResult *res = serv.Query(query);
     if (!res)
-        return 0;
+        return 2;
 
     delete res;
Index: trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C	(revision 7518)
+++ trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C	(revision 7528)
@@ -38,5 +38,6 @@
 // file called sql.rc and the resource file is found.
 //
-// Returns 0 in case of failure and 1 in case of success.
+// Returns 2 in case of failure, 1 in case of success and 0 if the connection
+// to the database is not working.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -349,5 +350,5 @@
     while ((row = res->Next()))
         if (!GetSequence(serv, *row, sequpath))
-            return 0;
+            return 2;
 
     delete res;
