Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 9053)
+++ trunk/MagicSoft/Mars/Changelog	(revision 9054)
@@ -18,4 +18,57 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2008/07/30 Daniela Dorner
+
+   * resources/steps.rc:
+     - added 
+     - adapted to new data structure
+
+   * steps.rc:
+     - removed
+
+   * datacenter/macros/setupdb.C, datacenter/macros/setstatus.C, 
+     datacenter/macros/getdolist.C:
+     - removed
+
+   * datacenter/db/datacheck.php, datacenter/db/datasetinfo.php, 
+     datacenter/db/magicdefs.php, datacenter/db/menu.php, 
+     datacenter/db/resetseq.php, datacenter/db/runinfo.php, 
+     datacenter/db/sequinfo.php, datacenter/macros/resetcolumn.C:
+     - removed fFailedCodeAdd
+     - changed fFailedCode to fProgramId
+
+   * datacenter/scripts/sourcefile:
+     - adapted path of steps.rc
+     - added new additional primaries to functions setstatus, getstatus
+       gettodo and getdolist
+     - merged function gettodo and getdolist
+     - removed todofile
+     - removed fFailedCodeAdd
+     - changed fFailedCode to fProgramId
+
+   * datacenter/scripts/buildsequenceentries, 
+     datacenter/scripts/checkfilesforsequenceavail, 
+     datacenter/scripts/checkstardone, datacenter/scripts/doexclusions, 
+     datacenter/scripts/fillcallisto, datacenter/scripts/fillstar, 
+     datacenter/scripts/fillganymed, 
+     datacenter/scripts/writedatasetfiles, 
+     datacenter/scripts/writesequencefiles:
+     - implemented usage of getodo (new merged function)
+     - removed todofile
+     - removed primval
+
+   * datacenter/scripts/runcallisto, datacenter/scripts/dodatacheck, 
+     datacenter/scripts/runganymed, datacenter/scripts/runstar:
+     - implemented usage of getodo (new merged function)
+     - removed primval
+
+   * datacenter/scripts/checkstardone
+     - removed comadd
+
+   * datacenter/scripts/runcallisto
+     - append output of stage.C instead of overwriting logfile
+
+
 
  2008/07/29 Stefan Ruegamer
Index: trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/buildsequenceentries	(revision 9054)
@@ -50,20 +50,12 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-# retrieve dates from todofile
-dates=(`cat $todofile`)
-if [ "$dates" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "dates: "${dates[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
-for date in ${dates[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   date=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    echo "building sequence entries for date $date..." >> $scriptlog 2>&1
    printprocesslog "INFO build sequence entries for $date"
@@ -73,8 +65,7 @@
    buildsequentrieslog=$buildsequentriespath/buildsequenceentries-$date.log
 
-   primvar=$date
    setstatus "start" >> $scriptlog 2>&1
 
-   check1=`root -q -b $macrospath/buildsequenceentries.C+\("\"$date\""\,"\"$datapath\""\,"\"$sequpath\""\,1\,kFALSE\) | tee $buildsequentrieslog | intgrep`
+   check1=`root -q -b $macrospath/buildsequenceentries.C+\("\"$date\""\,"\"$datapath\""\,"\"$sequpath\""\,$telnum\,kFALSE\) | tee $buildsequentrieslog | intgrep`
 
    case $check1 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail	(revision 9054)
@@ -50,20 +50,12 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-# retrieve sequences from todofile
-sequences=(`cat $todofile`)
-if [ "$sequences" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
-for sequence in ${sequences[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   sequence=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    echo "checking files for sequence $sequence..." >> $scriptlog 2>&1 
    printprocesslog "INFO checking files for sequence $sequence"
@@ -74,8 +66,7 @@
    checkfileavaillog=$checkfileavailpath/$program-$no2.log
 
-   primvar=$sequence
    setstatus "start" >> $scriptlog 2>&1
 
-   check1=`root -q -b $macrospath/checkfileavail.C+\($sequence,1\) | tee $checkfileavaillog | intgrep`
+   check1=`root -q -b $macrospath/checkfileavail.C+\($sequence,$telnum\) | tee $checkfileavaillog | intgrep`
 
    case $check1 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/checkstardone
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkstardone	(revision 9054)
@@ -48,19 +48,12 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-datasets=(`cat $todofile`)
-if [ "$datasets" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "datasets: "${datasets[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
-for dataset in ${datasets[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   dataset=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    echo "checking star done for sequences of dataset $dataset..." >> $scriptlog 2>&1 
    printprocesslog "INFO checking star done for sequences of dataset $dataset"
@@ -75,5 +68,4 @@
    makedir $outpath  >> $scriptlog 2>&1 
 
-   primvar=$dataset
    setstatus "start" >> $scriptlog 2>&1
 
@@ -95,5 +87,4 @@
            printprocesslog "ERROR checkstardone.C failed"
            com=$Fstardone
-           comadd=$sequence
            check=$check1
            break
Index: trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/dodatacheck	(revision 9054)
@@ -42,4 +42,5 @@
 printprocesslog "INFO starting $0"
 echo "This script has not been adapted to the new file structure (MAGIC II). "
+echo "Only the usage of getodo has been adapted, but not tested."
 echo "Please adapt it before using it."
 exit
@@ -54,6 +55,8 @@
 
 # get run # 
-gettodo >> $scriptlog 2>&1
-run=$process
+gettodo "1" >> $scriptlog 2>&1
+run=${primaries[0]}
+telnum=${primaries[1]}
+filenum=${primaries[2]}
 
 # lock sequ
@@ -74,5 +77,5 @@
 date2=`echo $date | sed -e 's/\//-/g'`
 
-primvar=$no2
+#primvar=$no2
 setstatus "start" >> $scriptlog 2>&1
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/doexclusions
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/doexclusions	(revision 9054)
@@ -50,20 +50,13 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-dates=(`cat $todofile`)
-if [ "$dates" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "dates: "${dates[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
 # do exclusions for each date in the todo file
-for date in ${dates[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   date=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    echo "do exclusions for date "$date >> $scriptlog 2>&1
    printprocesslog "INFO do exclusions for $date"
@@ -73,8 +66,7 @@
    doexclusionslog=$doexclusionspath/doexclusions-$date.log
 
-   primvar=$date
    setstatus "start" >> $scriptlog 2>&1
 
-   check1=`root -q -b $macrospath/doexclusions.C+\("\"$date\""\,1\,kFALSE\) | tee $doexclusionslog | intgrep`
+   check1=`root -q -b $macrospath/doexclusions.C+\("\"$date\""\,$telnum\,kFALSE\) | tee $doexclusionslog | intgrep`
 
    case $check1 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillcallisto	(revision 9054)
@@ -51,20 +51,13 @@
 
 # get todo file
-getdolist  >> $scriptlog 2>&1
-
-sequences=(`cat $todofile`)
-if [ "$sequences" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
 # fill information into the database for all sequences in the todo file
-for sequence in ${sequences[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   sequence=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    printprocesslog "INFO starting $program for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
@@ -79,5 +72,4 @@
 
    echo "run $program for sequence $sequence" >> $scriptlog 2>&1
-   primvar=$no2
    setstatus "start" >> $scriptlog 2>&1
    echo "run fillcalib..." >> $scriptlog 2>&1
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillganymed	(revision 9054)
@@ -50,21 +50,13 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-# retrieve datasets from todo file
-datasets=(`cat $todofile`)
-if [ "$datasets" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "datasets: "${datasets[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
 # run fillganymed for datasets
-for dataset in ${datasets[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   dataset=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    printprocesslog "INFO starting $program for dataset $dataset"
    no=`printf %08d $dataset | cut -c 0-5`
@@ -77,5 +69,4 @@
 
    echo "run $program for dataset $dataset" >> $scriptlog 2>&1
-   primvar=$no2
    setstatus "start" >> $scriptlog 2>&1
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/fillstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/fillstar	(revision 9054)
@@ -50,21 +50,13 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-# retrieve sequences from todo file
-sequences=(`cat $todofile`)
-if [ "$sequences" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
 # run fillstar for sequences
-for sequence in ${sequences[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   sequence=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    printprocesslog "INFO starting $program for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
@@ -77,5 +69,4 @@
 
    echo "run $program for sequence $sequence" >> $scriptlog 2>&1
-   primvar=$no2
    setstatus "start" >> $scriptlog 2>&1
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runcallisto
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runcallisto	(revision 9054)
@@ -53,6 +53,7 @@
 
 # get sequence # 
-gettodo >> $scriptlog 2>&1
-sequence=$process
+gettodo "1" >> $scriptlog 2>&1
+sequence=${primaries[0]}
+telnum=${primaries[1]}
 
 # lock sequ for cal
@@ -103,5 +104,4 @@
 fi
 
-primvar=$no2
 setstatus "start" >> $scriptlog 2>&1
 
@@ -109,6 +109,6 @@
 echo "staging files:" >> $scriptlog 2>&1
 
-echo 'root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee $scriptlog | intgrep' >> $scriptlog 2>&1 
-check0=`root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee $scriptlog | intgrep`
+echo 'root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee -a $scriptlog | intgrep' >> $scriptlog 2>&1 
+check0=`root -q -b $macrospath/stage.C\("\"$sequfile\""\) | tee -a $scriptlog | intgrep`
 
 case $check0 in
Index: trunk/MagicSoft/Mars/datacenter/scripts/runganymed
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runganymed	(revision 9054)
@@ -51,6 +51,7 @@
 
 # get dataset # 
-gettodo >> $scriptlog 2>&1
-dataset=$process
+gettodo "1" >> $scriptlog 2>&1
+dataset=${primaries[0]}
+telnum=${primaries[1]}
 
 # lock sequ
@@ -76,5 +77,4 @@
 fi
 
-primvar=$no2
 setstatus "start" >> $scriptlog 2>&1
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/runstar
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/runstar	(revision 9054)
@@ -52,6 +52,7 @@
 
 # get sequence # 
-gettodo >> $scriptlog 2>&1
-sequence=$process
+gettodo "1" >> $scriptlog 2>&1
+sequence=${primaries[0]}
+telnum=${primaries[1]}
 
 # lock sequ
@@ -71,5 +72,4 @@
 sequfile="$sequpath/$no/sequence$no2.txt"
 
-primvar=$no2
 setstatus "start" >> $scriptlog 2>&1
 
Index: trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writedatasetfiles	(revision 9054)
@@ -49,19 +49,12 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-datasets=(`cat $todofile`)
-if [ "$datasets" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "datasets: "${datasets[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
-for dataset in ${datasets[@]}
-do 
+for (( s=0 ; s < $num ; s++ ))
+do
+   dataset=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    echo "writing dataset file for dataset $dataset..." >> $scriptlog 2>&1 
    printprocesslog "INFO writing datasetfile for dataset $dataset"
@@ -74,5 +67,4 @@
    logfile=$writedatasetfilelogpath/$program-$no2.log
 
-   primvar=$dataset
    setstatus "start" >> $scriptlog 2>&1
    
Index: trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 9053)
+++ trunk/MagicSoft/Mars/datacenter/scripts/writesequencefiles	(revision 9054)
@@ -50,21 +50,13 @@
 
 # get todo list
-getdolist  >> $scriptlog 2>&1
-
-# get sequences from todo file
-sequences=(`cat $todofile`)
-if [ "$sequences" = "" ]
-then 
-   echo "nothing to do -> exit"  >> $scriptlog 2>&1
-   finish >> $scriptlog 2>&1
-fi
-echo "sequences: "${sequences[@]} >> $scriptlog 2>&1
-rm -v $todofile >> $scriptlog 2>&1
+gettodo  >> $scriptlog 2>&1
 
 cd $mars
 
-# write sequence file for all sequences in todo file
-for sequence in ${sequences[@]}
-do 
+# write sequence file for all sequences which don't have one yet
+for (( s=0 ; s < $num ; s++ ))
+do
+   sequence=${primaries[$s+$s]}
+   telnum=${primaries[$s+$s+1]}
    printprocesslog "INFO write sequence files for sequence $sequence"
    no=`printf %08d $sequence | cut -c 0-4`
@@ -78,8 +70,7 @@
 
    echo "write sequencefile for sequence $sequence" >> $scriptlog 2>&1
-   primvar=$no2
    setstatus "start" >> $scriptlog 2>&1
 
-   check2=`root -q -b $macrospath/writesequencefile.C\($sequence\,1\,"\"$sequpath\""\) | tee $writesequencefilelog | intgrep`
+   check2=`root -q -b $macrospath/writesequencefile.C\($sequence\,$telnum\,"\"$sequpath\""\) | tee $writesequencefilelog | intgrep`
    case $check2 in
       1)   echo " check2=$check2 -> everything ok " >> $scriptlog 2>&1 
