Index: trunk/MagicSoft/Mars/datacenter/macros/getdolist.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/getdolist.C	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/macros/getdolist.C	(revision 7467)
@@ -130,5 +130,5 @@
                     rc.GetValue(table+".TimerTable", ""),
                     rc.GetValue(table+".Primary", ""));
-    query+=Form(" WHERE ISNULL(%s) AND ISNULL(fFailed) AND ISNULL(fStartTime) AND ISNULL(fFailedTime) ", column.Data());
+    query+=Form(" WHERE ISNULL(%s) AND ISNULL(fFailedCode) AND ISNULL(fFailedComment) AND ISNULL(fStartTime) AND ISNULL(fFailedTime) ", column.Data());
 
     TIter Next(&l);
Index: trunk/MagicSoft/Mars/datacenter/macros/setstatus.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/setstatus.C	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/macros/setstatus.C	(revision 7467)
@@ -33,10 +33,11 @@
 //
 // Usage:
-//  .x setstatus.C+("primary","table","column","statustime","failed","starttime","failedtime",kTRUE)
+//  .x setstatus.C+("primary","table","column","statustime","failedcode","failedcomment","starttime","failedtime",kTRUE)
 // The first argument is the primary (date/run/sequence/dataset), the second
 // and third argument give the table and column of the step. The fourth
 // column is giving the statustime, to which the column has to be set. The
 // fifth argument is giving the error code (in case of failure), the sixth
-// the starttime and the seventh the stoptime (only in case of failure).
+// an error comment, the seventh the starttime and the eigth the stoptime
+// (only in case of failure).
 // The last argument is indicating if the columns of all influenced steps
 // shall be reset to NULL. The default is kTRUE, which means, that the
@@ -122,7 +123,9 @@
     TString influences  = rc.GetValue(table+"."+column+".Influences", "");
 
-    TString query(Form("UPDATE %s SET %s=%s, fFailed=%s, fStartTime=%s, fFailedTime=%s ",
+    TString query(Form("UPDATE %s SET %s=%s, fFailed=%s, fFailedTime=%s ",
                        table.Data(), column.Data(), statustime.Data(), failed.Data(),
-                       starttime.Data(), failedtime.Data()));
+                       failedtime.Data()));
+    if (starttime.CompareTo("noreset"))
+        query += Form(", fStartTime=%s", starttime.Data());
 
     while (!influences.IsNull() && resetall)
@@ -160,5 +163,5 @@
 }
 
-int setstatus(TString primary, TString table, TString column, TString statustime, TString failed, TString starttime, TString failedtime, Bool_t resetall=kTRUE)
+int setstatus(TString primary, TString table, TString column, TString statustime, TString failedcode, TString failedcomment, TString starttime, TString failedtime, Bool_t resetall=kTRUE)
 {
     TEnv env("sql.rc");
@@ -179,5 +182,5 @@
 
     //if reset is needed and/or can be done, set new values
-    return !CheckReset(rc, table, column, statustime) ? 0 : SetInfluences(serv, rc, primary, table, column, statustime, failed, starttime, failedtime, resetall);
+    return !CheckReset(rc, table, column, statustime) ? 0 : SetInfluences(serv, rc, primary, table, column, statustime, failedcode, failedcomment, starttime, failedtime, resetall);
 
 }
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 7467)
@@ -170,5 +170,7 @@
   fi
 
-  echo "run callisto..." >> $scriptlog 2>&1
+  echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./callisto -b -q -v4 -f -raw --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath --config=$callistorcseq $sequfile  2>> $scriptlog > /dev/null
   check1=$?
@@ -206,5 +208,7 @@
              then
                 echo "no ccfile found for run "$runno >> $scriptlog 2>&1
-                break 2
+                com="no ccfile for run $runno"
+                check=0
+                break
              fi
              echo "cacofile: "$cacofile >> $scriptlog 2>&1
@@ -229,4 +233,8 @@
                    fi
                 done
+                echo "no cacofile found" >> $scriptlog 2>&1
+                com="no cacofile for run $runno"
+                check=0
+                break
              fi
              ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --html=$merpplogpath/merppccupdate$runno.html --auto-time-stop --runfile=$runno $ccfile $calfile 2>> $scriptlog> /dev/null
@@ -235,5 +243,7 @@
                      0)   echo "check2=$check2 -> everything ok, merppccupdate worked -> continue" >> $scriptlog 2>&1;;
          	     *)   echo "check2=$check2 -> ERROR -> merppccupdate failed" >> $scriptlog 2>&1
-                          continue 2 ;;
+                          com="merppccupdate failed for run $runno"
+                          check=$check2
+                          break ;;
              esac
              ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --html=$merpplogpath/merppcacoupdate$runno.html --auto-time $cacofile $calfile 2>> $scriptlog> /dev/null
@@ -242,20 +252,18 @@
                      0)   echo "check3=$check3 -> everything ok, merppcacoupdate worked -> continue" >> $scriptlog 2>&1;;
          	     *)   echo "check3=$check3 -> ERROR -> merppcacoupdate failed" >> $scriptlog 2>&1
-                          continue 2 ;;
+                          com="merppcacoupdate failed for run $runno"
+                          check=$check3
+                          break ;;
              esac
           done
-          
-          # set status for calibration if merpp updates are also done
-          echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
   	  ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
+     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+          com="calibration failed"
+          check=$check1
+          ;;
   esac
+  # set status 
+  echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 7467)
@@ -160,20 +160,18 @@
   
   echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./ganymed -b -q -v4 -f --ind=$datapath/star --config=$ganymedrc --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --out=$outpath $datasetfile  2>> $scriptlog> /dev/null
   check1=$?
 
   case $check1 in
-     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1
-          echo "inserting the status for $program for dataset $dataset into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
+     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1 ;;
+     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+          com="ganymed failed"
+          check=$check1
           ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
   esac
+  echo "inserting the status for $program for dataset $dataset into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 7467)
@@ -152,20 +152,18 @@
   
   echo "run $program..." >> $scriptlog 2>&1
+  setstatus "start"
+
   ./star -b -q -v4 -f --log=$outpath/$program$no2.log --html=$outpath/$program$no2.html --ind=$inpath --out=$outpath $sequfile  2>> $scriptlog> /dev/null
   check1=$?
 
   case $check1 in
-     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1
-          echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
-          statustime="Now()"
-          failed="NULL"
-          starttime="NULL"
-          failedtime="NULL"
-          var1=$no
-          var2=$no2
-          setstatus
-  	  ;;
-     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
+     0)   echo "check1=$check1 -> everything ok " >> $scriptlog 2>&1;;
+     *)   echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
+          com="star failed"
+          check=$check1
+          ;;
   esac
+  echo "inserting the status for $program for sequence $sequence into the db" >> $scriptlog 2>&1
+  setstatus "stop"
 done
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/sourcefile
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7465)
+++ trunk/MagicSoft/Mars/datacenter/scripts/sourcefile	(revision 7467)
@@ -61,10 +61,58 @@
 }
 
+function resetstatusvalues()
+{
+   statustime=NULL
+   starttime=NULL
+   failedcode=NULL
+   failedcomment=NULL
+   failedtime=NULL
+}
+
+function printstatusvalues()
+{
+   echo "the current values are:"
+   echo " statustime=$statustime"
+   echo " starttime=$starttime"
+   echo " failedcode=$failedcode"
+   echo " failedcomment=$failedcomment"
+   echo " failedtime=$failedtime"
+   echo "-- check: -$check-"
+   ech
+   echo ""
+}
+
 function setstatus()
 {
+   # set status values
+   resetstatusvalues
+   case $@ in 
+      start)   echo "start"
+               starttime="Now()"
+               ;;
+       stop)   echo "stop"
+               case $check in
+                  0)  echo " ok"
+                      statustime="Now()"
+                      ;;
+                  *)  echo " failed"
+                      starttime=noreset
+                      failedcode=$check
+                      failedcomment=$com
+                      failedtime="Now()"
+                      ;;
+               esac
+               ;;
+          *)   echo "error -> exit"
+               exit
+               ;;
+   esac
+   check=
+   
+   # set status 
    setstatuslogpath=$logpath/setstatus/$program/$var1
    makedir $setstatuslogpath >> $scriptlog 2>&1
-   setstatuslog=$setstatuslogpath/setstatus-$program-$var2.log
-   checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failed\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
+   setstatuslog=$setstatuslogpath/setstatus-$@-$program-$var2.log
+   checkstatus=`root -q -b $macrospath/setstatus.C+\("\"$sequence\""\,"\"$table\""\,"\"$column\""\,"\"$statustime\""\,"\"$failedcode\""\,"\"$failedcomment\""\,"\"$starttime\""\,"\"$failedtime\""\) | tee $setstatuslog | grep int | sed -e 's/(int)//'`
    case $checkstatus in
       1)   echo "checkstatus=$checkstatus -> everything ok, status has been set" >> $scriptlog 2>&1;;
@@ -72,2 +120,5 @@
    esac
 }
+
+
+
