Index: branches/libIGCM_MPI_OpenMP/AA_SE_Checker
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_SE_Checker	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_SE_Checker	(revision 571)
@@ -18,8 +18,11 @@
 # all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string.
 
-# Chemin vers libIGCM
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# Attention : Ã  changer si la machine de post-traitement n'est pas la frontale du serveur de calcul !
-#             voir prÃ©cence de la variable MirrorlibIGCM dans votre couche systÃšme.
 
 # Expericence class of the run
@@ -83,10 +86,13 @@
 #====================================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications	(revision 571)
+++ branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications	(revision 571)
@@ -0,0 +1,150 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J SaveSource                     # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 0:10                   # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- platine #BSUB -L /bin/ksh
+#-Q- sx8brodie #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N SaveSource           # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=0:10:00   # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #####################
+#-Q- sx9mercure ## SX9MERCURE  CEA ##
+#-Q- sx9mercure #####################
+#-Q- sx9mercure #PBS -N SaveSource           # Nom du job
+#-Q- sx9mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx9mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx9mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx9mercure #PBS -l cputim_job=0:10:00   # Limite temps a 1 heures
+#-Q- sx9mercure #PBS -q scalaire
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r SaveSource     # Nom du job                
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 1800           # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-eo"
+#-Q- titane #MSUB -E "-L /bin/ksh"
+#-Q- titane #MSUB -E "-Ep "${ExeOutDateMax}
+#-Q- titane #MSUB -E "-Ep "${R_OUT_EXE}
+#-Q- titane #MSUB -E "-Ep "${PREFIX}
+#-Q- titane #MSUB -E "-Ep "${SUBMIT_DIR}
+#-Q- titane #MSUB -q testext
+#-Q- lxiv8 ###################### ???
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N SaveSource
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q test  
+#-Q- lxiv8 #PBS -o SaveSource.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#**************************************************************
+# Author: Martial Mancip
+# Contact: Martial.Mancip__at__ipsl.jussieu.fr
+# $Revision::                                          $ Revision of last commit
+# $Author::                                            $ Author of last commit
+# $Date::                                              $ Date of last commit
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#set -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+MODIPSL=::modipsl::
+
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+      ( ${DEBUG_debug} ) && IGCM_debug_Check
+#-------
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
+. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+IGCM_sys_Cd ${RUN_DIR_PATH}
+
+ExeOutDateMax=${ExeOutDateMax:=$1}
+R_OUT_EXE=${R_OUT_EXE:=$2}
+PREFIX=${PREFIX:=$3}
+SUBMIT_DIR=${SUBMIT_DIR:=$4}
+
+cd ${MODIPSL};
+${MODIPSL}/util/script_diff_model ${SUBMIT_DIR} > ${RUN_DIR_PATH}/out_script_diff_model 2>&1
+echo "script_diff_model return" $? >> ${RUN_DIR_PATH}/out_script_diff_model 2>&1
+cd ${RUN_DIR_PATH}
+
+ERR_script_diff_model=$( cat out_script_diff_model | grep "script_diff_model return [0-9]*" | sed -e "s&script_diff_model return *\([0-9]*\)&\1&" )
+
+if [ ! X${ERR_script_diff_model} = X0 ] ; then 
+    echo 'Error in script_diff_model :' ${ERR_script_diff_model}
+    exit ${ERR_script_diff_model}
+fi
+
+MODIPSL_SAVE_NAME=$( cat out_script_diff_model | grep "SAVE directory in" | sed -e "s&SAVE directory in  &&" )
+MODIPSL_SAVE=${MODIPSL}/tmp/${MODIPSL_SAVE_NAME}
+if ( [ X${MODIPSL_SAVE_NAME} = X ] || [ ! -d ${MODIPSL_SAVE} ] ) ; then 
+    echo 'Error in SaveSourceModifications: no MODIPSL_SAVE_NAME avaible. We STOP'
+    exit 1
+fi
+
+MaxModifiedDate=$( tail -1 ${MODIPSL_SAVE}/Last_log )
+
+cd ${MODIPSL}/tmp
+IGCM_sys_Tar ${RUN_DIR_PATH}/${MODIPSL_SAVE_NAME}.tar ${MODIPSL_SAVE_NAME}
+cd -
+if ( ! ${DEBUG_debug} ) ; then
+    IGCM_sys_Rm -rf ${MODIPSL_SAVE}
+fi
+
+if [ ${MaxModifiedDate} -lt ${ExeOutDateMax} ] ; then
+    IGCM_sys_Put_Out ${MODIPSL_SAVE_NAME}.tar ${R_OUT_EXE}/${PREFIX}_${MODIPSL_SAVE_NAME}_certified.tar
+else
+    IGCM_sys_Put_Out ${MODIPSL_SAVE_NAME}.tar ${R_OUT_EXE}/${PREFIX}_${MODIPSL_SAVE_NAME}_NOTcertified.tar
+fi
+if ( ! ${DEBUG_debug} ) ; then
+    IGCM_sys_Rm ${MODIPSL_SAVE_NAME}.tar
+fi
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+if ( ! ${DEBUG_debug} ) ; then
+    IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+fi
Index: branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker	(revision 571)
@@ -18,8 +18,11 @@
 # all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string.
 
-# Chemin vers libIGCM
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# Attention : Ã  changer si la machine de post-traitement n'est pas la frontale du serveur de calcul !
-#             voir prÃ©cence de la variable MirrorlibIGCM dans votre couche systÃšme.
 
 # Expericence class of the run
@@ -128,10 +131,13 @@
 #====================================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
@@ -392,5 +398,5 @@
 					ChunckCompletedFlag=${PotentialCompletedFlag[0]}
 					IGCM_debug_Print 2 -e "\033[1;31mToo Many Potential CompletedFlag\033[m Let start with first CompletedPeriod"
-					IGCM_debug_Print 2 -e "\033[1;31mYou will have to redo TimeSeries_Checker\033[m for other period.
+					IGCM_debug_Print 2 -e "\033[1;31mYou will have to redo TimeSeries_Checker\033[m for other period."
 				    fi
 				fi
Index: branches/libIGCM_MPI_OpenMP/AA_additionnal
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_additionnal	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_additionnal	(revision 571)
@@ -89,5 +89,5 @@
 #-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
 #-Q- sx9mercure #########################
-#-Q- sx9mercure #MSUB -r ATL_ADD        # Nom du job                
+#-Q- sx9mercure #MSUB -r ATL_ADD        # Nom du job
 #-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
 #-Q- sx9mercure #MSUB -n 2              # Reservation du processus
@@ -100,13 +100,9 @@
 #-Q- titane ## TITANE   CEA ##
 #-Q- titane ######################
-#-Q- titane #MSUB -r ATL_ADD        # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
-#-Q- titane #MSUB -n 2              # Reservation du processus
-#-Q- titane #MSUB -c 4              # Reservation du core
+#-Q- titane #MSUB -r ATL_ADD        # Nom du job
+#-Q- titane #MSUB -eo
+#-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- default #!/bin/ksh
 #-Q- default ##################
Index: branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r ATL_LMDZ       # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- default #!/bin/ksh
 #-Q- default ##################
@@ -188,7 +185,9 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r ATL_OPA        # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- default #!/bin/ksh
 #-Q- default ##################
@@ -184,10 +181,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r ATL_ORCH       # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
 #-Q- lxiv8 ## OBELIX      LSCE ##
@@ -193,10 +190,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES	(revision 571)
@@ -98,12 +98,9 @@
 #-Q- titane ## TITANE   CEA ##
 #-Q- titane ######################
-#-Q- titane #MSUB -r ATL_PIS        # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -r ATL_PIS        # Nom du job
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- default #!/bin/ksh
 #-Q- default ##################
@@ -185,10 +182,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_clean_month
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_clean_month	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_clean_month	(revision 571)
@@ -77,9 +77,12 @@
 #====================================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 IGCM_sys_TestDirArchive ${R_SAVE}
@@ -88,5 +91,5 @@
 if [ ! -f ${SUBMIT_DIR}/run.card ]; then 
     echo "You seem NOT to have a run.card in this directory !!"
-    echo "This script will fail because it doesn't know what to do without run.card avaible."
+    echo "This script will fail because it doesn't know what to do without run.card available."
     exit 1
 else
@@ -104,4 +107,8 @@
     set +A ListFiles -- $( IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" " )
     CountListFiles=${#ListFiles[@]}
+
+    echo "Search files with ${PeriodDateEnd} in ${R_BUFR}"
+    set +A ListFilesBuf -- $( IGCM_sys_RshMaster "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" " )
+    CountListFilesBuf=${#ListFilesBuf[@]}
 
     # If exist, erase REBUILD DIR
@@ -124,7 +131,10 @@
 	    IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m"
 	done
+	for file in ${ListFilesBuf[@]} ; do
+	    IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m"
+	done
 
-	echo "\033[1;32mDo you REALLY want to erase all those files ?"
-	echo -n " Your answer (y/n) : \033[m"
+	echo -e "\033[1;32mDo you REALLY want to erase all those files ?"
+	echo -n -e " Your answer (y/n) : \033[m"
 	read reponse
 	case ${reponse} in
@@ -133,4 +143,5 @@
 		echo "OK. It will be erased."
 		IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
+		IGCM_sys_RshMaster  "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
 		echo "done."
 		;;
@@ -147,6 +158,6 @@
 	done
 
-	echo "\033[1;32mDo you REALLY want to erase all those Directories ?"
-	echo -n " Your answer (y/n) : \033[m"
+	echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?"
+	echo -n -e " Your answer (y/n) : \033[m"
 	read reponse
 	case ${reponse} in
Index: branches/libIGCM_MPI_OpenMP/AA_create_multi_se
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_create_multi_se	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_create_multi_se	(revision 571)
@@ -31,5 +31,5 @@
 #-Q- sx8brodie #######################
 #-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
-#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # @ wall_clock_limit = 1:00:00
 #-Q- sx8brodie # Nom du travail LoadLeveler
 #-Q- sx8brodie # @ job_name   = MULTISE
@@ -47,5 +47,5 @@
 #-Q- aix6 #######################
 #-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
-#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # @ wall_clock_limit = 1:00:00
 #-Q- aix6 # Nom du travail LoadLeveler
 #-Q- aix6 # @ job_name   = MULTISE
@@ -63,5 +63,5 @@
 #-Q- ulam #######################
 #-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
-#-Q- ulam # @ wall_clock_limit = 10:00:00
+#-Q- ulam # @ wall_clock_limit = 1:00:00
 #-Q- ulam # Nom du travail LoadLeveler
 #-Q- ulam # @ job_name   = MULTISE
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r MULTISE             # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
 #-Q- lxiv8 ## OBELIX      LSCE ##
@@ -146,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
+#D- Path to libIGCM
 #D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #D- Flag to determine atlas job's output directory
@@ -241,10 +238,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_create_se
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_create_se	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_create_se	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r SE             # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
 #-Q- lxiv8 ## OBELIX      LSCE ##
@@ -146,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
+#D- Path to libIGCM
 #D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #D- Flag to determine if rebuild process has been performed asynchronously
@@ -251,10 +248,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_create_ts
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_create_ts	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_create_ts	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r TS             # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
 #-Q- lxiv8 ## OBELIX      LSCE ##
@@ -146,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
+#D- Path to libIGCM
 #D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #D- Flag to determine allready produced time series. Empty if you start from the beginning
@@ -271,10 +268,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
@@ -469,115 +469,4 @@
 ########################################################################
 #
-#                          DEFINE DATE FUNCTIONS
-#
-########################################################################
-
-# Give the end of the next $1 period from $2 date
-function create_ts_next_date {
-    IGCM_debug_PushStack "create_ts_next_date" $@
-    typeset Length
-    case ${config_UserChoices_PeriodLength} in
-	*Y|*y) 
-	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-	    IGCM_date_GetYearMonth ${1} year month
-	    year=$( IGCM_date_SupressZeros ${year} )
-	    (( Length=0 ))
-	    (( i=0 ))
-	    until [ $i -ge $PeriodLengthInYears ] ; do
-		(( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) 
-	        (( i=i+1 ))
-	    done
-	    ;;
-	*M|*m) 
-	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
-	    IGCM_date_GetYearMonth ${1} year month
-	    year=$( IGCM_date_SupressZeros ${year} )
-	    (( year0 = year ))
-	    if [ $(( month + 1 )) -lt 13 ] ; then
-		month0=$(( month + 1 ))
-	    else
-		month0=$(( month + 1 - 12 ))
-		(( year = year0 + 1 ))
-	    fi
-	    (( Length=0 ))
-	    (( i=0 ))
-	    until [ $i -ge $PeriodLengthInMonths ] ; do
-		if [ $(( month0 + i )) -lt 13 ] ; then
-		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))
-		else
-		    (( year = year0 + 1 ))
-		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))
-		fi
-	        (( i=i+1 ))
-	    done
-	    ;;
-	*D|*d)
-	    Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
-	*)
-	    IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."
-	    IGCM_debug_Verif_Exit_Post ;;
-    esac
-    echo ${Length}
-
-    IGCM_debug_PopStack "create_ts_next_date"
-}
-
-# Give the end of the actual $1 period from $2 date
-function create_ts_begin_date {
-    IGCM_debug_PushStack "create_ts_begin_date" $@
-    typeset Length
-    case ${config_UserChoices_PeriodLength} in
-	*Y|*y) 
-	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
-	    IGCM_date_GetYearMonth ${1} year month
-	    year=$( IGCM_date_SupressZeros ${year} )
-	    if [ X${2} = Xend ] ; then
-		(( year = year - PeriodLengthInYears + 1))
-	    fi
-	    (( Length=0 ))
-	    (( i=0 ))
-	    until [ $i -ge $PeriodLengthInYears ] ; do
-		(( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
-	        (( i=i+1 ))
-	    done
-	    ;;
-	*M|*m) 
-	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
-	    IGCM_date_GetYearMonth ${1} year month
-	    year=$( IGCM_date_SupressZeros ${year} )
-	    if [ X${2} = Xend ] ; then
-		(( month = month - PeriodLengthInMonths + 1 ))
-	    fi	    
-	    (( year0 = year ))
-	    if [ $month -le 0 ] ; then
-		(( month = month + 12 ))
-		year=$( printf "%04i\n" $(( year - 1 )) )
-	    fi
-	    month=$( printf "%02i\n" ${month} )
-	    (( Length=0 ))
-	    (( i=0 ))
-	    until [ $i -ge $PeriodLengthInMonths ] ; do
-		if [ $(( month + i )) -lt 13 ] ; then
-		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))
-		else
-		    (( year = year0 + 1 ))
-		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))
-		fi
-	        (( i=i+1 ))
-	    done
-	    ;;
-	*D|*d)
-	    Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
-	*)
-	    IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in *Y, *M, *D."
-	    IGCM_debug_Verif_Exit_Post ;;
-    esac
-    echo ${Length}
-
-    IGCM_debug_PopStack "create_ts_begin_date"
-}
-
-########################################################################
-#
 #               IS THERE SOME ALLREADY PRODUCED TIME SERIES ?
 #                 IF SO BRING THEM IN THE WORKING DIRECTORY
@@ -622,5 +511,5 @@
     # First Time Series Submission
     FIRST_PASS=TRUE
-    Length=$( create_ts_begin_date ${DateBegin} begin)
+    Length=$( IGCM_date_DaysInPreviousPeriod ${DateBegin} ${config_UserChoices_PeriodLength} begin)
     DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) )
 else
@@ -692,5 +581,5 @@
     while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do
 	(( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 ))
-	Length=$( create_ts_next_date ${DATE_COUNT} )
+	Length=$( IGCM_date_DaysInNextPeriod ${DATE_COUNT} ${config_UserChoices_PeriodLength} )
 	DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} )
     done
@@ -723,5 +612,5 @@
 	    DATE_COURANTE=${DATE_FIN_JOB_B_LOOP}
 	else
-	    Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
+	    Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} )
 	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
 	fi
@@ -740,10 +629,10 @@
 
         if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then
-	    Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} )
+	    Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN_JOB_B_LOOP} ${config_UserChoices_PeriodLength} )
 	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
 	elif [ -z "${DATE_COURANTE}" ] ; then
 	    DATE_COURANTE=${DATE_FIN_JOB_B}
 	else
-	    Length=$( create_ts_next_date ${DATE_FIN} )
+	    Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} )
 	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
 	fi
@@ -755,5 +644,5 @@
 	while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do
 	    #
-	    Length=$( create_ts_next_date ${DATE_LOOP} )
+	    Length=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} )
 	    DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} )
 	    (( TotLength = TotLength + Length ))
@@ -772,5 +661,5 @@
 	[ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
 
-	Length=$( create_ts_next_date ${DATE_FIN} )
+	Length=$( IGCM_date_DaysInNextPeriod ${DATE_FIN} ${config_UserChoices_PeriodLength} )
 	DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
 	DATE_FIN=${PeriodDateEnd}
@@ -823,8 +712,8 @@
 	    while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do
 		#
-		Length1=$( create_ts_begin_date ${DATE_LOOP} end)
+		Length1=$( IGCM_date_DaysInPreviousPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} end)
 	        DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP}
 
-		Length2=$( create_ts_next_date ${DATE_LOOP} end)
+		Length2=$( IGCM_date_DaysInNextPeriod ${DATE_LOOP} ${config_UserChoices_PeriodLength} )
 		DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} )
 
@@ -856,5 +745,5 @@
 	    # WE CAN CONCATENATE FILES AT THIS POINT
 	    [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC}
-	    Length=$( create_ts_begin_date ${DATE_COURANTE} end)
+	    Length=$( IGCM_date_DaysInPreviousPeriod ${DATE_COURANTE} ${config_UserChoices_PeriodLength} end)
 	    DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) )
 	    DATE_BUILD=${DATE_BUILD1}_${DATE_FIN}
Index: branches/libIGCM_MPI_OpenMP/AA_monitoring
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_monitoring	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_monitoring	(revision 571)
@@ -99,11 +99,8 @@
 #-Q- titane ######################
 #-Q- titane #MSUB -r MONITORING     # Nom du job                
-#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -E "-j o"
-#-Q- titane #MSUB -E "-S /bin/ksh"
-#-Q- titane ##MSUB -e nco.out        # Sortie standard
-#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
 #-Q- lxiv8 ## OBELIX      LSCE ##
@@ -146,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
+#D- Path to libIGCM
 #D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #D- Increased verbosity (1, 2, 3)
@@ -230,10 +227,13 @@
 #==================================
 #R_SAVE : Job output directory
+#R_BUFR : Job output buffered directory
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
 else
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
Index: branches/libIGCM_MPI_OpenMP/AA_move-and-rename
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_move-and-rename	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_move-and-rename	(revision 571)
@@ -33,12 +33,14 @@
 ########################################################################
 
-# Chemin vers MODIPSL
+# Path to modipsl
 MODIPSL=${MODIPSL:=::modipsl::}
 
-# Chemin vers libIGCM
-libIGCM=${libIGCM:=${MODIPSL}/libIGCM}
-# Attention : Ã  changer si la machine de post-traitement n'est pas la frontale du serveur de calcul !
-#             voir prÃ©cence de la variable MirrorlibIGCM dans votre couche systÃšme.
-
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
 
 DEBUG_sys=false
Index: branches/libIGCM_MPI_OpenMP/AA_pack_debug
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_pack_debug	(revision 571)
+++ branches/libIGCM_MPI_OpenMP/AA_pack_debug	(revision 571)
@@ -0,0 +1,351 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J PACKDEBUG            # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 4:00                   # Limite temps
+#-Q- platine #BSUB -q post                   # Passage en queue post
+#-Q- platine #BSUB -L /bin/ksh
+#-Q- sx8brodie #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = PACKDEBUG
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = PACKDEBUG
+#-Q- aix6 # Fichier de sortie standard du travail
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- aix6 # @ queue
+#-Q- ulam #!/bin/ksh
+#-Q- ulam #######################
+#-Q- ulam ##   VARGAS   IDRIS  ##
+#-Q- ulam #######################
+#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- ulam # @ wall_clock_limit = 10:00:00
+#-Q- ulam # Nom du travail LoadLeveler
+#-Q- ulam # @ job_name   = PACKDEBUG
+#-Q- ulam # Fichier de sortie standard du travail
+#-Q- ulam # @ output     = $(job_name).$(jobid)
+#-Q- ulam # Fichier de sortie d'erreur du travail
+#-Q- ulam # @ error      =  $(job_name).$(jobid)
+#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- ulam # @ notification = error
+#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- ulam # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N PACKDEBUG          # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=24:00:00  # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure ######################
+#-Q- sx9mercure ## CESIUM   CEA ##
+#-Q- sx9mercure ######################
+#-Q- sx9mercure #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA     ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- titane #MSUB -eo
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -q mono
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N PACKDEBUG
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o PACKDEBUG.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
+# $Revision::                                          $ Revision of last commit
+# $Author::                                            $ Author of last commit
+# $Date::                                              $ Date of last commit
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#set -eu
+#set -vx
+
+date
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+
+#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
+MASTER=${MASTER:=mercure|titane|brodie|vargas}
+
+#D- Flag to determine begin date for restart pack
+#D- Default : value from AA_job if any
+DateBegin=${DateBegin:=20000101}
+
+#D- Flag to determine end date for restart pack
+#D- Default : value from AA_job if any
+DateEnd=${DateEnd:=20691231}
+
+#D- Flag to determine pack period
+#D- Default : value from AA_job if any
+PeriodPack=${PeriodPack:=10Y}
+
+#D- Uncomment to run interactively
+#D- For testing purpose, will be remove
+#SUBMIT_DIR=${PWD}
+#RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test
+
+#D- Increased verbosity (1, 2, 3)
+#D- Default : value from AA_job if any
+Verbosity=${Verbosity:=3}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+DEBUG_debug=${DEBUG_debug:=false}
+
+#D- Keep following comments for now. Will be remove.
+
+#on veut archiver les fichiers restart
+#Dans le cadre du demenagement ils seront renommes
+#ATM/Restart/****.nc
+#OCE/Restart/****.nc
+#...
+#sous la forme
+#RESTART/ATM_****.nc
+#RESTART/OCE_****.nc
+#Attention de bien conserver les dates d'origines 
+#
+#Dans le cadre de la production nouvelle chaine
+#ils auront directement le bon nom
+#
+#On veut egalement que l'archive soit par periode de temps 
+# cette periode est definie par la taille du pack donc connue 
+# en entree du script (1M, 1Y, 5Y, 10Y etc...) 
+#
+# $1= PATH/config_card d'une simulation avec 
+# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL
+# $2=PeriodPack en M/m ou Y/y
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+( ${DEBUG_debug} ) && IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+( ${DEBUG_debug} ) && IGCM_card_Check
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
+( ${DEBUG_debug} ) && IGCM_date_Check
+#-------
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
+. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
+
+########################################################################
+
+#set -vx
+
+RUN_DIR=${RUN_DIR_PATH}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
+fi
+
+#
+# First of all
+#
+#### 0- lecture de config.card 
+#### on veut les renseignements suivants : 
+#### JobName, PATH_SIMUL, DateBegin et DateEnd
+
+IGCM_card_DefineArrayFromSection     ${CARD_DIR}/config.card UserChoices
+typeset option
+for option in ${config_UserChoices[*]} ; do
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+done
+#
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+IGCM_debug_PrintVariables 3 config_UserChoices_LongName
+IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+echo
+
+#====================================================
+#R_SAVE : Job output storage directory
+#R_BUFR : Job output buffered directory
+
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+IGCM_sys_TestDirArchive ${R_SAVE}
+[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+#### Preparation de l'environnement
+# repertoire dans lequel seront crees les archives
+#STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG
+STORE_DEBUG=${R_SAVE}/DEBUG
+IGCM_sys_MkdirArchive ${STORE_DEBUG}
+
+# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
+JobName=${config_UserChoices_JobName}
+PATH_SIMUL=${R_BUFR}
+echo $JobName $PATH_SIMUL $DateBegin $DateEnd
+
+#### 1- renommer les fichiers ######
+#cd ${STORE_DEBUG}
+#rm -rf *
+
+# On les copie sur le scratchdir en changeant le nom et conservant la date
+# Clear txt file lists
+rm -f ${RUN_DIR}/liste_debug_files.txt
+rm -f ${RUN_DIR}/new_liste_debug_files.txt
+rm -f ${RUN_DIR}/liste_pack_*.txt
+
+# Create sorted debug list to work with
+find ${PATH_SIMUL}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt
+
+# Rename debug files we will work with using symlinks
+#gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt
+gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt
+
+# List renamed debug files
+find ${RUN_DIR} -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+# Init loop
+date_begin_pack=${DateBegin}
+date_end_simulation=${DateEnd}
+number_pack=1
+
+IGCM_debug_PrintVariables 3 date_begin_pack
+IGCM_debug_PrintVariables 3 date_end_simulation
+
+while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do
+
+  IGCM_debug_PrintVariables 3 number_pack
+
+  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} )
+  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} )
+
+  for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do
+    extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_[0-9]*_//" )
+    date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
+#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack} 
+    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 
+        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
+	echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
+
+#    Will not work. Need to find a better ordering.
+#    elif [ ${date_file} -ge ${date_end_pack} ] ; then
+#      break
+    fi
+  done
+
+  # Create tar files
+  IGCM_debug_Print 1 "Tar ongoing"
+  tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt
+  # Save it
+  IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar ${STORE_DEBUG}
+  # Clean it
+  IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar
+  # Clean links
+  cat ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm
+  # Clean files links pointed to
+  cat ${RUN_DIR}/liste_remove_pack_${number_pack}.txt | xargs rm
+  # Save the list of files that has been pack (tar)
+  mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_DEBUG}
+  IGCM_debug_Print 1 "Tar and cleaning done"
+
+  (( number_pack = number_pack + 1 ))
+
+  # Add 1 day to date_end_pack to have the new date_begin_pack
+  date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 )
+
+done
Index: branches/libIGCM_MPI_OpenMP/AA_pack_restart
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_pack_restart	(revision 571)
+++ branches/libIGCM_MPI_OpenMP/AA_pack_restart	(revision 571)
@@ -0,0 +1,351 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r PACKRESTART    # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J PACKRESTART            # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 4:00                   # Limite temps
+#-Q- platine #BSUB -q post                   # Passage en queue post
+#-Q- platine #BSUB -L /bin/ksh
+#-Q- sx8brodie #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = PACKRESTART
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = PACKRESTART
+#-Q- aix6 # Fichier de sortie standard du travail
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- aix6 # @ queue
+#-Q- ulam #!/bin/ksh
+#-Q- ulam #######################
+#-Q- ulam ##   VARGAS   IDRIS  ##
+#-Q- ulam #######################
+#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- ulam # @ wall_clock_limit = 10:00:00
+#-Q- ulam # Nom du travail LoadLeveler
+#-Q- ulam # @ job_name   = PACKRESTART
+#-Q- ulam # Fichier de sortie standard du travail
+#-Q- ulam # @ output     = $(job_name).$(jobid)
+#-Q- ulam # Fichier de sortie d'erreur du travail
+#-Q- ulam # @ error      =  $(job_name).$(jobid)
+#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- ulam # @ notification = error
+#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- ulam # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N PACKRESTART          # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=24:00:00  # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure ######################
+#-Q- sx9mercure ## CESIUM   CEA ##
+#-Q- sx9mercure ######################
+#-Q- sx9mercure #MSUB -r PACKRESTART    # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA     ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r PACKRESTART    # Nom du job                
+#-Q- titane #MSUB -eo
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -q mono
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N PACKRESTART
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o PACKRESTART.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
+# $Revision::                                          $ Revision of last commit
+# $Author::                                            $ Author of last commit
+# $Date::                                              $ Date of last commit
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#set -eu
+#set -vx
+
+date
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+
+#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
+MASTER=${MASTER:=mercure|titane|brodie|vargas}
+
+#D- Flag to determine begin date for restart pack
+#D- Default : value from AA_job if any
+DateBegin=${DateBegin:=20000101}
+
+#D- Flag to determine end date for restart pack
+#D- Default : value from AA_job if any
+DateEnd=${DateEnd:=20691231}
+
+#D- Flag to determine pack period
+#D- Default : value from AA_job if any
+PeriodPack=${PeriodPack:=10Y}
+
+#D- Uncomment to run interactively
+#D- For testing purpose, will be remove
+#SUBMIT_DIR=${PWD}
+#RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test
+
+#D- Increased verbosity (1, 2, 3)
+#D- Default : value from AA_job if any
+Verbosity=${Verbosity:=3}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+DEBUG_debug=${DEBUG_debug:=false}
+
+#D- Keep following comments for now. Will be remove.
+
+#on veut archiver les fichiers restart
+#Dans le cadre du demenagement ils seront renommes
+#ATM/Restart/****.nc
+#OCE/Restart/****.nc
+#...
+#sous la forme
+#RESTART/ATM_****.nc
+#RESTART/OCE_****.nc
+#Attention de bien conserver les dates d'origines 
+#
+#Dans le cadre de la production nouvelle chaine
+#ils auront directement le bon nom
+#
+#On veut egalement que l'archive soit par periode de temps 
+# cette periode est definie par la taille du pack donc connue 
+# en entree du script (1M, 1Y, 5Y, 10Y etc...) 
+#
+# $1= PATH/config_card d'une simulation avec 
+# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL
+# $2=PeriodPack en M/m ou Y/y
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+( ${DEBUG_debug} ) && IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+( ${DEBUG_debug} ) && IGCM_card_Check
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
+( ${DEBUG_debug} ) && IGCM_date_Check
+#-------
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
+. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
+
+########################################################################
+
+#set -vx
+
+RUN_DIR=${RUN_DIR_PATH}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
+fi
+
+#
+# First of all
+#
+#### 0- lecture de config.card 
+#### on veut les renseignements suivants : 
+#### JobName, PATH_SIMUL, DateBegin et DateEnd
+
+IGCM_card_DefineArrayFromSection     ${CARD_DIR}/config.card UserChoices
+typeset option
+for option in ${config_UserChoices[*]} ; do
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+done
+#
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+IGCM_debug_PrintVariables 3 config_UserChoices_LongName
+IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+echo
+
+#====================================================
+#R_SAVE : Job output storage directory
+#R_BUFR : Job output buffered directory
+
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+IGCM_sys_TestDirArchive ${R_SAVE}
+[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+#### Preparation de l'environnement
+# repertoire dans lequel seront crees les archives
+#STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART
+STORE_RESTART=${R_SAVE}/RESTART
+IGCM_sys_MkdirArchive ${STORE_RESTART}
+
+# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
+JobName=${config_UserChoices_JobName}
+PATH_SIMUL=${R_BUFR}
+echo $JobName $PATH_SIMUL $DateBegin $DateEnd
+
+#### 1- renommer les fichiers ######
+#cd ${STORE_RESTART}
+#rm -rf *
+
+# On les copie sur le scratchdir en changeant le nom et conservant la date
+# Clear txt file lists
+rm -f ${RUN_DIR}/liste_restart_files.txt
+rm -f ${RUN_DIR}/new_liste_restart_files.txt
+rm -f ${RUN_DIR}/liste_pack_*.txt
+
+# Create sorted restart list to work with
+find ${PATH_SIMUL}/*/Restart -name "*nc" | sort >> ${RUN_DIR}/liste_restart_files.txt
+
+# Rename restart files we will work with using symlinks
+#gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt
+gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_restart_files.txt
+
+# List renamed restart files
+find ${RUN_DIR} -name "*.nc" -ls | sort -k 11 > ${RUN_DIR}/new_liste_restart_files.txt
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+# Init loop
+date_begin_pack=${DateBegin}
+date_end_simulation=${DateEnd}
+number_pack=1
+
+IGCM_debug_PrintVariables 3 date_begin_pack
+IGCM_debug_PrintVariables 3 date_end_simulation
+
+while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do
+
+  IGCM_debug_PrintVariables 3 number_pack
+
+  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} )
+  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} )
+
+  for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_restart_files.txt ); do
+    extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_//" )
+    date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
+#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack} 
+    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 
+        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
+	echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
+
+#    Will not work. Need to find a better ordering.
+#    elif [ ${date_file} -ge ${date_end_pack} ] ; then
+#      break
+    fi
+  done
+
+  # Create tar files
+  IGCM_debug_Print 1 "Tar ongoing"
+  tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt
+  # Save it
+  IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar ${STORE_RESTART}
+  # Clean it
+  IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_restart.tar
+  # Clean links
+  cat ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm
+  # Clean files links pointed to
+  cat ${RUN_DIR}/liste_remove_pack_${number_pack}.txt | xargs rm
+  # Save the list of files that has been pack (tar)
+  mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_RESTART}
+  IGCM_debug_Print 1 "Tar and cleaning done"
+
+  (( number_pack = number_pack + 1 ))
+
+  # Add 1 day to date_end_pack to have the new date_begin_pack
+  date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 )
+
+done
Index: branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive	(revision 571)
@@ -102,5 +102,4 @@
 #-Q- titane #MSUB -n 1               # Reservation du processus
 #-Q- titane #MSUB -T 86400           # Limite de temps elapsed du job
-#-Q- titane #MSUB -p gen2211
 #-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
@@ -144,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
-#D- Default : value from AA_job if any
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
Index: branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir
===================================================================
--- branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir	(revision 571)
@@ -102,5 +102,4 @@
 #-Q- titane #MSUB -n 1              # Reservation du processus
 #-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
-#-Q- titane #MSUB -p gen2211
 #-Q- titane #MSUB -q mono
 #-Q- lxiv8 ######################
@@ -144,11 +143,11 @@
 StandAlone=${StandAlone:=true}
 
-#D- Low level debug : to bypass lib test checks and stack construction
-#D- Default : value from AA_job if any
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
 libIGCM=${libIGCM:=::modipsl::/libIGCM}
-# WARNING for StandAlone used : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
 
 #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
Index: branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh	(revision 571)
@@ -15,187 +15,217 @@
 function IGCM_comp_Initialize
 {
-    IGCM_debug_PushStack "IGCM_comp_Initialize"
+  IGCM_debug_PushStack "IGCM_comp_Initialize"
 
     # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_Initialize"
+  echo
+
+  typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option option i j
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Debug Print
+    IGCM_debug_Print 1 "Initialize ${comp} : ${compname} component."
+
+    # Define component 
+    IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+    # Read libIGCM compatibility version in ${compname}.card
+    card=${SUBMIT_DIR}/COMP/${compname}.card
+    IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM
+
+    eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1	
+    if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
+      IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
+    fi
+
+    # Manage component executable
+    IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp}
+
+    # Read component Write Frequency in config.card
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency
+    # Debug Print :
+    eval auxprint=\${config_${comp}_WriteFrequency}
+    IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} "
+    #2> /dev/null
+
+    # Debug Print :
+    IGCM_debug_Print 2 "Initialize following component library"
+
+    # Source drivers in directory DRIVER if it exist
+    # else source them from directory COMP
+    if [ -d ${SUBMIT_DIR}/DRIVER ] ; then
+      IGCM_debug_Print 2 ${SUBMIT_DIR}/DRIVER/${compname}.driver
+      # Source component library
+      . ${SUBMIT_DIR}/DRIVER/${compname}.driver
+    else
+      IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver
+      # Source component library
+      . ${SUBMIT_DIR}/COMP/${compname}.driver
+    fi
+    IGCM_debug_Print 3 "With tag : ${comptagname}"
+
+    # Debug Print
+    IGCM_debug_Print 3 "Initialize ${comp} output directory."
+
+    # Define ARCHIVED Dirs
+    eval R_OUT_${comp}=${R_SAVE}/${comp}
+    eval IGCM_sys_MkdirArchive \${R_OUT_${comp}}
+
+    eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output
+    eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O}
+
+    eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart
+    eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R}
+
+    eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug
+    eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D}
+
+    eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS
+    eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF
+    eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA
+    eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO
+    eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE
+
+    # Define BUFFERED Dirs
+    eval R_BUF_${comp}=${R_BUFR}/${comp}
+    eval IGCM_sys_Mkdir \${R_BUF_${comp}}
+
+    eval R_BUF_${comp}_O=\${R_BUF_${comp}}/Output
+    eval IGCM_sys_Mkdir \${R_BUF_${comp}_O}
+
+    eval R_BUF_${comp}_R=\${R_BUF_${comp}}/Restart
+    eval IGCM_sys_Mkdir \${R_BUF_${comp}_R}
+
+    eval R_BUF_${comp}_D=\${R_BUF_${comp}}/Debug
+    eval IGCM_sys_Mkdir \${R_BUF_${comp}_D}
+
+    eval R_BUF_${comp}_O_I=\${R_BUF_${comp}_O}/INS
+    eval R_BUF_${comp}_O_H=\${R_BUF_${comp}_O}/HF
+    eval R_BUF_${comp}_O_D=\${R_BUF_${comp}_O}/DA
+    eval R_BUF_${comp}_O_M=\${R_BUF_${comp}_O}/MO
+    eval R_BUF_${comp}_O_Y=\${R_BUF_${comp}_O}/YE
+
+    # Read UserChoices section of component card
+    IGCM_debug_Print 2 "DefineArrayFromSection : ${compname}_UserChoices ${card}"
+    IGCM_card_DefineArrayFromSection ${card} UserChoices
+    eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1
+    # If section is not empty we define corresponding variables
+    if [ X${first_option} != X"Error:" ] ; then
+      if [ X${card_UserChoices[0]} != X ] ; then
+	unset card_UserChoices
+      fi
+      eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1
+      IGCM_debug_Print 3 "${compname}_UserChoices_values:"
+      for option in ${card_UserChoices[*]} ; do
+	IGCM_card_DefineVariableFromOption ${card} UserChoices ${option}
+	eval IGCM_debug_Print 3 "${option}=\${${compname}_UserChoices_${option}}"
+      done
+    fi
+
+    # Read and Build Output File stuff
+    IGCM_debug_Print 2 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
+    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
+    ListFilesName=${compname}_OutputFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+    #
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+      #
+      #IGCM_debug_Print 1 "Component      : ${compname}"
+      #
+      # INITIALISATION
+      #
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+      #
+      i=2
+      #
+      until [ $i -ge $NbFiles ]; do
+	#
+	eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	#
+	if [ X${flag_post} != XNONE ] ; then
+	  #
+          # First of all
+          #
+	  IGCM_card_DefineArrayFromSection ${card} ${flag_post}
+	  #
+	  # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
+	  #
+	  # variable option allready typeset above
+	  for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
+	    if [ ${option} = Seasonal ] ; then
+	      FoundSeasonal=true
+	      IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
+	    fi
+	  done
+	  #
+	  if [ ! X${FoundSeasonal} = Xtrue ] ; then
+	    eval ${compname}_${flag_post}_Seasonal=ON
+	  fi
+	  #
+	  if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then
+	    Seasonal=true
+	  fi
+	  
+	  # Dimension = vide si vieille card.
+	  IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
+	  IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
+	  if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not" ] ; then
+	    # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
+	    ListDimension[0]=2D
+	    ListDimension[1]=3D
+	    TimeSeries=false
+	    iLoop=${#ListDimension[*]}
+	    j=0
+	    until [ $j -ge ${iLoop} ]; do
+	      Dimension=${ListDimension[${j}]}
+	      IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
+	      IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
+	      #
+	      # Time series WITHOUT chunk
+	      #
+	      if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+		if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
+		  IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post}"
+		  eval TimeSeries${Dimension}=true
+		fi
+	      fi
+              #
+	      # Time series WITH chunk
+	      #
+	      if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+		chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
+		if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
+		  IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post}"
+		  eval TimeSeriesChunck${Dimension}=true
+		  eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp}
+		  eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i}
+		  eval set +A CHUNCK${Dimension}_NAME \${CHUNCK${Dimension}_NAME[*]} ${flag_post}
+		  eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size}
+		fi
+	      fi
+	      (( j=j+1 ))
+	    done
+	  else
+	    ListDimension[0]=""
+	    TimeSeries=true
+	    TimeSeries2D=false
+	    TimeSeries3D=false
+	    TimeSeriesChunck2D=false
+	    TimeSeriesChunck3D=false
+	  fi
+	fi
+	(( i=i+3 ))
+      done
+    fi
+    # Debug Print
+    IGCM_debug_Print 3 "Initialize ${compname} with driver."
+    # INIT component
+    ${comp}_Initialize
     echo
-    IGCM_debug_Print 1 "IGCM_comp_Initialize"
-    echo
-
-    typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option option i j
-    for comp in ${config_ListOfComponents[*]} ; do
-        # Debug Print
-	IGCM_debug_Print 1 ${comp}
-	# Define component 
-        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	# Read libIGCM compatibility version in ${compname}.card
-	card=${SUBMIT_DIR}/COMP/${compname}.card
-	IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM
-
-	eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1	
-	if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
-	    IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
-	fi
-
-	# Manage component executable
-	IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp}
-
-	# Read component Write Frequency in config.card
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency
-	# Debug Print :
-	eval auxprint=\${config_${comp}_WriteFrequency}
-	IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} "
-        #2> /dev/null
-
-	# Debug Print :
-	IGCM_debug_Print 2 "Initialize following component library"
-	IGCM_debug_Print 2 ${SUBMIT_DIR}/COMP/${compname}.driver
-	IGCM_debug_Print 3 "With tag : ${comptagname}"
-	# Source component library
-	. ${SUBMIT_DIR}/COMP/${compname}.driver
-
-	# Debug Print
-	IGCM_debug_Print 3 "Initialize ${comp} output directory."
-	# Define Dirs	
-	eval R_OUT_${comp}=${R_SAVE}/${comp}
-	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}}
-
-	eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output
-	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O}
-
-	eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart
-	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R}
-
-	eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug
-	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D}
-
- 	eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS
- 	eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF
- 	eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA
- 	eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO
-	eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE
-
-	# Read UserChoices section of component card
-	IGCM_debug_Print 2 "DefineArrayFromSection : ${compname}_UserChoices ${card}"
-	IGCM_card_DefineArrayFromSection ${card} UserChoices
-	eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1
-	# If section is not empty we define corresponding variables
-	if [ X${first_option} != X"Error:" ] ; then
-	    if [ X${card_UserChoices[0]} != X ] ; then
-		unset card_UserChoices
-	    fi
-	    eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1
-	    IGCM_debug_Print 3 "${compname}_UserChoices_values:"
-	    for option in ${card_UserChoices[*]} ; do
-		IGCM_card_DefineVariableFromOption ${card} UserChoices ${option}
-		eval IGCM_debug_Print 3 "${option}=\${${compname}_UserChoices_${option}}"
-	    done
-	fi
-
-	# Read and Build Output File stuff
-	IGCM_debug_Print 2 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
-	IGCM_card_DefineArrayFromOption ${card} OutputFiles List
-	ListFilesName=${compname}_OutputFiles_List
-	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-	#
-	if [ X${FileName0} != X${NULL_STR} ] ; then
-            #
-	    #IGCM_debug_Print 1 "Component      : ${compname}"
-	    #
-	    # INITIALISATION
-	    #
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-	    #
-	    i=2
-	    #
-	    until [ $i -ge $NbFiles ]; do
-	        #
-		eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		#
-		if [ X${flag_post} != XNONE ] ; then
-		    #
-                    # First of all
-                    #
-		    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
-		    #
-		    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
-		    #
-		    # variable option allready typeset above
-		    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
-			if [ ${option} = Seasonal ] ; then
-			    FoundSeasonal=true
-			    IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
-			fi
-		    done
-		    #
-		    if [ ! X${FoundSeasonal} = Xtrue ] ; then
-			eval ${compname}_${flag_post}_Seasonal=ON
-		    fi
-		    #
-		    if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then
-			Seasonal=true
-		    fi
-		    
-		    # Dimension = vide si vieille card.
-		    IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
-		    IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
-		    if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not" ] ; then
-			# New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
-			ListDimension[0]=2D
-			ListDimension[1]=3D
-			TimeSeries=false
-			iLoop=${#ListDimension[*]}
-			j=0
-			until [ $j -ge ${iLoop} ]; do
-			    Dimension=${ListDimension[${j}]}
-			    IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
-			    IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
-		            #
-	                    # Time series WITHOUT chunk
-	                    #
-			    if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
-				if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
-				    IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post}"
-				    eval TimeSeries${Dimension}=true
-				fi
-			    fi
-                            #
-	                    # Time series WITH chunk
-		            #
-			    if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
-				chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
-				if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
-				    IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post}"
-				    eval TimeSeriesChunck${Dimension}=true
-				    eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp}
-				    eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i}
-				    eval set +A CHUNCK${Dimension}_NAME \${CHUNCK${Dimension}_NAME[*]} ${flag_post}
-				    eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size}
-				fi
-			    fi
-			    (( j=j+1 ))
-			done
-		    else
-			ListDimension[0]=""
-			TimeSeries=true
-			TimeSeries2D=false
-			TimeSeries3D=false
-			TimeSeriesChunck2D=false
-			TimeSeriesChunck3D=false
-		    fi
-		fi
-		(( i=i+3 ))
-	    done
-	fi
-	# Debug Print
-	IGCM_debug_Print 3 "Initialize ${compname} with driver."
-	# INIT component
-	${comp}_Initialize
-	echo
-    done
-
-    IGCM_debug_PopStack "IGCM_comp_Initialize"
+  done
+
+  IGCM_debug_PopStack "IGCM_comp_Initialize"
 }
 
@@ -203,13 +233,13 @@
 function IGCM_comp_PrepareDeletedFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_PrepareDeletedFiles" $@
-    
-    if [ X${2} != X. ] ; then
-	eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${2} ) > /dev/null 2>&1
-    else
-	eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${1} ) > /dev/null 2>&1
-    fi
-
-    IGCM_debug_PopStack "IGCM_comp_PrepareDeletedFiles"
+  IGCM_debug_PushStack "IGCM_comp_PrepareDeletedFiles" $@
+  
+  if [ X${2} != X. ] ; then
+    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${2} ) > /dev/null 2>&1
+  else
+    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${1} ) > /dev/null 2>&1
+  fi
+
+  IGCM_debug_PopStack "IGCM_comp_PrepareDeletedFiles"
 }
 
@@ -217,67 +247,71 @@
 function IGCM_comp_GetInputInitialStateFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles"
-
-    # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles"
-    echo
-
-    # Only the first time step need InitialStateFiles 
-    # otherwise it's BoundaryConditions
-    if ( ${FirstInitialize} ) ; then
-      typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
-      typeset file_in_ file_in file_out_ file_out do_init 
-      for comp in ${config_ListOfComponents[*]} ; do
-	  # Initialize
+  IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles"
+  echo
+
+  # Only the first time step need InitialStateFiles 
+  # otherwise it's BoundaryConditions
+  if ( ${FirstInitialize} ) ; then
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+    typeset file_in_ file_in file_out_ file_out do_init 
+    for comp in ${config_ListOfComponents[*]} ; do
+      # Initialize
+      do_init="y"
+      # Do we need to bring initial state file for this component
+      if [ "${config_Restarts_OverRule}" = "y" ] ; then
+	eval do_init="n"
+      else
+	# Read component Restarts parameters
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
+	eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+	if [ "${do_start}" = "y" ] ; then
+	  do_init="n"
+	else
 	  do_init="y"
-	  # Do we need to bring initial state file for this component
-	  if [ "${config_Restarts_OverRule}" = "y" ] ; then
-	      eval do_init="n"
-	  else
-	      # Read component Restarts parameters
-	      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
-	      eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
-	      if [ "${do_start}" = "y" ] ; then
-		    do_init="n"
-	      else
-		    do_init="y"
-	      fi
-	  fi
-
-	  if [ "${do_init}" = "y" ] ; then
-	      # Define component 
-	      eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	      eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	      # Debug Print :
-	      IGCM_debug_Print 3 "Initialisation files ${compname}"
-
-	      card=${SUBMIT_DIR}/COMP/${compname}.card
-
-	      IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List
-	      ListFilesName=${compname}_InitialStateFiles_List
-
-	      eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-	      if [ X${FileName0} != X${NULL_STR} ] ; then
-		  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-		  (( i=0 ))
-		  until [ $i -ge $NbFiles ]; do
-		      eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		      eval file_in=${file_in_}
-		      (( i_ = i+1 ))
-		      eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		      eval file_out=${file_out_}
-		      
-		      IGCM_sys_Get ${file_in} ${file_out}
-		      #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-
-		      (( i=i+2 ))
-		  done
-	      fi
-	  fi
-      done
-    fi
-    IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles"
+	fi
+      fi
+
+      if [ "${do_init}" = "y" ] ; then
+	# Define component 
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Debug Print :
+	IGCM_debug_Print 3 "Initialisation files ${compname}"
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card
+
+	IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List
+	ListFilesName=${compname}_InitialStateFiles_List
+
+	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+	if [ X${FileName0} != X${NULL_STR} ] ; then
+	  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	  (( i=0 ))
+	  until [ $i -ge $NbFiles ]; do
+	    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    eval file_in=${file_in_}
+	    (( i_ = i+1 ))
+	    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	    eval file_out=${file_out_}
+
+	    IGCM_sys_IsFileArchived ${file_in}
+	    if [ $? = 0 ] ; then
+	      IGCM_sys_Get ${file_in} ${file_out}
+	      #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	    else
+	      IGCM_sys_Cp ${file_in} ${file_out}
+	    fi
+	    (( i=i+2 ))
+	  done
+	fi
+      fi
+    done
+  fi
+  IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles"
 }
 
@@ -301,39 +335,37 @@
 function IGCM_SmoothModulo
 {
-    IGCM_debug_PushStack "IGCM_SmoothModulo"
-    typeset defVector ModValue
-
-    eval set +A defVector -- $( echo "${1}" | \
-	gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' )
-
-    # Save Smooth Min and Max. Needed to call IGCM_sys_Get when appropriate
-    arr[1]=${defVector[0]}
-    arr[2]=${defVector[2]}
-
-    # Test limits : 
-    # ${defVector[0]} <= ${2} <= ${defVector[2]} 
-    #                                      or ${defVector[2]} == -1
-    if ( [ ${2} -ge ${defVector[0]} ] && \
-         ( [ ${2} -le ${defVector[2]} ] || \
-           [ ${defVector[2]} -lt 0 ] ) ) ; then
-        # Test modulo
-        ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} )
-        if [ ${ModValue} -eq 0 ] ;  then
-	    arr[3]=true
-	    echo ${arr[@]}
-	    IGCM_debug_PopStack "IGCM_SmoothModulo"
-	    return 1
-	else
-	    arr[3]=false
-	    echo ${arr[@]}
-	    IGCM_debug_PopStack "IGCM_SmoothModulo"
-	    return 0
-	fi
+  IGCM_debug_PushStack "IGCM_SmoothModulo"
+  typeset defVector ModValue
+
+  eval set +A defVector -- $( echo "${1}" | \
+    gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' )
+
+  # Save Smooth Min and Max. Needed to call IGCM_sys_Get when appropriate
+  arr[1]=${defVector[0]}
+  arr[2]=${defVector[2]}
+
+  # Test limits : 
+  # ${defVector[0]} <= ${2} <= ${defVector[2]} 
+  #          or ${defVector[2]} == -1
+  if ( [ ${2} -ge ${defVector[0]} ] && ( [ ${2} -le ${defVector[2]} ] || [ ${defVector[2]} -lt 0 ] ) ) ; then
+    # Test modulo
+    ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} )
+    if [ ${ModValue} -eq 0 ] ;  then
+      arr[3]=true
+      echo ${arr[@]}
+      IGCM_debug_PopStack "IGCM_SmoothModulo"
+      return 1
     else
-	arr[3]=false
-	echo ${arr[@]}
-	IGCM_debug_PopStack "IGCM_SmoothModulo"
-	return 0
-    fi
+      arr[3]=false
+      echo ${arr[@]}
+      IGCM_debug_PopStack "IGCM_SmoothModulo"
+      return 0
+    fi
+  else
+    arr[3]=false
+    echo ${arr[@]}
+    IGCM_debug_PopStack "IGCM_SmoothModulo"
+    return 0
+  fi
 }
 
@@ -341,63 +373,68 @@
 function IGCM_comp_GetInputSmoothFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles"
+  IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles"
+  echo
+
+  typeset comp compname comptagname card ListFilesName FileName0 NbFiles j i i_ i__
+  typeset file_in_ file_in file_out_ file_out ret SmoothDef aux val
+
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
 
     # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles"
-    echo
-
-    typeset comp compname comptagname card ListFilesName FileName0 NbFiles j i i_ i__
-    typeset file_in_ file_in file_out_ file_out ret SmoothDef aux val
-
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-        # Debug Print :
-	IGCM_debug_Print 3 "Smooth files ${compname}"
-
-	card=${SUBMIT_DIR}/COMP/${compname}.card
-
-	IGCM_card_DefineArrayFromOption ${card} SmoothFiles List
-	ListFilesName=${compname}_SmoothFiles_List
- 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-
-	if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != X"Section" ] ) ; then
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-	    (( i=0 ))
-	    until [ $i -ge $NbFiles ]; do
-		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		eval file_in=${file_in_}
-		(( i_ = i+1 ))
-		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_out=${file_out_}
-
-		# define CumulPeriod definition for this file
-		(( i__ = i+2 ))
-		eval SmoothDef=\${${ListFilesName}[$i__]}
-		IGCM_debug_Print 3 "  ${file_in} ${SmoothDef}"
-		aux=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} )
-		j=1
-		for val in ${aux} ; do
-		    [ ${j} -eq 1 ] && SmoothMin=${val}
-		    [ ${j} -eq 2 ] && SmoothMax=${val}
-		    [ ${j} -eq 3 ] && ret=${val}
-		    (( j=j+1 ))
-		done
-		[ ${SmoothMax} -eq -1 ] && SmoothMax=${CumulPeriod}
-		if ( [ X${ret} = Xtrue ] || ( [ ${Period} -eq 1 ] && [ ${CumulPeriod} -ge ${SmoothMin} ] && [ ${CumulPeriod} -le ${SmoothMax} ] ) ) ; then
-		#if ( [ X${ret} = Xtrue ] || [ ${Period} -eq 1 ] ) ; then
-		    IGCM_sys_Get ${file_in} ${file_out}
-		    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-		fi
-		(( i=i+3 ))
-	    done
+    IGCM_debug_Print 3 "Smooth files ${compname}"
+
+    card=${SUBMIT_DIR}/COMP/${compname}.card
+
+    IGCM_card_DefineArrayFromOption ${card} SmoothFiles List
+    ListFilesName=${compname}_SmoothFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+    if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != X"Section" ] ) ; then
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+      (( i=0 ))
+      until [ $i -ge $NbFiles ]; do
+	eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	eval file_in=${file_in_}
+	(( i_ = i+1 ))
+	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_out=${file_out_}
+
+	# define CumulPeriod definition for this file
+	(( i__ = i+2 ))
+	eval SmoothDef=\${${ListFilesName}[$i__]}
+	IGCM_debug_Print 3 "  ${file_in} ${SmoothDef}"
+	aux=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} )
+	j=1
+	for val in ${aux} ; do
+	  [ ${j} -eq 1 ] && SmoothMin=${val}
+	  [ ${j} -eq 2 ] && SmoothMax=${val}
+	  [ ${j} -eq 3 ] && ret=${val}
+	  (( j=j+1 ))
+	done
+	[ ${SmoothMax} -eq -1 ] && SmoothMax=${CumulPeriod}
+	if ( [ X${ret} = Xtrue ] || ( [ ${Period} -eq 1 ] && [ ${CumulPeriod} -ge ${SmoothMin} ] && [ ${CumulPeriod} -le ${SmoothMax} ] ) ) ; then
+
+	  IGCM_sys_IsFileArchived ${file_in}
+	  if [ $? = 0 ] ; then
+	    IGCM_sys_Get ${file_in} ${file_out}
+	    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	  else
+	    IGCM_sys_Cp ${file_in} ${file_out}
+	  fi
 	fi
-    done
-    
-    IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles"
+	(( i=i+3 ))
+      done
+    fi
+  done
+  
+  IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles"
 }
 
@@ -405,84 +442,90 @@
 function IGCM_comp_GetInputBoundaryFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles"
+  IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles"
+  echo
+
+  typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+  typeset file_in_ file_in file_out_ file_out 
+
+  if [ ${Period} = 1 ]; then
+    ListFixBoundary=" "
+  fi
+
+  for comp in ${config_ListOfComponents[*]} ; do
+
+    # Define component
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
 
     # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles"
-    echo
-
-    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
-    typeset file_in_ file_in file_out_ file_out 
-
+    IGCM_debug_Print 3 "Boundary files ${compname}"
+
+    card=${SUBMIT_DIR}/COMP/${compname}.card
+
+    IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List
+    ListFilesName=${compname}_BoundaryFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+      (( i=0 ))
+      until [ $i -ge $NbFiles ]; do
+	eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	eval file_in=${file_in_}
+	(( i_ = i+1 ))
+	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_out=${file_out_}
+
+	IGCM_sys_Get ${file_in} ${file_out}
+	IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+	(( i=i+2 ))
+      done
+    fi
+
+    # Get non deleted files
     if [ ${Period} = 1 ]; then
-	ListFixBoundary=" "
-    fi
-
-    for comp in ${config_ListOfComponents[*]} ; do
-
-	# Define component
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-        # Debug Print :
-	IGCM_debug_Print 3 "Boundary files ${compname}"
-
-	card=${SUBMIT_DIR}/COMP/${compname}.card
-
-	IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List
-	ListFilesName=${compname}_BoundaryFiles_List
- 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-
-	if [ X${FileName0} != X${NULL_STR} ] ; then
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-	    (( i=0 ))
-	    until [ $i -ge $NbFiles ]; do
-		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		eval file_in=${file_in_}
-		(( i_ = i+1 ))
-		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_out=${file_out_}
-
-		IGCM_sys_Get ${file_in} ${file_out}
-		IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-
-		(( i=i+2 ))
-	    done
-	fi
-
-	# Get non deleted files
-	if [ ${Period} = 1 ]; then
-
-	    IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel
-	    ListFilesName=${compname}_BoundaryFiles_ListNonDel
-	    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-	    
-	    if [ X${FileName0} != X${NULL_STR} ] ; then
-		eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-		
-		(( i=0 ))
-		until [ $i -ge $NbFiles ]; do
-		    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		    eval file_in=${file_in_}
-		    (( i_ = i+1 ))
-		    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		    eval file_out=${file_out_}
-
-		    IGCM_sys_Get ${file_in} ${file_out}
-
-		    if [ X${file_out} != X. ] ; then
-			ListFixBoundary=${ListFixBoundary}" "${file_out}
-		    else
-			ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} )
-		    fi
-
-		    (( i=i+2 ))
-		done
-	    fi
-	fi
-    done
-    
-    IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles"
+
+      IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel
+      ListFilesName=${compname}_BoundaryFiles_ListNonDel
+      eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+      
+      if [ X${FileName0} != X${NULL_STR} ] ; then
+	eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	
+	(( i=0 ))
+	until [ $i -ge $NbFiles ]; do
+	  eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	  eval file_in=${file_in_}
+	  (( i_ = i+1 ))
+	  eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	  eval file_out=${file_out_}
+
+	  IGCM_sys_IsFileArchived ${file_in}
+	  if [ $? = 0 ] ; then
+	    IGCM_sys_Get ${file_in} ${file_out}
+	    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	  else
+	    IGCM_sys_Cp ${file_in} ${file_out}
+	  fi
+
+	  if [ X${file_out} != X. ] ; then
+	    ListFixBoundary=${ListFixBoundary}" "${file_out}
+	  else
+	    ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} )
+	  fi
+
+	  (( i=i+2 ))
+	done
+      fi
+    fi
+  done
+  
+  IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles"
 }
 
@@ -490,15 +533,15 @@
 function IGCM_comp_DelFixeBoundaryFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_DelFixeBoundaryFiles"
-
-    # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles"
-    echo
-
-    ls -l ${ListFixBoundary}
-    rm -f ${ListFixBoundary}
-
-    IGCM_debug_PopStack "IGCM_comp_DelFixeBoundaryFiles"
+  IGCM_debug_PushStack "IGCM_comp_DelFixeBoundaryFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles"
+  echo
+
+  ls -l ${ListFixBoundary}
+  rm -f ${ListFixBoundary}
+
+  IGCM_debug_PopStack "IGCM_comp_DelFixeBoundaryFiles"
 }
 
@@ -506,46 +549,46 @@
 function IGCM_comp_GetInputParametersFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles"
+  IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles"
+  echo
+
+  typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component 
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
 
     # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles"
-    echo
-
-    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component 
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	# Debug Print :
-	IGCM_debug_Print 3 "Parameters ${compname}"
-
-	card=${SUBMIT_DIR}/COMP/${compname}.card	
-
-	IGCM_card_DefineArrayFromOption ${card} ParametersFiles List
-	ListFilesName=${compname}_ParametersFiles_List
- 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-
-	if [ X${FileName0} != X${NULL_STR} ] ; then
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-	    (( i=0 ))
-	    until [ $i -ge $NbFiles ]; do
-		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		eval file_in=${file_in_}
-		(( i_ = i+1 ))
-		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_out=${file_out_} 
-
-		IGCM_sys_Cp ${file_in} ${file_out} 
-		IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-
-		(( i=i+2 ))
-	    done
-	fi
-    done
-
-    IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles"
+    IGCM_debug_Print 3 "Parameters ${compname}"
+
+    card=${SUBMIT_DIR}/COMP/${compname}.card	
+
+    IGCM_card_DefineArrayFromOption ${card} ParametersFiles List
+    ListFilesName=${compname}_ParametersFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+      (( i=0 ))
+      until [ $i -ge $NbFiles ]; do
+	eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	eval file_in=${file_in_}
+	(( i_ = i+1 ))
+	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_out=${file_out_} 
+
+	IGCM_sys_Cp ${file_in} ${file_out} 
+	IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+	(( i=i+2 ))
+      done
+    fi
+  done
+
+  IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles"
 }
 
@@ -553,167 +596,178 @@
 function IGCM_comp_GetInputRestartFiles
 {
-    IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles"
+  IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles"
+  echo
+
+  typeset Date_tmp Date_r Path_r do_start CompOldName Path_OUT Path_BUF Buffered
+  typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+  typeset file_in file_out file_in_ file_out_ file_in_Name
+  typeset -Z4 j4
+
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component 
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+    #
+    card=${SUBMIT_DIR}/COMP/${compname}.card
+    #
+    IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+    ListFilesName=${compname}_RestartFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
 
     # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles"
-    echo
-
-    typeset Date_tmp Date_r Path_r do_start CompOldName Path_temp
-    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
-    typeset file_in file_out file_in_ file_out_ file_in_Name
-    typeset -Z4 j4
-
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component 
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-	#
-	card=${SUBMIT_DIR}/COMP/${compname}.card
-	#
-	IGCM_card_DefineArrayFromOption ${card} RestartFiles List
-	ListFilesName=${compname}_RestartFiles_List
-	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-
-	# Debug Print :
-	IGCM_debug_Print 3 "restart ${compname}"
-
-	if ( ${FirstInitialize} ) ; then
-
-	    if [ "${config_Restarts_OverRule}" = "y" ] ; then
-		eval config_${comp}_Restart="y"
-		eval config_${comp}_RestartDate=${config_Restarts_RestartDate}
-		eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName}
-		eval config_${comp}_RestartPath=${config_Restarts_RestartPath}
-		eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
-		eval CompOldName=${comp}
+    IGCM_debug_Print 3 "restart ${compname}"
+
+    if ( ${FirstInitialize} ) ; then
+
+      if [ "${config_Restarts_OverRule}" = "y" ] ; then
+	eval config_${comp}_Restart="y"
+	eval config_${comp}_RestartDate=${config_Restarts_RestartDate}
+	eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName}
+	eval config_${comp}_RestartPath=${config_Restarts_RestartPath}
+	eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+	eval CompOldName=${comp}
+      else
+	        # Read component Restarts parameters
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
+	eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+
+	if [ "${do_start}" = "y" ] ; then
+	  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate
+	  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName
+	  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath
+	else
+	  eval config_${comp}_RestartDate=-1
+	  eval config_${comp}_RestartJobName=${NULL_STR}
+	  eval config_${comp}_RestartPath=${NULL_STR}
+	fi
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName
+	eval CompOldName=\${config_${comp}_OldName}
+	if [ X${CompOldName} = X ] ; then
+	  eval CompOldName=${comp}
+	fi
+      fi
+
+      if [ "${do_start}" = "y" ] ; then
+
+	if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+	  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+	  (( i=1 ))
+	  until [ $i -gt $NbFiles ]; do
+	    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    eval file_in=${file_in_}
+
+	    (( i_ = i+1 ))
+	    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	    eval file_out=${file_out_}
+	    
+	    eval Date_tmp=\${config_${comp}_RestartDate}
+	    Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} )
+	    eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart
+	    eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in}
+
+	    generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
+	    generic_restart_file_name_out=$( basename ${file_out} .nc )
+	    
+	    eval Path_OUT=\${Path_r}/${generic_restart_file_name_in}
+	    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc)
+
+	    if [ ${nb_restart_file} -gt 1 ] ; then
+	      j=0
+	      until [ $j -ge $nb_restart_file ]; do
+		j4=${j}
+		eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+		#IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+		#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
+		(( j=j+1 ))
+	      done
 	    else
-	        # Read component Restarts parameters
-		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
-		eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
-
-		if [ "${do_start}" = "y" ] ; then
-		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate
-		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName
-		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath
-		else
-		    eval config_${comp}_RestartDate=-1
-		    eval config_${comp}_RestartJobName=${NULL_STR}
-		    eval config_${comp}_RestartPath=${NULL_STR}
-		fi
-		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName
-		eval CompOldName=\${config_${comp}_OldName}
-		if [ X${CompOldName} = X ] ; then
-		    eval CompOldName=${comp}
-		fi
-	    fi
-
-	    if [ "${do_start}" = "y" ] ; then
-
-		if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
-		    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-		    (( i=1 ))
-		    until [ $i -gt $NbFiles ]; do
-			eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-			eval file_in=${file_in_}
-
-			(( i_ = i+1 ))
-			eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-			eval file_out=${file_out_}
-			
-			eval Date_tmp=\${config_${comp}_RestartDate}
-			Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} )
-			eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart
-			eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in}
-
-			generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
-			generic_restart_file_name_out=$( basename ${file_out} .nc )
-			
-			eval Path_temp=\${Path_r}/${generic_restart_file_name_in}
-			nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
-
-			if [ ${nb_restart_file} -gt 1 ] ; then
-			    j=0
-			    until [ $j -ge $nb_restart_file ]; do
-				j4=${j}
-				eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
-				#IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
-				#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
-				(( j=j+1 ))
-			    done
-			else
-			    eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out}  
-			    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-			fi
-		
-			(( i=i+3 ))
-		    done
-		else
-		    if [ X${FileName0} != XNONE ] ; then
-			IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
-		    else
-			IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
-		    fi
-		fi
-	    fi
-	elif [ ${Period} -eq 1 ] ; then
-            # if not FirstInitialize and first loop of this job
-
-	    # Restore Restarts files
-	    #-----------------------
-	    if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
-		eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-		(( i=1 ))
-		until [ $i -gt $NbFiles ]; do
-		    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		    eval file_in=${file_in_}
-		    (( i_ = i+1 ))
-		    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		    eval file_out=${file_out_}
-		    
-		    file_in_Name=${run_Configuration_OldPrefix}_${file_in}
-
-		    generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
-		    generic_restart_file_name_out=$( basename ${file_out} .nc )
-
-		    eval Path_temp=\${R_OUT_${comp}_R}/${generic_restart_file_name_in}
-		    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
-
-		    if [ ${nb_restart_file} -gt 1 ] ; then
-			j=0
-			until [ $j -ge $nb_restart_file ]; do
-			    j4=${j}
-			    eval IGCM_sys_Get \${R_OUT_${comp}_R}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
-			    #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
-			    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
-
-			    (( j=j+1 ))
-			done
-		    else
-			eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
-			#IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
-		    fi
-
-		    (( i=i+3 ))
-		done
+	      eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out}  
+	      #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	    fi
+	    
+	    (( i=i+3 ))
+	  done
+	else
+	  if [ X${FileName0} != XNONE ] ; then
+	    IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
+	  else
+	    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
+	  fi
+	fi
+      fi
+    elif [ ${Period} -eq 1 ] ; then
+      # if not FirstInitialize and first loop of this job
+
+      # Restore Restarts files
+      #-----------------------
+      if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+	eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+	(( i=1 ))
+	until [ $i -gt $NbFiles ]; do
+	  eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	  eval file_in=${file_in_}
+	  (( i_ = i+1 ))
+	  eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	  eval file_out=${file_out_}
+	  
+	  file_in_Name=${run_Configuration_OldPrefix}_${file_in}
+
+	  generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
+	  generic_restart_file_name_out=$( basename ${file_out} .nc )
+
+	  eval Path_BUF=\${R_BUF_${comp}_R}/${generic_restart_file_name_in}
+	  eval Path_OUT=\${R_OUT_${comp}_R}/${generic_restart_file_name_in}
+
+	  if [ -f ${Path_BUF}*.nc ] ; then
+	    Buffered=true
+	    nb_restart_file=$(IGCM_sys_CountFileBuffer ${Path_BUF}_????.nc)
+	  else
+	    Buffered=false
+	    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc)
+	  fi
+
+	  if [ ${nb_restart_file} -gt 1 ] ; then
+	    j=0
+	    until [ $j -ge $nb_restart_file ]; do
+	      j4=${j}
+	      if [ ${Buffered} ] ; then
+		IGCM_sys_GetBuffer ${Path_BUF}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+	      else
+		IGCM_sys_Get ${Path_OUT}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+	      fi
+	      (( j=j+1 ))
+	    done
+	  else
+	    if [ ${Buffered} ] ; then
+	      eval IGCM_sys_GetBuffer \${R_BUF_${comp}_R}/${file_in_Name} ${file_out}
 	    else
-		if [ X${FileName0} != XNONE ] ; then
-		    IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
-		else
-		    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
-		fi
-	    fi
+	      eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
+	    fi
+	  fi
+
+	  (( i=i+3 ))
+	done
+      else
+	if [ X${FileName0} != XNONE ] ; then
+	  IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
+	else
+	  IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
 	fi
-    done
-
-    typeset NbFichs
-    NbFiles=$( ls * 2> /dev/null | wc -l )
-    if [ ${NbFiles} -gt 0 ] ; then
-	IGCM_sys_Chmod u+rw *
-    fi
-
-    IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
+      fi
+    fi
+  done
+
+  NbFiles=$( ls * 2> /dev/null | wc -l )
+  if [ ${NbFiles} -gt 0 ] ; then
+    IGCM_sys_Chmod u+rw *
+  fi
+
+  IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
 }
 
@@ -721,30 +775,30 @@
 function IGCM_comp_PeriodStart
 {
-    IGCM_debug_PushStack "IGCM_comp_PeriodStart"
-
-    # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_PeriodStart"
-    echo
-
-    typeset ExeNameIn ExeNameOut 
-    typeset comp compname comptagname
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component 
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	# Copy executable for this component
-	eval ExeNameIn=\${config_Executable_${comp}[0]}
-	eval ExeNameOut=\${config_Executable_${comp}[1]}
-
-	# Debug Print
-	IGCM_debug_Print 3 "PeriodStart ${compname} Driver Function (if any)."
-	# UPDATE component
-        ${comp}_PeriodStart 2> /dev/null
-
-    done
-
-    IGCM_debug_PopStack "IGCM_comp_PeriodStart"
+  IGCM_debug_PushStack "IGCM_comp_PeriodStart"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_PeriodStart"
+  echo
+
+  typeset ExeNameIn ExeNameOut 
+  typeset comp compname comptagname
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component 
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+    # Copy executable for this component
+    eval ExeNameIn=\${config_Executable_${comp}[0]}
+    eval ExeNameOut=\${config_Executable_${comp}[1]}
+
+    # Debug Print
+    IGCM_debug_Print 3 "PeriodStart ${compname} Driver Function (if any)."
+    # UPDATE component
+    ${comp}_PeriodStart 2> /dev/null
+
+  done
+
+  IGCM_debug_PopStack "IGCM_comp_PeriodStart"
 }
 
@@ -752,47 +806,47 @@
 function IGCM_comp_Update
 {
-    IGCM_debug_PushStack "IGCM_comp_Update"
+  IGCM_debug_PushStack "IGCM_comp_Update"
 
     # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_comp_Update"
-    echo
-
-    typeset ExeNameIn ExeNameOut 
-    typeset comp compname comptagname
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component 
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	# Copy executable for this component
-	eval ExeNameIn=\${config_Executable_${comp}[0]}
-	eval ExeNameOut=\${config_Executable_${comp}[1]}
-
-	# If missing executable and DRYRUN is set to 0 or 1  then stop!
-	if [ ${DRYRUN} -le 1 ] && [ X${ExeNameIn} != X\"\" ] &&  [ ! -f ${R_EXE}/${ExeNameIn} ] ; then
-	    IGCM_debug_Exit "IGCM_comp_Update missing executable ${ExeNameIn}"
-	fi 
-
-	if [ ${Period} -eq 1 ] && [ -f ${R_EXE}/${ExeNameIn} ] ; then
-	    eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
-	    if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
-                eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
-	    fi
-	elif [ -f ${R_EXE}/${ExeNameIn} ] && [ ! -f ${RUN_DIR}/${ExeNameOut} ] ; then
-	    eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
-	    if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
-                eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
-	    fi
-	fi
-
-	# Debug Print
-	IGCM_debug_Print 1 "Update ${compname} Parameter Files."
-	# UPDATE component
-        ${comp}_Update
-
-    done
-
-    IGCM_debug_PopStack "IGCM_comp_Update"
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_Update"
+  echo
+
+  typeset ExeNameIn ExeNameOut 
+  typeset comp compname comptagname
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component 
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+    # Copy executable for this component
+    eval ExeNameIn=\${config_Executable_${comp}[0]}
+    eval ExeNameOut=\${config_Executable_${comp}[1]}
+
+    # If missing executable and DRYRUN is set to 0 or 1  then stop!
+    if [ ${DRYRUN} -le 1 ] && [ X${ExeNameIn} != X\"\" ] &&  [ ! -f ${R_EXE}/${ExeNameIn} ] ; then
+      IGCM_debug_Exit "IGCM_comp_Update missing executable ${ExeNameIn}"
+    fi 
+
+    if [ ${Period} -eq 1 ] && [ -f ${R_EXE}/${ExeNameIn} ] ; then
+      eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
+      if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
+        eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
+      fi
+    elif [ -f ${R_EXE}/${ExeNameIn} ] && [ ! -f ${RUN_DIR}/${ExeNameOut} ] ; then
+      eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
+      if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
+        eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
+      fi
+    fi
+
+    # Debug Print
+    IGCM_debug_Print 1 "Update ${compname} Parameter Files."
+    # UPDATE component
+    ${comp}_Update
+
+  done
+
+  IGCM_debug_PopStack "IGCM_comp_Update"
 }
 
@@ -800,310 +854,323 @@
 function IGCM_comp_Finalize
 {
-    IGCM_debug_PushStack "IGCM_comp_Finalize"
-
-    # Debug Print :
+  IGCM_debug_PushStack "IGCM_comp_Finalize"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_comp_Finalize"
+  echo
+
+  typeset ListTextName TextName0
+  typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive
+  typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file
+  typeset -Z4 j4
+  typeset list_file nlist_file
+  typeset compactoutputs
+
+  compactoutputs=false
+  if [ X${JobType} != XRUN ] ; then
+    compactoutputs=true
+  elif [ X${config_UserChoices_CompactText} != Xn ] ; then
+    compactoutputs=true
+  fi
+
+  for comp in ${config_ListOfComponents[*]} ; do
+    # Define component 
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+    # Debug Print
+    IGCM_debug_Print 1 "Finalize ${comp} : ${compname} component."
+    # FINALIZE component
+    ${comp}_Finalize
+
+    card=${SUBMIT_DIR}/COMP/${compname}.card	
+
+    # Save Restarts files
+    #--------------------
+    IGCM_debug_Print 2 "Save Restart files for ${comp} : ${compname} component."
+    IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+    ListFilesName=${compname}_RestartFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+    
+    if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+      
+      (( i=0 ))
+      until [ $i -ge $NbFiles ]; do
+	eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	eval file_in=${file_in_}
+
+	(( i_ = i+1 ))
+	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_out=${file_out_}
+
+	(( i_ = i+2 ))
+	eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_outin=${file_outin_}
+
+	generic_restart_file_name_in=$(    basename ${file_in} .nc )
+	generic_restart_file_name_out=$(   basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc )
+	generic_restart_file_name_outin=$( basename ${file_outin} .nc )
+	
+	nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 
+	if [ ${nb_restart_file} -gt 1 ] ; then
+	  j=0
+	  until [ $j -ge $nb_restart_file ]; do
+	    j4=${j}
+            if [ X${Pack} = Xtrue ] ; then
+	      eval IGCM_sys_PutBuffer_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_BUF_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
+            else
+	      eval IGCM_sys_Put_Rest       ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
+            fi
+	    if [ ! ${file_in} = ${file_outin} ] ; then
+	      if ( ${ExitFlag} ) ; then
+		echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed."
+	      else
+		IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
+	      fi
+	    fi
+	    (( j=j+1 ))
+	  done
+	else
+          if [ X${Pack} = Xtrue ] ; then
+	    eval IGCM_sys_PutBuffer_Rest ${file_in} \${R_BUF_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
+          else
+  	    eval IGCM_sys_Put_Rest       ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
+          fi
+	  if [ ! ${file_in} = ${file_outin} ] ; then
+	    if ( ${ExitFlag} ) ; then
+	      echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed."
+	    else
+	      IGCM_sys_Mv ${file_in} ${file_outin}
+	    fi
+	  fi
+	fi
+
+	(( i=i+3 ))
+      done
+    else
+      if [ X${FileName0} != XNONE ] ; then
+	IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}."
+      else
+	IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}."
+      fi
+    fi
+
+    # Save Output files
+    #------------------
+    IGCM_debug_Print 2 "Save Output files for ${comp} : ${compname} component."
+    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
+    ListFilesName=${compname}_OutputFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+      (( i=0 ))
+      until [ $i -ge $NbFiles ]; do
+	SaveOnArchive=true
+	eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	eval file_in=${file_in_}
+	(( i_ = i+1 ))
+	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	eval file_out=${file_out_}
+	(( i_ = i+2 ))
+	eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	#
+	generic_file_name=$( basename ${file_in} .nc )
+	nb_rebuild_file=$( ls | grep "^${generic_file_name}_[0-9]*.nc" | wc -l )
+	#
+	if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then
+	  IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed"
+	  IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in}
+	elif [ ${nb_rebuild_file} -gt 1 ] ; then
+	  IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed"
+	  if [ X${AsynchronousRebuild} = Xfalse ] ; then
+	    IGCM_debug_Print 2 "Rebuilding ${file_in} online"
+	    IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
+	  else
+	    IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}"
+	    [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+	    IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+
+	    # Prepare headers for the shell dedicated to offline rebuild
+	    if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+	      if [ $DRYRUN -le 1 ]; then
+		echo "#!/bin/ksh                                        " >  ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "function IGCM_FlushRebuild                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "{                                                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export R_SAVE=${R_SAVE}                           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      fi
+	    fi
+	    # Prepare the shell dedicated to offline rebuild
+	    if [ $DRYRUN -le 1 ]; then
+	      echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_debug_Verif_Exit_Post                           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    fi
+	    #
+	    # Load Patch we need to apply and apply
+	    if [ $DRYRUN -le 1 ]; then
+	      if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) !=  X${NULL_STR} ]; then
+		for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
+		  echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		  echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		  echo "IGCM_debug_Verif_Exit_Post                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		done
+	      fi
+	    fi
+	    #
+	    if [ $DRYRUN -le 1 ]; then
+	      echo "IGCM_sys_Put_Out ${file_in} ${file_out}             " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_debug_Verif_Exit_Post                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_sys_Rm ${generic_file_name}_*.nc               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    fi
+	    SaveOnArchive=false
+	  fi
+	fi
+	#
+	if [ ${SaveOnArchive} = true ] ; then
+	  #
+	  # Rebuild has been done online or it was not needed
+	  #
+	  # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on
+	  #
+	  thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} )
+	  if ( [ ! X${thereisapatch} = X${NULL_STR} ] && [ X${AsynchronousRebuild} = Xtrue ] && [ -f ${file_in} ] ) ; then
+	    [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+	    IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
+	    #
+	    if [ $DRYRUN -le 1 ]; then
+	      if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+		echo "#!/bin/ksh                                      " >  ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "function IGCM_FlushRebuild                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "{                                               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export R_SAVE=${R_SAVE}                         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      fi
+              #
+	      for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
+		echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_Verif_Exit_Post                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      done
+	      #
+	      echo "IGCM_sys_Put_Out ${file_in} ${file_out}           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_debug_Verif_Exit_Post                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      #
+	    fi
+	  else
+	    #
+	    # No Patch, No Asynchronous rebuild, online rebuild has been done or was not needed
+	    #
+	    IGCM_sys_Put_Out ${file_in} ${file_out}
+	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+	    if [ ${nb_rebuild_file} -gt 1 ] ; then
+	      for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do
+		eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1
+	      done
+	    fi
+	  fi
+	fi
+	(( i=i+3 ))
+      done
+    fi
+
+    # Save Output Text files of models
+    #---------------------------------
+    IGCM_debug_Print 2 "Save Output Text files for ${comp} : ${compname} component."
+    IGCM_card_DefineArrayFromOption ${card} OutputText List
+    ListTextName=${compname}_OutputText_List
+    
+    eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1
+    if [ X${TextName0} != X${NULL_STR} ] ; then
+      eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1
+
+      (( i=0 ))
+      until [ $i -eq $NbFiles ]; do
+	eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1
+	eval file_out=${PREFIX}_${file_in}
+
+	(( i=i+1 ))
+
+	unset list_file
+	#set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null )
+        # result for a a1 a10 a2 with file_in=a a a1 a2 a10
+	set +A list_file -- $( [ -f ${file_in} ] && ls ${file_in} ; for i in $(ls ${file_in}* 2>/dev/null | sed "s/${file_in}//" | sort -n) ; do ls ${file_in}$i ; done )
+	nlist_file=${#list_file[@]}
+	  if [ ${nlist_file} -gt 1 ] ; then
+	    if ( ${compactoutputs} ) ; then
+	      IGCM_debug_Print 2 "Parallelism of Text Output with ${nlist_file} files."
+	      IGCM_debug_Print 2 "Compact files in ${file_out} : " ${list_file[*]}
+	      echo ${list_file[*]} > ${file_out}
+	      echo "
+" >> ${file_out}
+	      
+	      (( i_ = 0 ))
+	      for file in ${list_file[@]}
+	      do
+		echo "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " >> ${file_out}
+		echo "| " ${i_} " " ${file} >> ${file_out}
+		echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " >> ${file_out}
+		cat ${file} | sed "s/\(.*\)/${i_}\1/" ${file} >> ${file_out}
+		echo "
+" >> ${file_out}
+		eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
+		    (( i_ = i_ + 1 ))
+	      done
+	      if [ X${Pack} = Xtrue ] ; then
+	        eval IGCM_sys_PutBuffer_Out ${file_out} \${R_BUF_${comp}_D}/${file_out}
+              else
+	        eval IGCM_sys_Put_Out       ${file_out} \${R_OUT_${comp}_D}/${file_out}
+              fi
+	      eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1
+
+	      if ( ${ExecutionFail} ) ; then
+		IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}/Debug
+	      fi
+	    else
+	      for file in ${list_file[@]}
+	      do
+		if [ X${Pack} = Xtrue ] ; then
+		  eval IGCM_sys_PutBuffer_Out ${file} \${R_BUF_${comp}_D}/${PREFIX}_${file}
+                else
+		  eval IGCM_sys_Put_Out       ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
+                fi
+		eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
+
+		if ( ${ExecutionFail} ) ; then
+		  IGCM_sys_Cp ${file} ${SUBMIT_DIR}/Debug/${PREFIX}_${file}
+		fi
+	      done
+	    fi
+	  else
+	    if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then
+	      eval IGCM_sys_Mv ${file_in}* ${file_in}
+	    fi
+	    if [ X${Pack} = Xtrue ] ; then
+	      eval IGCM_sys_PutBuffer_Out ${file_in} \${R_BUF_${comp}_D}/${file_out}
+            else
+	      eval IGCM_sys_Put_Out       ${file_in} \${R_OUT_${comp}_D}/${file_out}
+            fi
+	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+
+	    if ( ${ExecutionFail} ) ; then
+	      IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/Debug/${file_out}
+	    fi
+	  fi
+      done
+    fi
     echo
-    IGCM_debug_Print 1 "IGCM_comp_Finalize"
-    echo
-
-    typeset ListTextName TextName0
-    typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive
-    typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file
-    typeset -Z4 j4
-    typeset list_file nlist_file
-    typeset compactoutputs
-
-    compactoutputs=false
-    if [ X${JobType} != XRUN ] ; then
-	compactoutputs=true
-    elif [ X${config_UserChoices_CompactText} != Xn ] ; then
-	compactoutputs=true
-    fi
-
-    for comp in ${config_ListOfComponents[*]} ; do
-	# Define component 
-	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
-	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
-
-	# Debug Print
-	IGCM_debug_Print 1 "Finalize ${compname} component."
-	# FINALIZE component
-        ${comp}_Finalize
-
-	card=${SUBMIT_DIR}/COMP/${compname}.card	
-
-	# Save Restarts files
-	#--------------------
-	IGCM_card_DefineArrayFromOption ${card} RestartFiles List
-	ListFilesName=${compname}_RestartFiles_List
-	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-	
-	if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-	    
-	    (( i=0 ))
-	    until [ $i -ge $NbFiles ]; do
-		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		eval file_in=${file_in_}
-
-		(( i_ = i+1 ))
-		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_out=${file_out_}
-
-		(( i_ = i+2 ))
-		eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_outin=${file_outin_}
-
-		generic_restart_file_name_in=$(    basename ${file_in} .nc )
-		generic_restart_file_name_out=$(   basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc )
-		generic_restart_file_name_outin=$( basename ${file_outin} .nc )
-			
-		nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 
-		if [ ${nb_restart_file} -gt 1 ] ; then
-		    j=0
-		    until [ $j -ge $nb_restart_file ]; do
-			j4=${j}
-			eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
-			if [ ! ${file_in} = ${file_outin} ] ; then
-			    if ( ${ExitFlag} ) ; then
-				echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed."
-			    else
-				IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
-			    fi
-			fi
-			#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_in}_${j4}.nc" > /dev/null 2>&1
-			(( j=j+1 ))
-		    done
-		else
-		    eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
-		    if [ ! ${file_in} = ${file_outin} ] ; then
-			if ( ${ExitFlag} ) ; then
-			    echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed."
-			else
-			    IGCM_sys_Mv ${file_in} ${file_outin}
-			fi
-		    fi
-		    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
-		fi
-
-		(( i=i+3 ))
-	    done
-	else
-	    if [ X${FileName0} != XNONE ] ; then
-		IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}."
-	    else
-		IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}."
-	    fi
-	fi
-
-	# Save Output files
-	#------------------
-	IGCM_card_DefineArrayFromOption ${card} OutputFiles List
-	ListFilesName=${compname}_OutputFiles_List
- 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
-
-	if [ X${FileName0} != X${NULL_STR} ] ; then
-	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
-
-	    (( i=0 ))
-	    until [ $i -ge $NbFiles ]; do
-		SaveOnArchive=true
-		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
-		eval file_in=${file_in_}
-		(( i_ = i+1 ))
-		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		eval file_out=${file_out_}
-		(( i_ = i+2 ))
-		eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1
-		#
-		generic_file_name=$( basename ${file_in} .nc )
-		nb_rebuild_file=$( ls | grep "^${generic_file_name}_[0-9]*.nc" | wc -l )
-		#
-		if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then
-		    IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed"
-		    IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in}
-		elif [ ${nb_rebuild_file} -gt 1 ] ; then
-		    IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed"
-		    if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then
-			IGCM_debug_Print 2 "Rebuilding ${file_in} online"
-			IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
-		    else
-			IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}"
-			[ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-			IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-
-		        # Prepare headers for the shell dedicated to offline rebuild
-			if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-			    if [ $DRYRUN -le 1 ]; then
-			    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export R_SAVE=${R_SAVE}                             " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    fi
-			fi
-			# Prepare the shell dedicated to offline rebuild
-			if [ $DRYRUN -le 1 ]; then
-			    echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_Verif_Exit_Post                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-			#
-			# Load Patch we need to apply and apply
-			if [ $DRYRUN -le 1 ]; then
-			    if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) !=  X${NULL_STR} ]; then
-				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
-				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_debug_Verif_Exit_Post                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				done
-			    fi
-			fi
-			#
-			if [ $DRYRUN -le 1 ]; then
-			    echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_Verif_Exit_Post                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_sys_Rm ${generic_file_name}_*.nc                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-			SaveOnArchive=false
-		    fi
-		fi
-		#
-		if [ ${SaveOnArchive} = true ] ; then
-		    #
-		    # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on
-		    #
-		    thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} )
-		    
-		    if ( [ ! X${thereisapatch} =  X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
-			if [ -f ${file_in} ] ; then
-                            [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-
-			    IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-			    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
-			    #
-			    if [ $DRYRUN -le 1 ]; then
-				if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-				    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				fi
-                                #
-				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
-				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_${Patch} ${file_in}                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				    echo "IGCM_debug_Verif_Exit_Post                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				done
-			        #
-				echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				echo "IGCM_debug_Verif_Exit_Post                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		                #
-			    fi
-			fi
-		    else
-                        [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-			if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-			    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-
-			IGCM_sys_Put_Out ${file_in} ${file_out}
-			[ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
-			if [ ${nb_rebuild_file} -gt 1 ] ; then
-			    for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do
-				eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1
-			    done
-			fi
-		    fi
-		fi
-		(( i=i+3 ))
-	    done
-	fi
-
-	# Save Output Text files of models
-	#---------------------------------
-	
-	IGCM_card_DefineArrayFromOption ${card} OutputText List
-	ListTextName=${compname}_OutputText_List
-	
- 	eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1
-	if [ X${TextName0} != X${NULL_STR} ] ; then
-	    eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1
-
-	    (( i=0 ))
-	    until [ $i -eq $NbFiles ]; do
-		eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1
-		(( i=i+1 ))
-
-		unset list_file
-		#set +A list_file -- $( ls ${file_in}* | sort 2>/dev/null )
-                #  result for a a1 a10 a2 with file_in=a a a1 a2 a10
-		set +A list_file -- $( [ -f ${file_in} ] && ls ${file_in} ; for i in $(ls ${file_in}* 2>/dev/null | sed "s/${file_in}//" | sort -n) ; do ls ${file_in}$i ; done )
-		nlist_file=${#list_file[@]}
-		if [ ${nlist_file} -gt 1 ] ; then
-		    if ( ${compactoutputs} ) ; then
-			eval file_out=${PREFIX}_${file_in}
-
-			IGCM_debug_Print 2 "Parallelism of Text Output with ${nlist_file} files."
-			IGCM_debug_Print 2 "Compact files in ${file_out} : " ${list_file[*]}
-			echo ${list_file[*]} > ${file_out}
-			echo "
-" >> ${file_out}
-			
-			(( i_ = 0 ))
-			for file in ${list_file[@]}
-			do
-			    echo "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " >> ${file_out}
-			    echo "| " ${i_} " " ${file} >> ${file_out}
-			    echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " >> ${file_out}
-			    cat ${file} | sed "s/\(.*\)/${i_}\1/" ${file} >> ${file_out}
-			    echo "
-" >> ${file_out}
-			    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
-			    (( i_ = i_ + 1 ))
-			done
-			eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}_D}/${file_out}
-			eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1
-
-			if ( ${ExecutionFail} ) ; then
-			    IGCM_sys_Cp ${file_out} ${SUBMIT_DIR}/Debug
-			fi
-		    else
-			for file in ${list_file[@]}
-			do
-			    eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
-			    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
-			done
-			if ( ${ExecutionFail} ) ; then
-			    IGCM_sys_Cp ${file} ${SUBMIT_DIR}/Debug/${PREFIX}_${file}
-			fi
-		    fi
-		else
-		    if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then
-			eval IGCM_sys_Mv ${file_in}* ${file_in}
-		    fi
-		    eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${PREFIX}_${file_in}
-		    [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
-
-		    if ( ${ExecutionFail} ) ; then
-			IGCM_sys_Cp ${file_in} ${SUBMIT_DIR}/Debug/${PREFIX}_${file_in}
-		    fi
-		fi
-	    done
-	fi
-    done
-
-    IGCM_debug_PopStack "IGCM_comp_Finalize"
+  done
+  IGCM_debug_PopStack "IGCM_comp_Finalize"
 }
Index: branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh	(revision 571)
@@ -15,256 +15,282 @@
 function IGCM_config_Initialize
 {
-    IGCM_debug_PushStack "IGCM_config_Initialize"
-
-    # Debug Print :
+  IGCM_debug_PushStack "IGCM_config_Initialize"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_config_Initialize"
+
+  if [ ! -r ${SUBMIT_DIR}/run.card ]; then 
+    #================================================#
+    #         The file run.card doesn't exist        #
+    #================================================#
+    FirstInitialize=true
+    #copy initial run.card
+    IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card
+    IGCM_debug_Print 2 "run.card copied from run.card.init"
+  else
+    FirstInitialize=false
+    IGCM_debug_Print 2 "run.card exists"
+  fi
+
+  # Test modipsl tree existence.
+  IGCM_sys_TestDir ${MODIPSL}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
+  IGCM_sys_TestDir ${libIGCM}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
+  IGCM_sys_TestDir ${R_EXE}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
+  IGCM_sys_TestDir ${SUBMIT_DIR}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
+
+  if ( $DEBUG_debug ) ; then
+    echo "Keep trace of inital SUBMIT_DIR : "
+    ls -lta ${SUBMIT_DIR}
+  fi
+
+  #==================================
+
+  typeset option auxprint CompatibilityTag
+  # Read libIGCM compatibility version in config.card
+  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM
+  eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1	
+
+  if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
+    IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
+  fi
+
+  #==================================
+  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices
+
+  for option in ${config_UserChoices[*]} ; do
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option}
+  done
+  echo
+  IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+  # Name Space of this experience 
+  if [ X${config_UserChoices_SpaceName} != X ] ; then
+    IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
+  fi
+  # Expericence class of the run
+  if [ X${config_UserChoices_ExperimentName} != X ] ; then
+    IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+  fi
+  IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+  if [ 3 -le ${Verbosity} ] ; then
+    echo "--------------Debug3-->" "config_UserChoices_LongName="
+    echo "--------------Debug3-->" \"${config_UserChoices_LongName}\"
+  fi
+  IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+  IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+  IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+  IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+  IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+
+  #==================================
+
+  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents
+  for comp in ${config_ListOfComponents[*]} ; do
+    IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
+  done
+
+  echo
+  IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents"
+  IGCM_debug_Print 3 ${config_ListOfComponents[*]}
+
+  NbComponents=${#config_ListOfComponents[*]}
+
+  #==================================
+  # Define principal executable
+  IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable
+  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name
+  
+  #==================================
+  # Define Outputs Name
+  IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output"
+  eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'}
+  IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}"
+  eval Exe_Output=out_${config_Executable_Name}
+  IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}"
+
+  IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable
+  IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name
+    
+  #==================================
+  # Define Outputs Name
+  IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output"
+  eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'}
+  IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}"
+  Exe_Output=out_execution
+  #==================================
+
+  #===================================================================#
+  # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
+  #             But available to any son functions                    #
+  #===================================================================#
+
+  # Convert yyyy-mm-dd date to gregorian yyyymmdd
+  DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
+  DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+
+  # Period Length In Days between DateBegin and DateEnd
+  (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
+  if [ ${ExperienceLengthInDays} -lt 0 ] ; then
+    IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that."
+    IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates."
+    IGCM_debug_Verif_Exit 
+  fi
+
+  # Day and Year of Initial State (Given in julian format)
+  InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 ))
+  InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 ))
+
+  #==================================
+  # Restarts : Gerneral rule or local for each component ?
+  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts
+
+  echo
+  IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts"
+
+  for option in ${config_Restarts[*]} ; do
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option}
+    eval auxprint=\${config_Restarts_${option}}
+    IGCM_debug_Print 3 "${option} : ${auxprint}"
+  done
+
+  #================================================================#
+  #                  Test and Prepare directories                  #
+  #================================================================#
+
+  # ==> 4 kinds of input files :
+  #     1) R_INIT  : Initial State Files   (Etat0, carteveg)
+  #     2) R_BC    : Boundary Conditions   (Forcages, lai)
+  #     3) Parameters files (allready define through ${SUBMIT_DIR})
+  #     4) Restarts files   (allready define in IGCM_config_Initialize)
+
+  # Here we offer the possibility to redefine R_INIT, R_BC
+  # and PeriodNb through config.card
+  R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT}
+  IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb"
+  IGCM_debug_Print 3 "R_INIT=${R_INIT}"
+  R_BC=${config_UserChoices_R_BC:=${R_IN}/BC}
+  IGCM_debug_Print 3  "R_BC=${R_BC}"
+  PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}}
+  IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)"
+
+  # Test Archive input/output.
+  IGCM_sys_TestDirArchive ${ARCHIVE}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+  IGCM_sys_TestDirArchive ${R_IN}
+  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+  #====================================================
+  #R_SAVE : Job output directory
+  if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+  else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  fi
+
+  if ( ${FirstInitialize} ) ; then 
+    IGCM_sys_MkdirArchive ${R_SAVE}
+    IGCM_sys_Mkdir        ${R_BUFR}
+  else
+    IGCM_sys_TestDirArchive ${R_SAVE}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive ${R_SAVE}"
+
+    IGCM_sys_TestDir        ${R_BUFR}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}"
+
+    #Test state of run in run.card
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+    
+    if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
+      echo 
+      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
+      IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this"
+      IGCM_debug_Exit
+      IGCM_debug_Verif_Exit
+    fi
+  fi
+
+  #==================================
+  # Read Post section: 
+  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post
+
+  echo
+  IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
+
+  for option in ${config_Post[*]} ; do
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option}
+    eval auxprint=\${config_Post_${option}}
+    IGCM_debug_Print 3 "${option} : ${auxprint}"
+  done
+
+  #==================================
+  # Define default value to keep compatibility with previous card: means before changes due to TGCC 
+  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
+
+  #====================================================
+  # Define REBUILD_DIR : where we store files needing rebuild process
+  if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then
+    REBUILD_DIR=${R_SAVE}/TMP
+    IGCM_sys_MkdirArchive ${REBUILD_DIR}
+  else
+    REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    IGCM_sys_MkdirWork ${REBUILD_DIR}
+  fi
+
+  #====================================================
+  # Experience type : DEB(ug), DEV(elopment), RUN 
+  if [ X${JobType} != XRUN ] ; then
     echo
-    IGCM_debug_Print 1 "IGCM_config_Initialize"
-
-    if [ ! -r ${SUBMIT_DIR}/run.card ]; then 
-        #================================================#
-        #         The file run.card doesn't exist        #
-        #================================================#
-	FirstInitialize=true
-	#copy initial run.card
-	IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card
-        IGCM_debug_Print 2 "run.card copied from run.card.init"
-    else
-	FirstInitialize=false
-        IGCM_debug_Print 2 "run.card exists"
-    fi
-
-    # Test modipsl tree existence.
-    IGCM_sys_TestDir ${MODIPSL}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
-    IGCM_sys_TestDir ${libIGCM}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
-    IGCM_sys_TestDir ${R_EXE}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
-    IGCM_sys_TestDir ${SUBMIT_DIR}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
-
-    if ( $DEBUG_debug ) ; then
-	echo "Keep trace of inital SUBMIT_DIR : "
-	ls -lta ${SUBMIT_DIR}
-    fi
-
-    #==================================
-
-    typeset option auxprint CompatibilityTag
-    # Read libIGCM compatibility version in config.card
-    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM
-    eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1	
-
-    if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
-	IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
-    fi
-
-    #==================================
-    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices
-
-    for option in ${config_UserChoices[*]} ; do
-        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option}
-    done
+    echo "===================================================="
+    echo "libIGCM JOB is NOT in RUN type mode."
+    echo "!! OUTPUT files will NOT be PROTECTED !!"
+    echo "Be carefull : you can ERASE the result of this job !"
+
+    case ${JobType} in
+    DEB)
+      echo "DEBUG mode : activation of 'set -vx' mode."
+      echo "DEBUG mode : no protection for output files."
+      echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
+      ;;
+    DEV)
+      echo "DEVelopment mode : no protection for output files."
+      echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
+      ;;
+    esac
+
+    if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then
+      if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then
+	echo "------------"
+	echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency"
+	echo "          to PeriodLength : ${config_UserChoices_PeriodLength}"
+	echo "------------"
+	config_Post_RebuildFrequency=${config_UserChoices_PeriodLength}
+      fi
+    fi
+    echo "===================================================="
     echo
-    IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
-    # Name Space of this experience 
-    if [ X${config_UserChoices_SpaceName} != X ] ; then
-	IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
-    fi
-    # Expericence class of the run
-    if [ X${config_UserChoices_ExperimentName} != X ] ; then
-	IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
-    fi
-    IGCM_debug_PrintVariables 3 config_UserChoices_JobName
-    if [ 3 -le ${Verbosity} ] ; then
-	echo "--------------Debug3-->" "config_UserChoices_LongName="
-	echo "--------------Debug3-->" \"${config_UserChoices_LongName}\"
-    fi
-    IGCM_debug_PrintVariables 3 config_UserChoices_TagName
-    IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
-    IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
-    IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
-    IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
-
-    #==================================
-
-    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents
-
-    echo
-    IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents"
-    IGCM_debug_Print 3 ${config_ListOfComponents[*]}
-
-    NbComponents=${#config_ListOfComponents[*]}
-
-    #==================================
-    # Define principal executable
-
-    IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable
-    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name
-    
-    #==================================
-    # Define Outputs Name
-    IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output"
-    eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'}
-    IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}"
-#MM : obsolete !
-#    eval Exe_Output=out_${config_Executable_Name}
-    eval Exe_Output=out_execution
-#    IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}"
-
-    #==================================
-
-    #===================================================================#
-    # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
-    #             But available to any son functions                    #
-    #===================================================================#
-
-    # Convert yyyy-mm-dd date to gregorian yyyymmdd
-    DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
-    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
-
-    # Period Length In Days between DateBegin and DateEnd
-    (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
-    if [ ${ExperienceLengthInDays} -lt 0 ] ; then
-	IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that."
-	IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates."
-	IGCM_debug_Verif_Exit 
-    fi
-
-    # Day and Year of Initial State (Given in julian format)
-    InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 ))
-    InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 ))
-
-    #==================================
-    # Restarts : Gerneral rule or local for each component ?
-    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts
-
-    echo
-    IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts"
-
-    for option in ${config_Restarts[*]} ; do
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option}
-	eval auxprint=\${config_Restarts_${option}}
-	IGCM_debug_Print 3 "${option} : ${auxprint}"
-    done
-
-    #================================================================#
-    #                  Test and Prepare directories                  #
-    #================================================================#
-
-    # ==> 4 kinds of input files :
-    #     1) R_INIT  : Initial State Files   (Etat0, carteveg)
-    #     2) R_BC    : Boundary Conditions   (Forcages, lai)
-    #     3) Parameters files (allready define through ${SUBMIT_DIR})
-    #     4) Restarts files   (allready define in IGCM_config_Initialize)
-
-    # Here we offer the possibility to redefine R_INIT, R_BC
-    # and PeriodNb through config.card
-    R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT}
-    IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb"
-    IGCM_debug_Print 3 "R_INIT=${R_INIT}"
-    R_BC=${config_UserChoices_R_BC:=${R_IN}/BC}
-    IGCM_debug_Print 3  "R_BC=${R_BC}"
-    PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}}
-    IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)"
-
-    # Test Archive input/output.
-    IGCM_sys_TestDirArchive ${ARCHIVE}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
-    IGCM_sys_TestDirArchive ${R_IN}
-    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
-
-    #====================================================
-    #R_SAVE : Job output directory
-    if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
-	FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
-	R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
-	R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
-    else
-	R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-	R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
-    fi
-
-    if ( ${FirstInitialize} ) ; then 
-	IGCM_sys_MkdirArchive ${R_SAVE}
-    else
-	IGCM_sys_TestDirArchive ${R_SAVE}
-	[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
-	#Test state of run in run.card
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
-	
-	if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
-	    echo 
-	    IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
-	    IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this"
-	    IGCM_debug_Exit
-	    IGCM_debug_Verif_Exit
-	fi
-    fi
-
-    #==================================
-    # Post : 
-    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post
-
-    echo
-    IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
-
-    for option in ${config_Post[*]} ; do
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option}
-	eval auxprint=\${config_Post_${option}}
-	IGCM_debug_Print 3 "${option} : ${auxprint}"
-    done
-
-    #====================================================
-    # Define REBUILD_DIR : where we store files needing rebuild process
-    if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then
-	REBUILD_DIR=${R_SAVE}/TMP
-	IGCM_sys_MkdirArchive ${REBUILD_DIR}
-    else
-	REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-	IGCM_sys_MkdirWork ${REBUILD_DIR}
-    fi
-
-    #====================================================
-    # Experience type : DEB(ug), DEV(elopment), RUN 
-    if [ X${JobType} != XRUN ] ; then
-	echo
-        echo "===================================================="
-	echo "libIGCM JOB is NOT in RUN type mode."
-	echo "!! OUTPUT files will NOT be PROTECTED !!"
-        echo "Be carefull : you can ERASE the result of this job !"
-
-	case ${JobType} in
-	    DEB)
-		echo "DEBUG mode : activation of 'set -vx' mode."
-		echo "DEBUG mode : no protection for output files."
-		echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
-		;;
-	    DEV)
-		echo "DEVelopment mode : no protection for output files."
-		echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
-		;;
-	esac
-
-	if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then
-            if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then
-		echo "------------"
-		echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency"
-		echo "          to PeriodLength : ${config_UserChoices_PeriodLength}"
-		echo "------------"
-		config_Post_RebuildFrequency=${config_UserChoices_PeriodLength}
-	    fi
-	fi
-        echo "===================================================="
-	echo
-    fi
-
-    #====================================================
-    #R_OUT_KSH : Storage place for job output
-    #R_OUT_EXE : Storage place for binary used during simulation
-    R_OUT_KSH=${R_SAVE}/Out
-    R_OUT_EXE=${R_SAVE}/Exe
-
-    IGCM_debug_PopStack "IGCM_config_Initialize"
+  fi
+
+  #====================================================
+  #R_OUT_KSH : Storage place for job output
+  #R_OUT_EXE : Storage place for binary used during simulation
+  R_OUT_KSH=${R_SAVE}/Out
+  R_OUT_EXE=${R_SAVE}/Exe
+
+  #====================================================
+  #R_BUF_KSH : Buffer place for job output
+  #R_BUF_EXE : Buffer place for binary used during simulation
+  R_BUF_KSH=${R_BUFR}/Out
+  R_BUF_EXE=${R_BUFR}/Exe
+
+  IGCM_debug_PopStack "IGCM_config_Initialize"
 }
 
@@ -272,43 +298,43 @@
 function IGCM_config_Analyse_PeriodLength
 {
-    IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength"
-
-    typeset i
-
-    # Determine number of day(s) in PeriodLength :
-    case ${config_UserChoices_PeriodLength} in
-	*Y|*y)
-	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) 
-	    IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}"
-	    PeriodLengthInDays=0
-	    i=0
-	    until [ $i -ge $PeriodLengthInYears ] ; do 
-	 	(( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
-	 	(( i=i+1 )) 
-	    done 
-	    ;;
-	*M|*m)
-	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) 
-	    IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}"
-	    PeriodLengthInDays=0
-	    i=0
-	    until [ $i -ge $PeriodLengthInMonths ] ; do 
-	 	if [ $(( month + i )) -lt 13 ] ; then 
-	 	    (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
-	 	else 
- 	            (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
-	 	fi 
- 	        (( i=i+1 )) 
-	    done 
- 	    ;;
-	*D|*d)  
-	    PeriodLengthInMonths=0
-	    PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );;
-	*) 
-	    IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D."
-	    IGCM_debug_Verif_Exit ;;
-    esac
-
-    IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength"
+  IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength"
+
+  typeset i
+
+  # Determine number of day(s) in PeriodLength :
+  case ${config_UserChoices_PeriodLength} in
+  *Y|*y)
+    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) 
+    IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}"
+    PeriodLengthInDays=0
+    i=0
+    until [ $i -ge $PeriodLengthInYears ] ; do 
+      (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
+      (( i=i+1 )) 
+    done 
+    ;;
+  *M|*m)
+    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) 
+    IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}"
+    PeriodLengthInDays=0
+    i=0
+    until [ $i -ge $PeriodLengthInMonths ] ; do 
+      if [ $(( month + i )) -lt 13 ] ; then 
+	(( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
+      else 
+ 	(( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
+      fi 
+      (( i=i+1 )) 
+    done 
+    ;;
+  *D|*d)  
+    PeriodLengthInMonths=0
+    PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );;
+  *) 
+    IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D."
+    IGCM_debug_Verif_Exit ;;
+  esac
+
+  IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength"
 }
 
@@ -316,70 +342,88 @@
 function IGCM_config_Check
 {
-    IGCM_debug_PushStack "IGCM_config_Check"
-
-    # If one of the following modulo is not zero :
-    # we will issue an error then explain and exit in
-    # AA_job IGCM_debug_Verif_Exit call before binary submission
-
+  IGCM_debug_PushStack "IGCM_config_Check"
+
+  # If one of the following modulo is not zero :
+  # we will issue an error then explain and exit in
+  # AA_job IGCM_debug_Verif_Exit call before binary submission
+
+  echo
+  IGCM_debug_Print 1 "IGCM_config_Check"
+  echo
+
+  typeset i
+
+  # Check RebuildFrequency against key frequencies : PeriodLength ; PackFrequency ; TimeSeriesFrequency ; SeasonalFrequency
+  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+    AsynchronousRebuild=true
+    IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
     echo
-    IGCM_debug_Print 1 "IGCM_config_Check"
+    # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero
+    IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength"
+    IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength
+    IGCM_debug_Print 1 "Check coherence between PackFrequency and RebuildFrequency"
+    IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_Post_RebuildFrequency
+    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency"
+    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency
+    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency"
+    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency
+  else
+    AsynchronousRebuild=false
+    IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
+    IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
     echo
-
-    typeset i
-
-    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
-	AsynchronousRebuild=true
-	IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
-	echo
-	# modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero
-	IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength"
-	IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength
-	IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency"
-	IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency
-	IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency"
-	IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency
-    else
-	AsynchronousRebuild=false
-	IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
-	IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
-	echo
-	#modulo (TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero
-	IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength"
-	IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength
-	IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength"
-	IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength
-    fi
-
-    #modulo (TimeSeriesFrequency and all Chunck2D) must be zero
-    NbJob=${#CHUNCK2D_SIZE[@]}
-    i=0
-    until [ $i -ge $NbJob ]; do
-	value=${CHUNCK2D_SIZE[${i}]}
-	IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency"
-	IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
-	case ${value} in  
-	    *Y|*y) ;; 
-	    *)  IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card"
-		IGCM_debug_Exit "This will stop the job" ;;
-	esac
-	(( i=i+1 ))
-    done
-
-    #modulo (TimeSeriesFrequency and all Chunck3D) must be zero
-    NbJob=${#CHUNCK3D_SIZE[@]}
-    i=0
-    until [ $i -ge $NbJob ]; do
-	value=${CHUNCK3D_SIZE[${i}]}
-	IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency"
-	IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
-	case ${value} in  
-	    *Y|*y) ;; 
-	    *)  IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card"
-		IGCM_debug_Exit "This will stop the job" ;;
-	esac
-	(( i=i+1 ))
-    done
-
-    IGCM_debug_PopStack "IGCM_config_Check"
+    #modulo (PeriodLength and TimeSeriesFrequency/SeasonalFrequency) must be zero
+    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength"
+    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength
+    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength"
+    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength
+  fi
+
+  # Check PackFrequency against other key frequencies 
+  # Modulo (PackFrequency and TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero
+  if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then
+    Pack=true
+    #
+    IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength"
+    IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_UserChoices_PeriodLength
+    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PackFrequency"
+    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_PackFrequency
+    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PackFrequency"
+    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_PackFrequency
+  else
+    Pack=false
+  fi
+
+  #modulo (TimeSeriesFrequency and all Chunck2D) must be zero
+  NbJob=${#CHUNCK2D_SIZE[@]}
+  i=0
+  until [ $i -ge $NbJob ]; do
+    value=${CHUNCK2D_SIZE[${i}]}
+    IGCM_debug_Print 1 "Check coherence between All Chunck2D frequency and TimeSeriesFrequency"
+    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
+    case ${value} in  
+    *Y|*y) ;; 
+    *)  IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card"
+      IGCM_debug_Exit "This will stop the job" ;;
+    esac
+    (( i=i+1 ))
+  done
+
+  #modulo (TimeSeriesFrequency and all Chunck3D) must be zero
+  NbJob=${#CHUNCK3D_SIZE[@]}
+  i=0
+  until [ $i -ge $NbJob ]; do
+    value=${CHUNCK3D_SIZE[${i}]}
+    IGCM_debug_Print 1 "Check coherence between All Chunck3D frequency and TimeSeriesFrequency"
+    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
+    case ${value} in  
+    *Y|*y) ;; 
+    *)  IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card"
+      IGCM_debug_Exit "This will stop the job" ;;
+    esac
+    (( i=i+1 ))
+  done
+
+  IGCM_debug_PopStack "IGCM_config_Check"
 }
 
@@ -387,327 +431,372 @@
 function IGCM_config_PeriodStart
 {
-    IGCM_debug_PushStack "IGCM_config_PeriodStart"
-
-    echo
-    IGCM_debug_Print 1 "IGCM_config_PeriodStart"
-    echo
-
-    if ( ${FirstInitialize} ) ; then
-        #================================================#
-        #         Initialize date/period information     #
-        #================================================#
-
-	IGCM_date_GetYearMonth $DateBegin year month
-	year_m1=$(( year - 1 ))
-	year_p1=$(( year + 1 ))	
-	IGCM_config_Analyse_PeriodLength
-
-	eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1
-	PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) )
-	eval CumulPeriod=1 > /dev/null 2>&1
-
-        #=================================================#
-        #              Write updated run.card             #
-        #=================================================#
-
-	#Correct run.card Configuration for this period
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
-	if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then
-	    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR}
-	fi
-
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
- 
+  IGCM_debug_PushStack "IGCM_config_PeriodStart"
+
+  echo
+  IGCM_debug_Print 1 "IGCM_config_PeriodStart"
+  echo
+
+  if ( ${FirstInitialize} ) ; then
+    #================================================#
+    #         Initialize date/period information     #
+    #================================================#
+
+    IGCM_date_GetYearMonthDay $DateBegin year month day
+    IGCM_config_Analyse_PeriodLength
+
+    eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1
+    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) )
+    eval CumulPeriod=1 > /dev/null 2>&1
+
+    #=================================================#
+    #              Write updated run.card             #
+    #=================================================#
+
+    #Correct run.card Configuration for this period
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
+    if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then
+      IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR}
+    fi
+
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
+    
+  else
+    #================================================#
+    #         The file run.card allready exist       #
+    #================================================#
+
+    #Test state of run in run.card
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+    if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
+      echo 
+      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
+      IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this"
+      echo
+      IGCM_debug_Exit
+      IGCM_debug_Verif_Exit
+    fi
+
+    #===================================#
+    #        Read updated run.card      #
+    #===================================#
+
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod
+
+    PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} )
+    PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
+    eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1
+
+    LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" )
+
+    typeset LastDate
+    set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" )
+    LastYearDateEnd=${LastDate[0]}
+    LastMonthDateEnd=${LastDate[1]}
+    LastDayDateEnd=${LastDate[2]}
+
+    if [ ${Period} = 1 ]; then
+      # save last Job output
+      typeset LastPeriod iLastPeriod Last_Script_Output_Name
+      (( LastPeriod=CumulPeriod-PeriodNb ))
+      iLastPeriod=$( printf "%06d" ${LastPeriod} )
+      Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}"
+      Last_run_card="run.card.${iLastPeriod}"
+      #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name}
+      #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1
+      IGCM_debug_Print 2 "Try to save previous ksh job output"
+      IGCM_sys_Cd ${SUBMIT_DIR}/
+      IGCM_sys_PutBuffer_Out ${Last_Script_Output_Name} ${R_BUF_KSH}/${Last_Script_Output_Name}.$$ rw
+
+      IGCM_card_CheckConflict run.card
+      IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/${Last_run_card}.$$ rw
+
+      IGCM_sys_Cd ${RUN_DIR}
     else
-        #================================================#
-        #         The file run.card allready exist       #
-        #================================================#
-
-	#Test state of run in run.card
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
-	if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
-	    echo 
-	    IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
-	    IGCM_debug_Print 1 "Try running ${libIGCM}/clean_month.job to fix this"
-	    echo
-	    IGCM_debug_Exit
-	    IGCM_debug_Verif_Exit
-	fi
-
-        #===================================#
-        #        Read updated run.card      #
-        #===================================#
-
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod
-
-	PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} )
-	PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
-	eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1
-
-	LastPeriodDateEnd=$( echo ${run_Configuration_OldPrefix} | sed -e "s/${config_UserChoices_JobName}_//" )
-
-	typeset LastDate
-	set +A LastDate -- $( echo ${LastPeriodDateEnd} | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1 \2 \3/" )
-	LastYearDateEnd=${LastDate[0]}
-	LastMonthDateEnd=${LastDate[1]}
-	LastDayDateEnd=${LastDate[2]}
-
-	if [ ${Period} = 1 ]; then
-           # save last Job output
-	    typeset LastPeriod iLastPeriod Last_Script_Output_Name
-	    (( LastPeriod=CumulPeriod-PeriodNb ))
-	    iLastPeriod=$( printf "%06d" ${LastPeriod} )
-	    Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}"
-	    Last_run_card="run.card.${iLastPeriod}"
- 	    #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name}
- 	    #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1
-	    IGCM_debug_Print 2 "Try to save previous ksh job output"
-	    IGCM_sys_Cd ${SUBMIT_DIR}/
-	    IGCM_sys_Put_Out ${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name}.$$ rw
-
-	    IGCM_card_CheckConflict run.card
-	    IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/${Last_run_card}.$$ rw
-
-	    IGCM_sys_Cd ${RUN_DIR}
-	else
-	    unset FileToBeDeleted
-	fi
-
-	IGCM_date_GetYearMonth $PeriodDateBegin year month
-	year_m1=$(( year - 1 ))
-	year_p1=$(( year + 1 ))	
-	IGCM_config_Analyse_PeriodLength
-
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
-
-    fi    
-    OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd}
-  
-    #===================================================================#
-    # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
-    #             But available to any son functions                    #
-    #===================================================================#
-
-    # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !)
-    (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 ))
-
-    # Debug Print :
-    IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution"
-    IGCM_debug_Print 1 "Year of simulation      : ${year}"
-    IGCM_debug_Print 1 "Month of simulation     : ${month}"
-    IGCM_debug_Print 1 "PeriodLengthInDays      : ${PeriodLengthInDays}"
-    IGCM_debug_Print 1 "PeriodDateBegin         : ${PeriodDateBegin}"
-    IGCM_debug_Print 1 "PeriodDateEnd           : ${PeriodDateEnd}"
-    IGCM_debug_Print 1 "SimulationLengthInDays  : ${SimulationLengthInDays}"
-    IGCM_debug_Print 1 "ExperienceLengthInDays  : ${ExperienceLengthInDays}"
-
-    #================================================================#
-    #         Prepare variables available for comp_finalyze          #
-    #================================================================#
-
-    # Period for save files
-    eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1
-
-    # Prefix for save files of this period
-    eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod}  > /dev/null 2>&1
-
-    # List of files that will be deleted in RUN_DIR after run
-    [ -f stack ] && FileToBeDeleted[0]="stack"
-
-    # Test if the same run as already been saved :
-    if [ X${JobType} = XRUN ] ; then
-	if [ ${DRYRUN} -le 0 ] ; then
-	    if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then
-		IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job."
-		IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files"
-		IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or "
-		IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory."
-		IGCM_debug_Print 1 " This exit has been initiated because at least ${R_OUT_KSH}/${PREFIX}_${Exe_Output} exists."
-		IGCM_debug_Verif_Exit
-	    fi
-	fi
+      unset FileToBeDeleted
+    fi
+
+    IGCM_date_GetYearMonthDay $PeriodDateBegin year month day
+    IGCM_config_Analyse_PeriodLength
+
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
+
+  fi    
+  OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd}
+
+  # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh
+  # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y)
+  year_m1=$(( year - 1 ))
+  year_p1=$(( year + 1 ))	
+  # Compute month_m1 (month minus 1M)
+  # Compute yyyymm_m1 (yyyymm minus 1M)
+  month_m1=$(( month - 1 ))
+  if [ ${month_m1} = 0 ]; then
+    month_m1=12
+    yyyymm_m1=${year_m1}12
+  elif [ ${month_m1} -le 9 ]; then
+    month_m1=0${month_m1}
+    yyyymm_m1=${year}${month_m1}
+  else
+    yyyymm_m1=${year}${month_m1}
+  fi
+  # Compute month_p1 (month plus 1M)
+  # Compute yyyymm_p1 (yyyymm plus 1M)
+  month_p1=$(( month + 1 ))
+  if [ ${month_p1} = 13 ]; then
+    month_p1=01
+    yyyymm_p1=${year_p1}01
+  elif [ ${month_p1} -le 9 ]; then
+    month_p1=0${month_p1}
+    yyyymm_p1=${year}${month_p1}
+  else
+    yyyymm_p1=${year}${month_p1}
+  fi
+  #IGCM_debug_Print 1 "jg 1 month_m1 = ${month_m1} month_p1 = ${month_p1} "
+  #IGCM_debug_Print 1 "jg 1 calculate yyyymm_m1 = ${yyyymm_m1} "
+  #IGCM_debug_Print 1 "jg 1 calculate yyyymm_p1 = ${yyyymm_p1} "
+
+  # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh
+
+  #===================================================================#
+  # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
+  #             But available to any son functions                    #
+  #===================================================================#
+
+  # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !)
+  (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 ))
+
+  # Debug Print :
+  IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution"
+  IGCM_debug_Print 1 "Year of simulation      : ${year}"
+  IGCM_debug_Print 1 "Month of simulation     : ${month}"
+  IGCM_debug_Print 1 "PeriodLengthInDays      : ${PeriodLengthInDays}"
+  IGCM_debug_Print 1 "PeriodDateBegin         : ${PeriodDateBegin}"
+  IGCM_debug_Print 1 "PeriodDateEnd           : ${PeriodDateEnd}"
+  IGCM_debug_Print 1 "SimulationLengthInDays  : ${SimulationLengthInDays}"
+  IGCM_debug_Print 1 "ExperienceLengthInDays  : ${ExperienceLengthInDays}"
+
+  #================================================================#
+  #         Prepare variables available for comp_finalyze          #
+  #================================================================#
+
+  # Period for save files
+  eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1
+
+  # Prefix for save files of this period
+  eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod}  > /dev/null 2>&1
+
+  # List of files that will be deleted in RUN_DIR after run
+  [ -f stack ] && FileToBeDeleted[0]="stack"
+
+  # Test if the same run as already been saved :
+  if [ X${JobType} = XRUN ] ; then
+    if [ ${DRYRUN} -le 0 ] ; then
+      if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then
+	IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job."
+	IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files"
+	IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or "
+	IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory."
+	IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists."
+	IGCM_debug_Verif_Exit
+      fi
+    fi
+  else
+    if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then
+      IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode."
+    fi
+  fi
+
+  typeset ExeNameIn ExeNameFirst CompNameFirst
+  typeset comp i
+  typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec
+
+  (( PROCESSUS_NUMBER = 0 ))
+  (( i=0 ))
+  (( NbExec=0 ))
+
+  OK_PARA_MPI=false
+  OK_PARA_OMP=false
+  OK_PARA_NOD=false
+  OK_PARA_MPMD=false
+
+  for comp in ${config_ListOfComponents[*]} ; do
+
+    IGCM_debug_Print 1 ${comp}
+
+    eval ExeNameIn=\${config_Executable_${comp}[0]}
+
+    # NO order in config.card for parallelized values ! 
+    # just use suffix : MPI , OMP and NOD (for number of NODes.)
+
+    # NOD is the number of NODes allocated
+    eval ${comp}_PROC_NOD=0
+
+    # MPI is the number of MPI processus per nodes
+    eval ${comp}_PROC_MPI=0
+
+    # OMP is the number of OpenMP threads per MPI processus
+    eval ${comp}_PROC_OMP=0
+	
+    # Only if we really have an executable for the component :
+    if [ X${ExeNameIn} != X\"\" ] ; then
+
+      # Keep the first executable found and the first CompName
+      ExeNameFirst=${ExeNameIn}
+      CompNameFirst=${comp}
+
+      # Are we a second executable?
+      (( NbExec = NbExec + 1 ))
+
+      # set 1 MPI task, 1 OpenMP thread and 1 node as default
+      eval ${comp}_PROC_MPI=1
+      eval ${comp}_PROC_OMP=1
+      eval ${comp}_PROC_NOD=1
+
+      eval NbElts=\${#config_Executable_${comp}[@]}
+
+      if [ ${NbElts} -ge 2 ] ; then
+        (( j = 2 ))
+
+        while [ $j -lt ${NbElts} ] ; do 
+          eval tempvar=\${config_Executable_${comp}[${j}]}
+
+          if [ X${tempvar} == X ] ; then
+            echo "Error reading MPI/OMP parameters !!!" 
+            echo "Check your config.card." 
+            exit 1
+          fi
+
+          eval IGCM_debug_Print 2 ${tempvar}
+
+          case ${tempvar} in
+            *[mM][pP][iI]*)
+               # Read MPI parameter for composante
+               eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" )
+               OK_PARA_MPI=true;;
+            *[oO][mM][pP]*)
+               # Read OMP parameter for composante
+               eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" )
+               OK_PARA_OMP=true;;
+            *[nN][oO][dD]*)
+               # Read NOD (NumBer of Nodes) parameter for composante
+               eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" )
+               OK_PARA_NOD=true
+               OK_PARA_MPI=true;;
+          esac
+
+          (( j = j + 1 ))
+        done
+
+      fi
+
+      eval tempvarMPI=\${${comp}_PROC_MPI}
+      eval tempvarNOD=\${${comp}_PROC_NOD}
+      eval tempvarOMP=\${${comp}_PROC_OMP}
+
+      (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP ))
+
+    fi
+
+    (( i=i+1 ))
+  done
+
+  # set MPMD mode if more than 2 executable names.
+  [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true
+
+  # Verification of BATCH_NUM_PROC_TOT total number of processors set in job header.
+  if [ X${BATCH_NUM_PROC_TOT} != X ] ; then
+    # BATCH_NUM_PROC_TOT is set
+    if ( ${OK_PARA_MPI} ) ; then
+      IGCM_debug_Print 1 "MPI/OMP/NOD found into config.card and BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} "
     else
-	if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then
-	    IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode."
-	fi
-    fi
-
-    typeset ExeNameIn ExeNameFirst CompNameFirst
-    typeset comp i
-    typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec
-
-    (( PROCESSUS_NUMBER = 0 ))
-    (( i=0 ))
-    (( NbExec=0 ))
-
-    OK_PARA_MPI=false
-    OK_PARA_OMP=false
-    OK_PARA_NOD=false
-    OK_PARA_MPMD=false
-
-    for comp in ${config_ListOfComponents[*]} ; do
-
-	IGCM_debug_Print 1 ${comp}
-
-	eval ExeNameIn=\${config_Executable_${comp}[0]}
-
-	# NO order in config.card for parallelized values ! 
-	# just use suffix : MPI , OMP and NOD (for number of NODes.)
-
-	# NOD is the number of NODes allocated
-	eval ${comp}_PROC_NOD=0
-
-	# MPI is the number of MPI processus per nodes
-	eval ${comp}_PROC_MPI=0
-
-	# OMP is the number of OpenMP threads per MPI processus
-	eval ${comp}_PROC_OMP=0
-	
-	# Only if we really have an executable for the component :
-	if [ X${ExeNameIn} != X\"\" ] ; then
-
-	    # Keep the first executable found and the first CompName
-	    ExeNameFirst=${ExeNameIn}
-	    CompNameFirst=${comp}
-
-	    # Are we a second executable?
-	    (( NbExec = NbExec + 1 ))
-
-	    # set 1 MPI task, 1 OpenMP thread and 1 node as default
-	    eval ${comp}_PROC_MPI=1
-	    eval ${comp}_PROC_OMP=1
-	    eval ${comp}_PROC_NOD=1
-
-	    eval NbElts=\${#config_Executable_${comp}[@]}
-
-	    if [ ${NbElts} -ge 2 ] ; then
-		(( j = 2 ))
-
-		while [ $j -lt ${NbElts} ] ; do 
-		    eval tempvar=\${config_Executable_${comp}[${j}]}
-
-		    echo 
-#MM BUG impossible ?!
-		    if [ X${tempvar} == X ] ; then
-			echo "Error reading MPI/OMP parameters !!!" 
-			echo "Check your config.card." 
-		    # MM : A  enlever :
-			exit 1
-                        #break
-		    fi
-
-		    eval IGCM_debug_Print 2 ${tempvar}
-
-		    case ${tempvar} in
-			*[mM][pP][iI]*)
-                            # Read MPI parameter for composante
-			    eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" )
-			    OK_PARA_MPI=true;;
-			*[oO][mM][pP]*)
-                            # Read OMP parameter for composante
-			    eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" )
-			    OK_PARA_OMP=true;;
-			*[nN][oO][dD]*)
-                            # Read NOD (NumBer of Nodes) parameter for composante
-			    eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" )
-			    OK_PARA_NOD=true
-			    OK_PARA_MPI=true;;
-		    esac
-
-		    (( j = j + 1 ))
-		done
-
- 	    fi
-
-	    eval tempvarMPI=\${${comp}_PROC_MPI}
-	    eval tempvarNOD=\${${comp}_PROC_NOD}
-	    eval tempvarOMP=\${${comp}_PROC_OMP}
-
-	    (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP ))
-
-	fi
-
-	(( i=i+1 ))
-    done
-
-    # set MPMD mode if more than 2 executable names.
-    [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true
-
-    # Verification of BATCH_NUM_PROC_TOT total number of processors set in job header.
-    if [ X${BATCH_NUM_PROC_TOT} != X ] ; then
-	# BATCH_NUM_PROC_TOT is set
-	if ( ${OK_PARA_MPI} ) ; then
-	    IGCM_debug_Print 1 "MPI/OMP/NOD fund into config.card and BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} "
-	else
-	    # with previous method.
-	    if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then
-		# with more than 1 proc
-		if ( ${OK_PARA_MPMD} ) ; then
-		     # with MPMD ie CPL/oasis method
-		     echo "We will use default number of MPI tasks for this machine : "
-		     echo "${DEFAULT_NUM_PROC_OCE} for OCE; "
-		     echo "${DEFAULT_NUM_PROC_CPL} for CPL; "
-		     echo "${DEFAULT_NUM_PROC_ATM} for ATM; "
-		     echo "${DEFAULT_NUM_PROC_TOTAL} for the total number of processors; "
-		     OK_PARA_MPI=true
-		     CPL_PROC_MPI=${DEFAULT_NUM_PROC_CPL}
-		     OCE_PROC_MPI=${DEFAULT_NUM_PROC_OCE}
-		     ATM_PROC_MPI=${DEFAULT_NUM_PROC_ATM}
-		     NUM_PROC_CPL=${DEFAULT_NUM_PROC_CPL} # for backward compatibility
-		     NUM_PROC_OCE=${DEFAULT_NUM_PROC_OCE} # for backward compatibility
-		     NUM_PROC_ATM=${DEFAULT_NUM_PROC_ATM} # for backward compatibility
-		     PROCESSUS_NUMBER=${DEFAULT_NUM_PROC_TOTAL}
-		else
-		     # with have only one executable
-		     echo "We will use ${BATCH_NUM_PROC_TOT} MPI tasks for ${CompNameFirst} : ${config_Executable_Name} "
-		     OK_PARA_MPI=true
-		     eval ${CompNameFirst}_PROC_MPI=${BATCH_NUM_PROC_TOT}
-		     PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT}
-		fi
-	    else 
-		PROCESSUS_NUMBER=1
-	    fi
-	fi
-	# Verification with PBS parameter
-        if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then
-            echo "Warning with parallelization parameters !"
-            echo "Job header variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} "
-            echo "is the total number of _processors_ reserved."
-            echo "It is not equal to the sum of _processus_  = ${PROCESSUS_NUMBER}."
-	    echo "We stop now."
-	    exit 1
+      # with previous method.
+      if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then
+        # with more than 1 proc
+        if ( ${OK_PARA_MPMD} ) ; then
+          # with MPMD ie CPL/oasis method
+          echo "We will use default number of MPI tasks for this machine : "
+          echo "${DEFAULT_NUM_PROC_OCE} for OCE; "
+          echo "${DEFAULT_NUM_PROC_CPL} for CPL; "
+          echo "${DEFAULT_NUM_PROC_ATM} for ATM; "
+          echo "${DEFAULT_NUM_PROC_TOTAL} for the total number of processors; "
+          OK_PARA_MPI=true
+          CPL_PROC_MPI=${DEFAULT_NUM_PROC_CPL}
+          OCE_PROC_MPI=${DEFAULT_NUM_PROC_OCE}
+          ATM_PROC_MPI=${DEFAULT_NUM_PROC_ATM}
+          NUM_PROC_CPL=${DEFAULT_NUM_PROC_CPL} # for backward compatibility
+          NUM_PROC_OCE=${DEFAULT_NUM_PROC_OCE} # for backward compatibility
+          NUM_PROC_ATM=${DEFAULT_NUM_PROC_ATM} # for backward compatibility
+          PROCESSUS_NUMBER=${DEFAULT_NUM_PROC_TOTAL}
+        else
+          # with have only one executable
+          echo "We will use ${BATCH_NUM_PROC_TOT} MPI tasks for ${CompNameFirst} : ${config_Executable_Name} "
+          OK_PARA_MPI=true
+          eval ${CompNameFirst}_PROC_MPI=${BATCH_NUM_PROC_TOT}
+          PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT}
         fi
-
-    else # BATCH_NUM_PROC_TOT=""
-	if ( ${OK_PARA_MPI} ) ; then
-	    echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors,"
-	    echo "but you have filled the parallel parameter in config->Executable->list."
-	    echo "Please add BATCH_NUM_PROC_TOT variable in job header."
-	    echo "We stop now."
-	    exit 1
-	else
-    	# sequential case !
-	    if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then
-               (( PROCESSUS_NUMBER = 1 ))
-               echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)."
-               echo "We set it to 1."
-    	    fi
-	fi
-    fi
-
-    IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}"
-
-#     if ( ${OK_PARA_MPI} || ${OK_PARA_OMP} || ${OK_PARA_NOD} ) ; then
-    IGCM_sys_build_execution_scripts
-#     fi
-
-    ExecutionFail=false
-
-    IGCM_debug_PopStack "IGCM_config_PeriodStart"
+      else 
+        PROCESSUS_NUMBER=1
+      fi
+    fi
+    # Verification with PBS parameter
+    if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then
+      echo "Warning with parallelization parameters !"
+      echo "Job header variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} "
+      echo "is the total number of _processors_ reserved."
+      echo "It is not equal to the sum of _processus_  = ${PROCESSUS_NUMBER}."
+      echo "We stop now."
+      exit 1
+    fi
+  else # BATCH_NUM_PROC_TOT=""
+    if ( ${OK_PARA_MPI} ) ; then
+      echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors,"
+      echo "but you have filled the parallel parameter in config->Executable->list."
+      echo "Please add BATCH_NUM_PROC_TOT variable in job header."
+      echo "We stop now."
+      exit 1
+    else
+      # sequential case !
+      if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then
+        (( PROCESSUS_NUMBER = 1 ))
+        echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)."
+        echo "We set it to 1."
+      fi
+    fi
+  fi
+
+  IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}"
+
+  IGCM_sys_build_execution_scripts
+
+  ExecutionFail=false
+
+  IGCM_debug_PopStack "IGCM_config_PeriodStart"
+}
+
+#===================================
+function IGCM_config_SaveSourceModifications
+{
+  IGCM_debug_PushStack "IGCM_config_SaveSourceModifications"
+
+  typeset ExeOutDateMax listVarEnv
+  ExeOutDateMax=$1
+
+  listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR"
+  IGCM_sys_RshMaster "\
+    . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \
+    export ExeOutDateMax=${ExeOutDateMax};\
+    export R_OUT_EXE=${R_OUT_EXE};\
+    export PREFIX=${PREFIX};\
+    export SUBMIT_DIR=${SUBMIT_DIR};\
+    export listVarEnv=${listVarEnv};\
+    Script_Output=out_SaveSourceModifications;\
+    IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}"
+
+  IGCM_debug_PopStack "IGCM_config_SaveSourceModifications"
 }
 
@@ -715,25 +804,26 @@
 function IGCM_config_PeriodEnd
 {
-    IGCM_debug_PushStack "IGCM_config_PeriodEnd"
-
-    echo
-    IGCM_debug_Print 1 "IGCM_config_PeriodEnd"
-    echo
-
-    #==================================#
-    #         Save Job output          #
-    #==================================#
-    IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output}
-    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}"
-
-    IGCM_card_CheckConflict run.card
-    IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card rw
-
-if [ ${DRYRUN} -le 1 ] ; then
+  IGCM_debug_PushStack "IGCM_config_PeriodEnd"
+
+  echo
+  IGCM_debug_Print 1 "IGCM_config_PeriodEnd"
+  echo
+
+  #==================================#
+  #         Save Job output          #
+  #==================================#
+  IGCM_sys_PutBuffer_Out ${Exe_Output} ${R_BUF_KSH}/${PREFIX}_${Exe_Output}
+  eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}"
+
+      IGCM_card_CheckConflict run.card
+      IGCM_sys_PutBuffer_Out ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card rw
+
+
+  if [ ${DRYRUN} -le 1 ] ; then
     IGCM_debug_Print 1 "Check components binary : size and creation date"
 
     typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize
     typeset comp i    
-    typeset ExeNameIn ExeNameOut 
+    typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax
 
     #==================================#
@@ -743,11 +833,11 @@
     (( i=0 ))
     if ( ${FirstInitialize} ) ; then
-	run_Log_LastExeSize=""
-	for comp in ${config_ListOfComponents[*]} ; do
-	    run_Log_LastExeSize[$i]=0
-	    (( i=i+1 ))
-	done
+      run_Log_LastExeSize=""
+      for comp in ${config_ListOfComponents[*]} ; do
+        run_Log_LastExeSize[$i]=0
+       (( i=i+1 ))
+      done
     else
-	IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize
+      IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize
     fi
     #==================================#
@@ -761,49 +851,62 @@
     NextExeSize="( "
     (( i=0 ))
-
+    UpdateExe=false
+    (( ExeSecDateMax = 0 ))
     for comp in ${config_ListOfComponents[*]} ; do
 
-	IGCM_debug_Print 3 ${comp}
-
-	eval ExeNameIn=\${config_Executable_${comp}[0]}
-	eval ExeNameOut=\${config_Executable_${comp}[1]}
-	# Only if we really have an executable for the component :
-	if [ X${ExeNameIn} = X\"\" ] ; then
-	    # If there is no exe file for this component
-	    (( ExeSize=0 ))
-	else
-	    eval LS_bin=${R_EXE}/${ExeNameIn}
-	    IGCM_sys_FileSize ${LS_bin} ExeSize
-
-	    set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} )
-	    if [ X${ExeDate} = X ] ; then 
-	        # First component exe date
-		ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]}
-	    else
-		ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]}
-	    fi
-	    ExeDate=${ExeDate}_${LS_comp[7]}
-	fi
-
-	if [ ${i} -eq 0 ] ; then
-	    # First component
-	    NextExeSize="( "${ExeSize}
-	else
-	    NextExeSize=${NextExeSize}", "${ExeSize}
-	fi
-	eval LastCompExeSize=${run_Log_LastExeSize[$i]}
-	(( i=i+1 ))
-
-	if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then
-	    if ( ${FirstInitialize} ) ; then
-		IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !"
-	    else
-		IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !"
-		IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !"
-		eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut}
-	    fi
-	    eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw
-	fi
+      IGCM_debug_Print 3 ${comp}
+
+      eval ExeNameIn=\${config_Executable_${comp}[0]}
+      eval ExeNameOut=\${config_Executable_${comp}[1]}
+      # Only if we really have an executable for the component :
+      if [ X${ExeNameIn} = X\"\" ] ; then
+        # If there is no exe file for this component
+        (( ExeSize=0 ))
+      else
+        eval LS_bin=${R_EXE}/${ExeNameIn}
+        IGCM_sys_FileSize ${LS_bin} ExeSize
+
+        set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} )
+        if [ X${ExeDate} = X ] ; then 
+          # First component exe date
+          ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]}
+        else
+          ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]}
+        fi
+        ExeDate=${ExeDate}_${LS_comp[7]}
+      fi
+
+      if [ ${i} -eq 0 ] ; then
+        # First component
+        NextExeSize="( "${ExeSize}
+      else
+        NextExeSize=${NextExeSize}", "${ExeSize}
+      fi
+      eval LastCompExeSize=${run_Log_LastExeSize[$i]}
+      (( i=i+1 ))
+
+      if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then
+        if ( ${FirstInitialize} ) ; then
+          IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !"
+        else
+          IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !"
+          IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !"
+          eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut}
+        fi
+        eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw
+        UpdateExe=true
+
+        IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate
+        if [ $ExeSecDateMax -lt $ExeSecDate ] ; then
+          ExeSecDateMax=$ExeSecDate
+        fi
+      fi
     done
+
+# SD : switch off for now
+#      if ( ${UpdateExe} ) ; then
+#	echo "Launch SaveSourceModifications."
+#	IGCM_config_SaveSourceModifications ${ExeSecDateMax}
+#      fi
 
     NextExeSize=${NextExeSize}" )"
@@ -814,135 +917,136 @@
     RET=$?
     if [ $RET -eq 0 ] ; then
-	    # ExeCpuLog variable contents 5 fields
-	    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \
-	    gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \
-                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card
+      # ExeCpuLog variable contents 5 fields
+      echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \
+      gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \
+            $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card
     fi
     eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt"
-fi
-
-    # All was right ? no ? then we stop.
-    IGCM_debug_Verif_Exit
-
-    # If all was OK, we can delete all files not necessary for next Job
+ 
+  fi 
+
+  # All was right ? no ? then we stop.
+  IGCM_debug_Verif_Exit
+
+  # If all was OK, we can delete all files not necessary for next Job
+  echo
+  IGCM_debug_Print 1 "Files that will be deleted before next period-run : "
+
+  if [ ${DRYRUN} -le 2 ] ; then
+    for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done
+  else
+    echo ${FileToBeDeleted[@]}
+  fi
+
+  #=================================================#
+  #         Modification of libIGCM behaviour       #
+  #=================================================#
+
+  # To use this function, one must copy libIGCM.card from ${libIGCM} directory
+  # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card,
+  # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
+  if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then
     echo
-    IGCM_debug_Print 1 "Files that will be deleted before next period-run : "
-
-    if [ ${DRYRUN} -le 2 ] ; then
-	for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done
-    else
-	echo ${FileToBeDeleted[@]}
-    fi
-
-    #=================================================#
-    #         Modification of libIGCM behaviour       #
-    #=================================================#
-
-    # To use this function, one must copy libIGCM.card from ${libIGCM} directory
-    # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card,
-    # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
-    if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then
-	echo
-	echo "########################################################################"
-	echo "!!!                 Modification of libIGCM behaviour                !!!"
-	echo
-
-	IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card"
-	IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges
-	IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]}
-
-	# Special treatments for libIGCM internals
-	for option in ${libIGCM_UserChanges[*]} ; do
-            IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option}
-
-	    echo "We will change : ${option}."
-	    eval echo "Previous value : " \${${option}}
-	    eval echo "Change to : " \${libIGCM_UserChanges_${option}}
-	    
-	    eval ${option}=\${libIGCM_UserChanges_${option}}
-
-	    case ${option} in
-		config_UserChoices_DateEnd)
-		    IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd
-		    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
-
-                    # Period Length In Days between DateBegin and DateEnd
-		    (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
-		    if [ ${ExperienceLengthInDays} -lt 0 ] ; then
-			IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that."
-			IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates."
-			IGCM_debug_Verif_Exit 
-		    fi
-		    ;;
-		config_UserChoices_PeriodLength)
-		    IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}"
-		    ;;
-		PeriodNb)
-		    IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)"
-		    ;;
-		config_Post_RebuildFrequency)
-		    IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure"
-		    IGCM_post_Configure
-		    ;;
-		config_Post_TimeSeriesFrequency)
-		    IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize"
-		    IGCM_post_Configure
-		    ;;
-		config_Post_SeasonalFrequency)
-		    IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize"
-		    IGCM_post_Configure
-		    ;;
-	    esac
-	done
-
-	echo
-	echo "########################################################################"
-	echo
-    fi
-
-    #=================================================#
-    #         Determine next computed period          #
-    #=================================================#
-
-    PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 )
-    IGCM_date_GetYearMonth $PeriodDateBegin year month
-    year_m1=$(( year - 1 ))
-    year_p1=$(( year + 1 ))
-    IGCM_config_Analyse_PeriodLength
-    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) )
-
-    # Debug Print :
+    echo "########################################################################"
+    echo "!!!                 Modification of libIGCM behaviour                !!!"
     echo
-    IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution"
-    IGCM_debug_Print 1 "PeriodDateBegin       : ${PeriodDateBegin}"
-    IGCM_debug_Print 1 "PeriodDateEnd         : ${PeriodDateEnd}"
-    IGCM_debug_Print 1 "PeriodLengthInDays    : ${PeriodLengthInDays}"
-
-    PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} )
-    PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} )
-
-    (( CumulPeriod = CumulPeriod + 1 ))
-
-    # Debug Print :
+
+    IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card"
+    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges
+    IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]}
+
+    # Special treatments for libIGCM internals
+    for option in ${libIGCM_UserChanges[*]} ; do
+      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option}
+
+      echo "We will change : ${option}."
+      eval echo "Previous value : " \${${option}}
+      eval echo "Change to : " \${libIGCM_UserChanges_${option}}
+	  
+      eval ${option}=\${libIGCM_UserChanges_${option}}
+
+      case ${option} in
+        config_UserChoices_DateEnd)
+          IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd
+          DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+
+          # Period Length In Days between DateBegin and DateEnd
+          (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
+          if [ ${ExperienceLengthInDays} -lt 0 ] ; then
+            IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that."
+            IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates."
+            IGCM_debug_Verif_Exit 
+          fi
+	;;
+        config_UserChoices_PeriodLength)
+          IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}"
+        ;;
+        PeriodNb)
+          IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)"
+	;;
+        config_Post_RebuildFrequency)
+          IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure"
+          IGCM_post_Configure
+        ;;
+        config_Post_TimeSeriesFrequency)
+          IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize"
+          IGCM_post_Configure
+        ;;
+        config_Post_SeasonalFrequency)
+        IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize"
+        IGCM_post_Configure
+        ;;
+      esac
+    done
+
     echo
-    IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}"
-    IGCM_debug_Print 3 "PeriodDateEnd Human   : ${PeriodDateEnd}"
-    IGCM_debug_Print 3 "CumulPeriod           : ${CumulPeriod}"
-
-    #=================================================#
-    #             Write updated run.card              #
-    #=================================================#
-
-    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix}
-    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
-    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
-    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
-
-    if ( ${FirstInitialize} ) ; then
-        # It's no more the first time
-	FirstInitialize=false
-    fi
-
-    IGCM_debug_PopStack "IGCM_config_PeriodEnd"
+    echo "########################################################################"
+    echo
+  fi
+
+  #=================================================#
+  #         Determine next computed period          #
+  #=================================================#
+
+  PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 )
+  IGCM_date_GetYearMonthDay $PeriodDateBegin year month day
+  year_m1=$(( year - 1 ))
+  year_p1=$(( year + 1 ))
+  IGCM_config_Analyse_PeriodLength
+  PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) )
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution"
+  IGCM_debug_Print 1 "PeriodDateBegin       : ${PeriodDateBegin}"
+  IGCM_debug_Print 1 "PeriodDateEnd         : ${PeriodDateEnd}"
+  IGCM_debug_Print 1 "PeriodLengthInDays    : ${PeriodLengthInDays}"
+
+  PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} )
+  PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} )
+
+  (( CumulPeriod = CumulPeriod + 1 ))
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}"
+  IGCM_debug_Print 3 "PeriodDateEnd Human   : ${PeriodDateEnd}"
+  IGCM_debug_Print 3 "CumulPeriod           : ${CumulPeriod}"
+
+  #=================================================#
+  #             Write updated run.card              #
+  #=================================================#
+
+  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix}
+  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
+  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
+  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
+
+  if ( ${FirstInitialize} ) ; then
+    # It's no more the first time
+    FirstInitialize=false
+  fi
+
+  IGCM_debug_PopStack "IGCM_config_PeriodEnd"
 }
 
@@ -950,60 +1054,63 @@
 function IGCM_config_Finalize
 {
-    IGCM_debug_PushStack "IGCM_config_Finalize"
-
-    echo
-    IGCM_debug_Print 1 "IGCM_config_Finalize"
-    echo
-
-    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
-	#==========================#
-        # End of entire simulation #
-        #==========================#
-
-	# Mail notification
-	IGCM_sys_SendMail
-
-	#
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed"
-	IGCM_debug_Print 1 "Normal End of computation."
-	if ( $DEBUG_debug ) ; then
-	    echo
-	    IGCM_debug_Print 1 "Your files on ${R_OUT} :"
-	    IGCM_sys_Tree ${R_SAVE}
-	fi
-    else
-	#=================#
-        # Submit next job #
-        #=================#
-
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
-
-        # Name of next Ksh Script output :
-	eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )"
-
-	IGCM_debug_Print 1 "Submit next job"
-        # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR
-	IGCM_sys_Cd ${SUBMIT_DIR}
-	# Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName}
-	ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l )
-	[ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) )
-	# Submit next job and come back
-	IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}
-        IGCM_sys_Cd -
-    fi
-
-    # Supress Non Deleted Boundary files
-    if [ ${DRYRUN} -le 2 ] ; then
-	IGCM_comp_DelFixeBoundaryFiles
-	ls -la
-    fi
-    
-    # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-    # Only for production run (No clean up in DEV or DEB mode)
-    # and command sent from .. directory.
-    IGCM_sys_Cd ..
-    [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR}
-
-    IGCM_debug_PopStack "IGCM_config_Finalize"
+  IGCM_debug_PushStack "IGCM_config_Finalize"
+
+  echo
+  IGCM_debug_Print 1 "IGCM_config_Finalize"
+  echo
+
+  if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
+    #==========================#
+    # End of entire simulation #
+    #==========================#
+
+    # Mail notification
+    IGCM_sys_SendMail
+
+    #
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed"
+    IGCM_debug_Print 1 "Normal End of computation."
+    if ( $DEBUG_debug ) ; then
+      echo
+      IGCM_debug_Print 1 "Your files on ${R_SAVE} :"
+      IGCM_sys_Tree ${R_SAVE}
+
+      IGCM_debug_Print 1 "Your files on ${R_BUFR} :"
+      IGCM_sys_Tree ${R_BUFR}
+    fi
+  else
+    #=================#
+    # Submit next job #
+    #=================#
+
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
+
+    # Name of next Ksh Script output :
+    eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )"
+
+    IGCM_debug_Print 1 "Submit next job"
+    # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR
+    IGCM_sys_Cd ${SUBMIT_DIR}
+    # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName}
+    ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l )
+    [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) )
+    # Submit next job and come back
+    IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}
+    IGCM_sys_Cd -
+  fi
+
+  # Supress Non Deleted Boundary files
+  if [ ${DRYRUN} -le 2 ] ; then
+    IGCM_comp_DelFixeBoundaryFiles
+    ls -la
+  fi
+  
+  # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  # Only for production run (No clean up in DEV or DEB mode)
+  # and command sent from .. directory.
+  IGCM_sys_Cd ..
+  [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR}
+
+  IGCM_debug_PopStack "IGCM_config_Finalize"
 }
 
Index: branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh	(revision 571)
@@ -42,10 +42,10 @@
 function IGCM_date_YearDigit
 {
-    IGCM_debug_PushStack "IGCM_date_YearDigit" $@
-
-    NUM=$(( 10#${1} ))
-    echo $( gawk "BEGIN { printf \"%0${dY}d\",${NUM} }" )
-
-    IGCM_debug_PopStack "IGCM_date_YearDigit"
+  IGCM_debug_PushStack "IGCM_date_YearDigit" $@
+
+  NUM=$(( 10#${1} ))
+  echo $( gawk "BEGIN { printf \"%0${dY}d\",${NUM} }" )
+
+  IGCM_debug_PopStack "IGCM_date_YearDigit"
 }
 
@@ -53,10 +53,10 @@
 function IGCM_date_GregorianDigit
 {
-    IGCM_debug_PushStack "IGCM_date_GregorianDigit" $@
-
-    NUM=$(( 10#${1} ))
-    echo $( gawk "BEGIN { printf \"%0${pY}d\",${NUM} }" )
-
-    IGCM_debug_PopStack "IGCM_date_GregorianDigit"
+  IGCM_debug_PushStack "IGCM_date_GregorianDigit" $@
+
+  NUM=$(( 10#${1} ))
+  echo $( gawk "BEGIN { printf \"%0${pY}d\",${NUM} }" )
+
+  IGCM_debug_PopStack "IGCM_date_GregorianDigit"
 }
 
@@ -64,10 +64,10 @@
 function IGCM_date_HumanDigit
 {
-    IGCM_debug_PushStack "IGCM_date_HumanDigit" $@
-
-    echo $( IGCM_date_GregorianDigit $( print ${1} | sed 's/-//g' ) ) \
-	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
-
-    IGCM_debug_PopStack "IGCM_date_HumanDigit"
+  IGCM_debug_PushStack "IGCM_date_HumanDigit" $@
+
+  echo $( IGCM_date_GregorianDigit $( print ${1} | sed 's/-//g' ) ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
+
+  IGCM_debug_PopStack "IGCM_date_HumanDigit"
 }
 
@@ -75,7 +75,7 @@
 function IGCM_date_SupressZeros
 {
-    IGCM_debug_PushStack "IGCM_date_SupressZeros" $@
-    echo $( print ${1} | sed -e "s/0*//" )
-    IGCM_debug_PopStack "IGCM_date_SupressZeros"
+  IGCM_debug_PushStack "IGCM_date_SupressZeros" $@
+  echo $( print ${1} | sed -e "s/0*//" )
+  IGCM_debug_PopStack "IGCM_date_SupressZeros"
 }
 
@@ -83,24 +83,24 @@
 function IGCM_date_ConvertFormatToGregorian
 {
-    IGCM_debug_PushStack "IGCM_date_ConvertFormatToGregorian" $@
-
-    # from a yyyy-mm-dd date format return 
-    # a yyymmdd date format
-    # usage IGCM_date_ConvertFormat yyyy-mm-dd
-
-    # if there is no argument on the command line, 
-    # then assume that a y-m-d formated date is being 
-    # piped in
-    typeset ymd
-    if [ $# = 0 ]
-	then
-	read ymd
-    else
-	ymd=$1
-    fi
-
-    IGCM_date_GregorianDigit $( print ${ymd} | sed 's/-//g' )
-
-    IGCM_debug_PopStack "IGCM_date_ConvertFormatToGregorian"
+  IGCM_debug_PushStack "IGCM_date_ConvertFormatToGregorian" $@
+
+  # from a yyyy-mm-dd date format return 
+  # a yyymmdd date format
+  # usage IGCM_date_ConvertFormat yyyy-mm-dd
+
+  # if there is no argument on the command line, 
+  # then assume that a y-m-d formated date is being 
+  # piped in
+  typeset ymd
+  if [ $# = 0 ]
+  then
+    read ymd
+  else
+    ymd=$1
+  fi
+
+  IGCM_date_GregorianDigit $( print ${ymd} | sed 's/-//g' )
+
+  IGCM_debug_PopStack "IGCM_date_ConvertFormatToGregorian"
 }
 
@@ -108,26 +108,26 @@
 function IGCM_date_ConvertFormatToHuman
 {
-    IGCM_debug_PushStack "IGCM_date_ConvertFormatToHuman" $@
-
-    # from a yyyymmdd date format return 
-    # a yyyy-mm-dd date format
-    # usage IGCM_date_ConvertFormat yyyymmdd
-
-    # if there is no argument on the command line, 
-    # then assume that a yyyymmdd formated date is being 
-    # piped in
-    typeset dt
-    if [ $# = 0 ]
-	then
-	read dt
-    else
-	dt=$1
-    fi
-
-    # break the yyyymmdd into separate parts for year, month and day
-    echo $( IGCM_date_GregorianDigit ${dt} ) \
-	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
-
-    IGCM_debug_PopStack "IGCM_date_ConvertFormatToHuman"
+  IGCM_debug_PushStack "IGCM_date_ConvertFormatToHuman" $@
+
+  # from a yyyymmdd date format return 
+  # a yyyy-mm-dd date format
+  # usage IGCM_date_ConvertFormat yyyymmdd
+
+  # if there is no argument on the command line, 
+  # then assume that a yyyymmdd formated date is being 
+  # piped in
+  typeset dt
+  if [ $# = 0 ]
+  then
+    read dt
+  else
+    dt=$1
+  fi
+
+  # break the yyyymmdd into separate parts for year, month and day
+  echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
+
+  IGCM_debug_PopStack "IGCM_date_ConvertFormatToHuman"
 }
 
@@ -135,28 +135,59 @@
 function IGCM_date_GetYearMonth
 {
-    IGCM_debug_PushStack "IGCM_date_GetYearMonth" $@
-
-    # from a yyyymmdd date format return 
-    # a yyyy year and mm month
-    # usage IGCM_date_GetYearMonth yyyymmdd year_var month_var
-
-    # if there is no argument on the command line, 
-    # then assume that a yyyymmdd formated date is being 
-    # piped in
-    typeset dt
-    if [ $# = 0 ]
-	then
-	read dt
-    else
-	dt=$1
-    fi
-
-    # break the yyyymmdd into separate parts for year, month and day
-    eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
-	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" )
-    eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
-	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" )
-
-    IGCM_debug_PopStack "IGCM_date_GetYearMonth"
+  IGCM_debug_PushStack "IGCM_date_GetYearMonth" $@
+
+  # from a yyyymmdd date format return 
+  # a yyyy year and mm month
+  # usage IGCM_date_GetYearMonth yyyymmdd year_var month_var
+
+  # if there is no argument on the command line, 
+  # then assume that a yyyymmdd formated date is being 
+  # piped in
+  typeset dt
+  if [ $# = 0 ]
+  then
+    read dt
+  else
+    dt=$1
+  fi
+
+  # break the yyyymmdd into separate parts for year, month and day
+  eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" )
+  eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" )
+
+  IGCM_debug_PopStack "IGCM_date_GetYearMonth"
+}
+
+#==================================================================
+function IGCM_date_GetYearMonthDay
+{
+  IGCM_debug_PushStack "IGCM_date_GetYearMonthDay" $@
+
+  # from a yyyymmdd date format return 
+  # a yyyy year, mm month and dd day
+  # usage IGCM_date_GetYearMonthDay yyyymmdd year_var month_var day_var
+
+  # if there is no argument on the command line, 
+  # then assume that a yyyymmdd formated date is being 
+  # piped in
+  typeset dt
+  if [ $# = 0 ]
+  then
+    read dt
+  else
+    dt=$1
+  fi
+
+  # break the yyyymmdd into separate parts for year, month and day
+  eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" )
+  eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" )
+  eval $4=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+    | sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3/" )
+
+  IGCM_debug_PopStack "IGCM_date_GetYearMonthDay"
 }
 
@@ -171,100 +202,100 @@
 {
 #    IGCM_debug_PushStack "IGCM_date_DaysInYear" $@
-    # return the number of days in a year
-    # usage IGCM_date_DaysInYear yyyy
-
-    # What is the calendar :
-    case ${config_UserChoices_CalendarType} in
-	360d|360_day)
-	    if [ X$2 = X ] ; then
-		echo 360
-	    else
-		eval $2=360 > /dev/null 2>&1
-	    fi
+  # return the number of days in a year
+  # usage IGCM_date_DaysInYear yyyy
+
+  # What is the calendar :
+  case ${config_UserChoices_CalendarType} in
+  360d|360_day)
+    if [ X$2 = X ] ; then
+      echo 360
+    else
+      eval $2=360 > /dev/null 2>&1
+    fi
 #	IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	    return;;
-	noleap|365_day)
-	    if [ X$2 = X ] ; then
-	        echo 365
-	    else
-	        eval $2=365 > /dev/null 2>&1
-	    fi
-
-#	    IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	    return;;
-	all_leap|366_day)
-	    if [ X$2 = X ] ; then
-		echo 366
-	    else
-	        eval $2=366 > /dev/null 2>&1
-	    fi
-
-#	        IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	    return;;
-    esac
-
-    typeset y a
-
-    # if there is no argument on the command line, 
-    # then assume that a yyyy is being piped in
-    if [ $# = 0 ]
-	then
-	read y
-    else
-	y=$(( 10#${1} ))
-    fi
-
-    # a year is a leap year if it is even divisible by 4
-    # but not evenly divisible by 100
-    # unless it is evenly divisible by 400
-
-    # if it is evenly divisible by 400 it must be a leap year
-    a=$(( $y % 400 ))
-    if [ $a = 0 ]
-	then
-	if [ X$2 = X ] ; then
-	    echo 366
-	else
-	    eval $2=366 > /dev/null 2>&1
-	fi
+    return;;
+  noleap|365_day)
+    if [ X$2 = X ] ; then
+      echo 365
+    else
+      eval $2=365 > /dev/null 2>&1
+    fi
 
 #	IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	return
-    fi
-
-    #if it is evenly divisible by 100 it must not be a leap year
-    a=$(( $y % 100 ))
-    if [ $a = 0 ]
-	then
-	if [ X$2 = X ] ; then
-	    echo 365
-	else
-	    eval $2=365 > /dev/null 2>&1
-	fi
+    return;;
+  all_leap|366_day)
+    if [ X$2 = X ] ; then
+      echo 366
+    else
+      eval $2=366 > /dev/null 2>&1
+    fi
 
 #	IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	return
-    fi
-	
-    # if it is evenly divisible by 4 it must be a leap year
-    a=$(( $y % 4 ))
-    if [ $a = 0 ]
-	then
-	if [ X$2 = X ] ; then
-	    echo 366
-	else
-	    eval $2=366 > /dev/null 2>&1
-	fi
+    return;;
+  esac
+
+  typeset y a
+
+  # if there is no argument on the command line, 
+  # then assume that a yyyy is being piped in
+  if [ $# = 0 ]
+  then
+    read y
+  else
+    y=$(( 10#${1} ))
+  fi
+
+  # a year is a leap year if it is even divisible by 4
+  # but not evenly divisible by 100
+  # unless it is evenly divisible by 400
+
+  # if it is evenly divisible by 400 it must be a leap year
+  a=$(( $y % 400 ))
+  if [ $a = 0 ]
+  then
+    if [ X$2 = X ] ; then
+      echo 366
+    else
+      eval $2=366 > /dev/null 2>&1
+    fi
 
 #	IGCM_debug_PopStack "IGCM_date_DaysInYear"
-	return
-    fi
-
-    # otherwise it is not a leap year
+    return
+  fi
+
+  # if it is evenly divisible by 100 it must not be a leap year
+  a=$(( $y % 100 ))
+  if [ $a = 0 ]
+  then
     if [ X$2 = X ] ; then
-        echo 365
-    else
-        eval $2=365 > /dev/null 2>&1
-    fi
+      echo 365
+    else
+      eval $2=365 > /dev/null 2>&1
+    fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+    return
+  fi
+  
+  # if it is evenly divisible by 4 it must be a leap year
+  a=$(( $y % 4 ))
+  if [ $a = 0 ]
+  then
+    if [ X$2 = X ] ; then
+      echo 366
+    else
+      eval $2=366 > /dev/null 2>&1
+    fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+    return
+  fi
+
+  # otherwise it is not a leap year
+  if [ X$2 = X ] ; then
+    echo 365
+  else
+    eval $2=365 > /dev/null 2>&1
+  fi
 
 #    IGCM_debug_PopStack "IGCM_date_DaysInYear"
@@ -284,87 +315,87 @@
 #    IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@
 
-    # calculates the number of days in a month 
-    # usage IGCM_date_DaysInMonth yyyy mm
-    # or IGCM_date_DaysInMonth yyyymmdd
+  # calculates the number of days in a month 
+  # usage IGCM_date_DaysInMonth yyyy mm
+  # or IGCM_date_DaysInMonth yyyymmdd
+  
+  # What is the calendar :
+  if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then
+    if [ X$3 = X ] ; then
+      echo 30
+    else
+      eval $3=30 > /dev/null 2>&1
+    fi
+
+#   IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+    return
+  fi
+
+  typeset ymd y m
+
+  # if there are no command line arguments then assume that a yyyymmdd is being
+  # piped in and read the value.
+  # if there is only one argument assume it is a yyyymmdd on the command line
+  # other wise it is a yyyy and mm on the command line
+  if [ $# = 0 ]
+  then
+    read ymd
+  elif [ $# = 1 ] 
+  then
+    ymd=$1
+  else
+    ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 ))
+  fi
+
+  # extract the year and the month
+  y=$(( $ymd / 10000 )) ;
+  m=$(( ( $ymd % 10000 ) / 100 )) ;
+
+  # 30 days hath september etc.
+  case $m in
+  1|3|5|7|8|10|12) 
+    if [ X$3 = X ] ; then
+      echo 31
+    else
+      eval $3=31 > /dev/null 2>&1
+    fi
+
+#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+    return ;;
+  4|6|9|11) 
+    if [ X$3 = X ] ; then
+      echo 30
+    else
+      eval $3=30 > /dev/null 2>&1
+    fi
     
-    # What is the calendar :
-    if ( [ "${config_UserChoices_CalendarType}" = "360d" ] || [ "${config_UserChoices_CalendarType}" = "360_day" ] ) ; then
-	if [ X$3 = X ] ; then
-	    echo 30
-	else
-	    eval $3=30 > /dev/null 2>&1
-	fi
-
-#	IGCM_debug_PopStack "IGCM_date_DaysInMonth"
-	return
-    fi
-
-    typeset ymd y m
-
-    # if there are no command line arguments then assume that a yyyymmdd is being
-    # piped in and read the value.
-    # if there is only one argument assume it is a yyyymmdd on the command line
-    # other wise it is a yyyy and mm on the command line
-    if [ $# = 0 ]
-	then
-	read ymd
-    elif [ $# = 1 ] 
-	then
-	ymd=$1
-    else
-	ymd=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 ))
-    fi
-
-    # extract the year and the month
-    y=$(( $ymd / 10000 )) ;
-    m=$(( ( $ymd % 10000 ) / 100 )) ;
-
-    # 30 days hath september etc.
-    case $m in
-	1|3|5|7|8|10|12) 
-	    if [ X$3 = X ] ; then
-	        echo 31
-	    else
-	        eval $3=31 > /dev/null 2>&1
-	    fi
-
 #	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
-	    return ;;
-	4|6|9|11) 
-	    if [ X$3 = X ] ; then
-	        echo 30
-	    else
-	        eval $3=30 > /dev/null 2>&1
-	    fi
-	
-#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
-	    return ;;
-	*) ;;
-    esac
-
-    # except for month 2 which depends on whether the year is a leap year
-    # Use IGCM_date_DaysInYear to get the number of days in the year and return a value
-    # accordingly.
-    IGCM_date_DaysInYear $y diy
-    case $diy in
-	365) 
-	    if [ X$3 = X ] ; then
-	        echo 28
-	    else
-	        eval $3=28 > /dev/null 2>&1
-	    fi
-
-#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
-	    return ;;
-	366) 
-	    if [ X$3 = X ] ; then
-	        echo 29
-	    else
-	        eval $3=29 > /dev/null 2>&1
-	    fi
-
-#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
-	    return ;;
-    esac
+    return ;;
+  *) ;;
+  esac
+
+  # except for month 2 which depends on whether the year is a leap year
+  # Use IGCM_date_DaysInYear to get the number of days in the year and return a value
+  # accordingly.
+  IGCM_date_DaysInYear $y diy
+  case $diy in
+  365) 
+    if [ X$3 = X ] ; then
+      echo 28
+    else
+      eval $3=28 > /dev/null 2>&1
+    fi
+
+#    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+    return ;;
+  366) 
+    if [ X$3 = X ] ; then
+      echo 29
+    else
+      eval $3=29 > /dev/null 2>&1
+    fi
+
+#    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+    return ;;
+  esac
 
 #    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
@@ -380,43 +411,43 @@
 function IGCM_date_ConvertGregorianDateToJulian
 {
-    IGCM_debug_PushStack "IGCM_date_ConvertGregorianDateToJulian" $@
-
-    # IGCM_date_ConvertGregorianDateToJulian converts yyyymmdd to yyyyddd
-    # usage IGCM_date_ConvertGregorianDateToJulian 19980429
-
-    typeset dt y m d x jul
-
-    # if there is no command line argument, then assume that the date
-    # is coming in on a pipe and use read to collect it    
-    if [ $# = 0 ]
-	then
-	read dt
-    else
-	dt=$( IGCM_date_SupressZeros $1 )
-    fi
-
-    # break the yyyymmdd into separate parts for year, month and day
-    y=$(( $dt / 10000 ))
-    m=$(( ( $dt % 10000 ) / 100 ))
-    d=$(( ( $dt % 100 ) ))
-
-    # add the days in each month up to (but not including the month itself)
-    # into the days. For example if the date is 19980203 then extract the
-    # number of days in January and add it to 03. If the date is June 14, 1998
-    # then extract the number of days in January, February, March, April and May
-    # and add them to 14.
-    x=1
-    while [ $x -lt $m ]
-      do
-      IGCM_date_DaysInMonth $y $x md
-      d=$(( $d + $md ))
-      x=$(( $x + 1 ))
-    done
-
-    # combine the year and day back together again and you have the julian date.
-    jul=$(( ( $y * 1000 ) + $d ))
-    echo $jul
-
-    IGCM_debug_PopStack "IGCM_date_ConvertGregorianDateToJulian"
+  IGCM_debug_PushStack "IGCM_date_ConvertGregorianDateToJulian" $@
+
+  # IGCM_date_ConvertGregorianDateToJulian converts yyyymmdd to yyyyddd
+  # usage IGCM_date_ConvertGregorianDateToJulian 19980429
+
+  typeset dt y m d x jul
+
+  # if there is no command line argument, then assume that the date
+  # is coming in on a pipe and use read to collect it    
+  if [ $# = 0 ]
+  then
+    read dt
+  else
+    dt=$( IGCM_date_SupressZeros $1 )
+  fi
+
+  # break the yyyymmdd into separate parts for year, month and day
+  y=$(( $dt / 10000 ))
+  m=$(( ( $dt % 10000 ) / 100 ))
+  d=$(( ( $dt % 100 ) ))
+
+  # add the days in each month up to (but not including the month itself)
+  # into the days. For example if the date is 19980203 then extract the
+  # number of days in January and add it to 03. If the date is June 14, 1998
+  # then extract the number of days in January, February, March, April and May
+  # and add them to 14.
+  x=1
+  while [ $x -lt $m ]
+  do
+    IGCM_date_DaysInMonth $y $x md
+    d=$(( $d + $md ))
+    x=$(( $x + 1 ))
+  done
+
+  # combine the year and day back together again and you have the julian date.
+  jul=$(( ( $y * 1000 ) + $d ))
+  echo $jul
+
+  IGCM_debug_PopStack "IGCM_date_ConvertGregorianDateToJulian"
 }
 
@@ -430,46 +461,46 @@
 function IGCM_date_ConvertJulianDateToGregorian
 {
-    IGCM_debug_PushStack "IGCM_date_ConvertJulianDateToGregorian" $@
-
-    # IGCM_date_ConvertJulianDateToGregorian converts yyyyddd to yyyymmdd
-    # usage IGCM_date_ConvertJulianDateToGregorian 1998213
-
-    typeset dt y m d grg
-
-    # if there is no command line argument, assume one is being 
-    # piped in and read it
-    if [ X$1 = X ]
-	then
-	read dt
-    else
-	dt=$1
-    fi
-	
-    # break apart the year and the days
-    y=$(( $dt / 1000 ))
-    d=$(( $dt % 1000 ))
-	
-    # subtract the number of days in each month starting from 1
-    # from the days in the date. When the day goes below 1, you
-    # have the current month. Add back the number of days in the
-    # month to get the correct day of the month
-    m=1
-    while [ $d -gt 0 ]
-      do
-      IGCM_date_DaysInMonth $y $m md
-      d=$(( $d - $md ))
-      m=$(( $m + 1 ))
-    done
-
-    d=$(( $d + $md ))
-
-    # the loop steps one past the correct month, so back up the month
-    m=$(( $m - 1 ))
-
-    # assemble the results into a gregorian date
-    grg=$(( ( $y * 10000 ) + ( $m * 100 ) + $d ))
-    echo $( IGCM_date_GregorianDigit $grg )
-
-    IGCM_debug_PopStack "IGCM_date_ConvertJulianDateToGregorian"
+  IGCM_debug_PushStack "IGCM_date_ConvertJulianDateToGregorian" $@
+
+  # IGCM_date_ConvertJulianDateToGregorian converts yyyyddd to yyyymmdd
+  # usage IGCM_date_ConvertJulianDateToGregorian 1998213
+
+  typeset dt y m d grg
+
+  # if there is no command line argument, assume one is being 
+  # piped in and read it
+  if [ X$1 = X ]
+  then
+    read dt
+  else
+    dt=$1
+  fi
+  
+  # break apart the year and the days
+  y=$(( $dt / 1000 ))
+  d=$(( $dt % 1000 ))
+  
+  # subtract the number of days in each month starting from 1
+  # from the days in the date. When the day goes below 1, you
+  # have the current month. Add back the number of days in the
+  # month to get the correct day of the month
+  m=1
+  while [ $d -gt 0 ]
+  do
+    IGCM_date_DaysInMonth $y $m md
+    d=$(( $d - $md ))
+    m=$(( $m + 1 ))
+  done
+
+  d=$(( $d + $md ))
+
+  # the loop steps one past the correct month, so back up the month
+  m=$(( $m - 1 ))
+
+  # assemble the results into a gregorian date
+  grg=$(( ( $y * 10000 ) + ( $m * 100 ) + $d ))
+  echo $( IGCM_date_GregorianDigit $grg )
+
+  IGCM_debug_PopStack "IGCM_date_ConvertJulianDateToGregorian"
 }
 
@@ -483,63 +514,63 @@
 function IGCM_date_AddDaysToJulianDate
 {
-    IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@
-
-    # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date
-    # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14
-
-    typeset dif yd d y
-
-    # Read the difference from the command lines
-    # and the date from the command line, or standard input
-    if [ X$2 = X ]
-	then
-	dif=$1
-	read yd
-    else
-	yd=$1
-	dif=$2
-    fi
-
-    # Break it into pieces
-    d=$(( $yd % 1000 ))
-    y=$(( $yd / 1000 ))
-
-    # Add the number of days (if days is negative this results is
-    # a subtraction)
-    d=$(( $d + $dif ))
-
-    # Extract the days in the year
+  IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@
+
+  # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date
+  # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14
+
+  typeset dif yd d y
+
+  # Read the difference from the command lines
+  # and the date from the command line, or standard input
+  if [ X$2 = X ]
+  then
+    dif=$1
+    read yd
+  else
+    yd=$1
+    dif=$2
+  fi
+
+  # Break it into pieces
+  d=$(( $yd % 1000 ))
+  y=$(( $yd / 1000 ))
+
+  # Add the number of days (if days is negative this results is
+  # a subtraction)
+  d=$(( $d + $dif ))
+
+  # Extract the days in the year
+  IGCM_date_DaysInYear $y diy
+
+  # If the calculated day exceeds the days in the year, 
+  # add one year to the year and subtract the days in the year from the
+  # calculated days. Extract the days in the new year and repeat
+  # test until you end up with a day number that falls within the
+  # days of the year
+  while [ $d -gt $diy ]
+  do
+    d=$(( $d - $diy ))
+    y=$(( $y + 1 ))
     IGCM_date_DaysInYear $y diy
-
-    # If the calculated day exceeds the days in the year, 
-    # add one year to the year and subtract the days in the year from the
-    # calculated days. Extract the days in the new year and repeat
-    # test until you end up with a day number that falls within the
-    # days of the year
-    while [ $d -gt $diy ]
-      do
-      d=$(( $d - $diy ))
-      y=$(( $y + 1 ))
-      IGCM_date_DaysInYear $y diy
-    done
-
-    # This is the reverse process. If the calculated number of days
-    # is less than 1, move back one year. Extract
-    # the days in this year and add the days in the year
-    # loop on this test until you end up with a number that
-    # falls within the days of the year
-    while [ $d -lt 1 ]
-      do
-      y=$(( $y - 1 ))
-      IGCM_date_DaysInYear $y diy
-      d=$(( $d + $diy ))
-    done
-
-    # put the year and day back together and echo the result
-    yd=$(( ( $y * 1000 ) + $d ))
-
-    echo $yd
-
-    IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate"
+  done
+
+  # This is the reverse process. If the calculated number of days
+  # is less than 1, move back one year. Extract
+  # the days in this year and add the days in the year
+  # loop on this test until you end up with a number that
+  # falls within the days of the year
+  while [ $d -lt 1 ]
+  do
+    y=$(( $y - 1 ))
+    IGCM_date_DaysInYear $y diy
+    d=$(( $d + $diy ))
+  done
+
+  # put the year and day back together and echo the result
+  yd=$(( ( $y * 1000 ) + $d ))
+
+  echo $yd
+
+  IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate"
 }
 
@@ -553,28 +584,28 @@
 function IGCM_date_AddDaysToGregorianDate
 {
-    IGCM_debug_PushStack "IGCM_date_AddDaysToGregorianDate" $@
-
-    # IGCM_date_AddDaysToGregorianDate adds days to a yyyymmdd formatted date
-    # usage IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14
-
-    # Read the difference from the command lines
-    # and the date from the command line, or standard input
-    typeset dif yd tmp res
-    if [ X$2 = X ]
-	then
-	dif=$1
-	read yd
-    else
-	yd=$1
-	dif=$2
-    fi
-
-    tmp=$( IGCM_date_ConvertGregorianDateToJulian $yd )
-    tmp=$( IGCM_date_AddDaysToJulianDate $tmp $dif )
-    res=$( IGCM_date_ConvertJulianDateToGregorian $tmp )
-    
-    echo $res
-
-    IGCM_debug_PopStack "IGCM_date_AddDaysToGregorianDate"
+  IGCM_debug_PushStack "IGCM_date_AddDaysToGregorianDate" $@
+
+  # IGCM_date_AddDaysToGregorianDate adds days to a yyyymmdd formatted date
+  # usage IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14
+
+  # Read the difference from the command lines
+  # and the date from the command line, or standard input
+  typeset dif yd tmp res
+  if [ X$2 = X ]
+  then
+    dif=$1
+    read yd
+  else
+    yd=$1
+    dif=$2
+  fi
+
+  tmp=$( IGCM_date_ConvertGregorianDateToJulian $yd )
+  tmp=$( IGCM_date_AddDaysToJulianDate $tmp $dif )
+  res=$( IGCM_date_ConvertJulianDateToGregorian $tmp )
+  
+  echo $res
+
+  IGCM_debug_PopStack "IGCM_date_AddDaysToGregorianDate"
 }
 
@@ -588,83 +619,82 @@
 function IGCM_date_DaysBetweenJulianDate
 {
-    IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@
-
-    # calculates the days difference between two dates and reports 
-    # the number days as jul1 - jul2 
-    # usage IGCM_date_DaysBetweenJulianDate jul1 jul2
-    # where julian date is in the form yyyyddd
-    
-    usage () {
-	echo "Usage:"
-	echo " IGCM_date_DaysBetweenJulianDate jul1 jul2"
-	echo ""
-	echo " Calculates the day difference between"
-	echo " two julian dates (jul1 -jul2)"
-	echo " where a julian date is in the form of yyyyddd."
-    }
- 
-    if [ $# -lt 2 ]; then
-	usage
-	IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate"
-    fi
- 
-    # This process subtracts arg2 from arg1. If arg2 is larger
-    # then reverse the arguments. The calculations are done, and
-    # then the sign is reversed
-    if [ $1 -lt $2 ]
- 	then
- 	jul1=$2
- 	jul2=$1
-    elif [ $1 -gt $2 ]
-	then
- 	jul1=$1
- 	jul2=$2
-    else
-	echo 0
-	IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate"
-	return
-    fi
-
-    # Break the dates in to year and day portions
-    yyyy1=$(( $jul1 / 1000 ))
-    yyyy2=$(( $jul2 / 1000 ))
-    ddd1=$(( $jul1 % 1000 ))
-    ddd2=$(( $jul2 % 1000 ))
-
-    # Subtract days
-    res=$(( $ddd1 - $ddd2 ))
-
-    # Then add days in year until year2 matches year1
-
-    case ${config_UserChoices_CalendarType} in
-	360d|360_day) 
-	    res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;;
-	noleap|365_day)
-	    res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;;
-	all_leap|366_day)
-	    res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;;
-	leap|gregorian|standard)
-	    while [ $yyyy2 -lt $yyyy1 ]
-	    do
-		IGCM_date_DaysInYear $yyyy2 diy
-		res=$(( $res + $diy ))
-		yyyy2=$(( $yyyy2 + 1 ))
-	    done
-	    ;;
-    esac
-
-
-    # if argument 2 was larger than argument 1 then 
-    # the arguments were reversed before calculating
-    # adjust by reversing the sign
-    if [ $1 -lt $2 ]
- 	then
-	res=$(( $res * -1 ))
-    fi
- 
-    # and output the results
-    echo $res
-
+  IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@
+
+  # calculates the days difference between two dates and reports 
+  # the number days as jul1 - jul2 
+  # usage IGCM_date_DaysBetweenJulianDate jul1 jul2
+  # where julian date is in the form yyyyddd
+  
+  usage () {
+    echo "Usage:"
+    echo " IGCM_date_DaysBetweenJulianDate jul1 jul2"
+    echo ""
+    echo " Calculates the day difference between"
+    echo " two julian dates (jul1 -jul2)"
+    echo " where a julian date is in the form of yyyyddd."
+  }
+  
+  if [ $# -lt 2 ]; then
+    usage
+    IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate"
+  fi
+  
+  # This process subtracts arg2 from arg1. If arg2 is larger
+  # then reverse the arguments. The calculations are done, and
+  # then the sign is reversed
+  if [ $1 -lt $2 ]
+  then
+    jul1=$2
+    jul2=$1
+  elif [ $1 -gt $2 ]
+  then
+    jul1=$1
+    jul2=$2
+  else
+    echo 0
     IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate"
+    return
+  fi
+
+  # Break the dates in to year and day portions
+  yyyy1=$(( $jul1 / 1000 ))
+  yyyy2=$(( $jul2 / 1000 ))
+  ddd1=$(( $jul1 % 1000 ))
+  ddd2=$(( $jul2 % 1000 ))
+
+  # Subtract days
+  res=$(( $ddd1 - $ddd2 ))
+
+  # Then add days in year until year2 matches year1
+  case ${config_UserChoices_CalendarType} in
+  360d|360_day) 
+    res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res )) ;;
+  noleap|365_day)
+    res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res )) ;;
+  all_leap|366_day)
+    res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res )) ;;
+  leap|gregorian|standard)
+    while [ $yyyy2 -lt $yyyy1 ]
+    do
+      IGCM_date_DaysInYear $yyyy2 diy
+      res=$(( $res + $diy ))
+      yyyy2=$(( $yyyy2 + 1 ))
+    done
+    ;;
+  esac
+
+
+  # if argument 2 was larger than argument 1 then 
+  # the arguments were reversed before calculating
+  # adjust by reversing the sign
+  if [ $1 -lt $2 ]
+  then
+    res=$(( $res * -1 ))
+  fi
+
+  # and output the results
+  echo $res
+
+  IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate"
 }
 
@@ -678,42 +708,42 @@
 function IGCM_date_DaysBetweenGregorianDate
 {
-    IGCM_debug_PushStack "IGCM_date_DaysBetweenGregorianDate" $@
-
-    # calculates the days difference between two dates and reports 
-    # the number days as grg1 - grg2 
-    # usage IGCM_date_DaysBetweenGregorianDate grg1 grg2
-    # where gregorian date is in the form yyyymmdd
-
-    usage () {
- 	echo "Usage:"
- 	echo " IGCM_date_DaysBetweenGregorianDate grg1 grg2"
- 	echo ""
- 	echo " Calculate day difference between"
- 	echo " two gregorian dates (grg1 - grg2)"
- 	echo " where a gregorian date is in the form of yyyymmdd."
-    }
-
-    if [ $# -lt 2 ]; then
- 	usage
-	IGCM_debug_Exit "IGCM_date_DaysBetweenGregorianDate"
-    fi
-
-    # convert each date to julian
-    grg1=$1
-    grg2=$2
-
-    jul1=$( IGCM_date_ConvertGregorianDateToJulian $grg1 )
-    jul2=$( IGCM_date_ConvertGregorianDateToJulian $grg2 )
-
-    if [ $jul1 -ne $jul2 ]; then
+  IGCM_debug_PushStack "IGCM_date_DaysBetweenGregorianDate" $@
+
+  # calculates the days difference between two dates and reports 
+  # the number days as grg1 - grg2 
+  # usage IGCM_date_DaysBetweenGregorianDate grg1 grg2
+  # where gregorian date is in the form yyyymmdd
+
+  usage () {
+    echo "Usage:"
+    echo " IGCM_date_DaysBetweenGregorianDate grg1 grg2"
+    echo ""
+    echo " Calculate day difference between"
+    echo " two gregorian dates (grg1 - grg2)"
+    echo " where a gregorian date is in the form of yyyymmdd."
+  }
+
+  if [ $# -lt 2 ]; then
+    usage
+    IGCM_debug_Exit "IGCM_date_DaysBetweenGregorianDate"
+  fi
+
+  # convert each date to julian
+  grg1=$1
+  grg2=$2
+
+  jul1=$( IGCM_date_ConvertGregorianDateToJulian $grg1 )
+  jul2=$( IGCM_date_ConvertGregorianDateToJulian $grg2 )
+
+  if [ $jul1 -ne $jul2 ]; then
     # calculate the answer using IGCM_date_DaysBetweenJulianDate
-	res=$( IGCM_date_DaysBetweenJulianDate $jul1 $jul2 )
+    res=$( IGCM_date_DaysBetweenJulianDate $jul1 $jul2 )
     # and output the results
-	echo $res
-    else
-	echo 0
-    fi
-
-    IGCM_debug_PopStack "IGCM_date_DaysBetweenGregorianDate"
+    echo $res
+  else
+    echo 0
+  fi
+
+  IGCM_debug_PopStack "IGCM_date_DaysBetweenGregorianDate"
 }
 
@@ -726,71 +756,192 @@
 function IGCM_date_DaysSinceJC
 {
-    IGCM_debug_PushStack "IGCM_date_DaysSinceJC" $@
-
-    # calculates the days difference between a date and 00010101
-    # usage IGCM_date_DaysSinceJC grg1
-    # where gregorian date is in the form yyyymmdd
-
-    usage () {
- 	echo "Usage:"
- 	echo " IGCM_date_DaysSinceJC grg1"
- 	echo ""
- 	echo " Calculate day difference between"
- 	echo " a gregorian date and 00010101"
- 	echo " where a gregorian date is in the form of yyyymmdd."
-    }
-
-    if [ $# -lt 1 ]; then
- 	usage
-	IGCM_debug_Exit "IGCM_date_DaysSinceJC"
-    fi
-    
-    typeset aux num
-
-    if   [ ${1} -lt  5000000 ]; then
-	case ${config_UserChoices_CalendarType} in
-	    360d|360_day) 
-		aux=-360;;
-	    noleap|365_day)
-		aux=-365;;
-	    all_leap|366_day) 
-		aux=-366;;
-	    leap|gregorian|standard)
-		aux=-366;;
-	esac
-	num=101
-    elif [ ${1} -lt 15000000 ]; then
-        # To save CPU type we use auxiliary value
-        # which is number of days since JC and 10000101
-	case ${config_UserChoices_CalendarType} in
-	    360d|360_day) 
-		aux=359640;;
-	    noleap|365_day)
-		aux=364635;;
-	    all_leap|366_day) 
-		aux=365634;;
-	    leap|gregorian|standard)
-		aux=364877;;
-	esac
-	num=10000101
-    else
-        # To save CPU type we use auxiliary value
-        # which is number of days since JC and 19000101
-	case ${config_UserChoices_CalendarType} in
-	    360d|360_day) 
-		aux=683640;;
-	    noleap|365_day)
-		aux=693135;;
-	    all_leap|366_day) 
-		aux=695034;;
-	    leap|gregorian|standard)
-		aux=693595;;
-	esac
-	num=19000101
-    fi
-    echo $(( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) + $aux ))
-
-    IGCM_debug_PopStack "IGCM_date_DaysSinceJC"
-}
+  IGCM_debug_PushStack "IGCM_date_DaysSinceJC" $@
+
+  # calculates the days difference between a date and 00010101
+  # usage IGCM_date_DaysSinceJC grg1
+  # where gregorian date is in the form yyyymmdd
+
+  usage () {
+    echo "Usage:"
+    echo " IGCM_date_DaysSinceJC grg1"
+    echo ""
+    echo " Calculate day difference between"
+    echo " a gregorian date and 00010101"
+    echo " where a gregorian date is in the form of yyyymmdd."
+  }
+
+  if [ $# -lt 1 ]; then
+    usage
+    IGCM_debug_Exit "IGCM_date_DaysSinceJC"
+  fi
+  
+  typeset aux num
+
+  if   [ ${1} -lt  5000000 ]; then
+    case ${config_UserChoices_CalendarType} in
+    360d|360_day) 
+      aux=-360;;
+    noleap|365_day)
+      aux=-365;;
+    all_leap|366_day) 
+      aux=-366;;
+    leap|gregorian|standard)
+      aux=-366;;
+    esac
+    num=101
+  elif [ ${1} -lt 15000000 ]; then
+    # To save CPU type we use auxiliary value
+    # which is number of days since JC and 10000101
+    case ${config_UserChoices_CalendarType} in
+    360d|360_day) 
+      aux=359640;;
+    noleap|365_day)
+      aux=364635;;
+    all_leap|366_day) 
+      aux=365634;;
+    leap|gregorian|standard)
+      aux=364877;;
+    esac
+    num=10000101
+  else
+    # To save CPU type we use auxiliary value
+    # which is number of days since JC and 19000101
+    case ${config_UserChoices_CalendarType} in
+    360d|360_day) 
+      aux=683640;;
+    noleap|365_day)
+      aux=693135;;
+    all_leap|366_day) 
+      aux=695034;;
+    leap|gregorian|standard)
+      aux=693595;;
+    esac
+    num=19000101
+  fi
+  echo $(( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) + $aux ))
+
+  IGCM_debug_PopStack "IGCM_date_DaysSinceJC"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysInPreviousPeriod ()
+#D-* Purpose: Give the numbers of days during the previous prd1 period from grg1 date # OLD create_ts_begin_date
+#D-* Usage: IGCM_date_DaysInPreviousPeriod grg1 prd1 [end]
+#D-         where grg1 gregorian date is in the form yyyymmdd
+#D-         where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer
+#D-         where [end] is an optionnal keyword to specify grg1 is the end of prd1
+#D-
+function IGCM_date_DaysInPreviousPeriod {
+  IGCM_debug_PushStack "IGCM_date_DaysInPreviousPeriod" $@
+  typeset Length Period
+  Period=${2}
+  case ${Period} in
+  *Y|*y)
+    PeriodLengthInYears=$( echo ${Period} | awk -F '[yY]' '{print $1}' )
+    IGCM_date_GetYearMonth ${1} year month
+    year=$( IGCM_date_SupressZeros ${year} )
+    if [ X${2} = Xend ] ; then
+      (( year = year - PeriodLengthInYears + 1))
+    fi
+    (( Length=0 ))
+    (( i=0 ))
+    until [ $i -ge $PeriodLengthInYears ] ; do
+      (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
+      (( i=i+1 ))
+    done
+    ;;
+  *M|*m)
+    PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' )
+    IGCM_date_GetYearMonth ${1} year month
+    year=$( IGCM_date_SupressZeros ${year} )
+    if [ X${2} = Xend ] ; then
+      (( month = month - PeriodLengthInMonths + 1 ))
+    fi	    
+    (( year0 = year ))
+    if [ $month -le 0 ] ; then
+      (( month = month + 12 ))
+      year=$( printf "%04i\n" $(( year - 1 )) )
+    fi
+    month=$( printf "%02i\n" ${month} )
+    (( Length=0 ))
+    (( i=0 ))
+    until [ $i -ge $PeriodLengthInMonths ] ; do
+      if [ $(( month + i )) -lt 13 ] ; then
+	(( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))
+      else
+	(( year = year0 + 1 ))
+	(( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))
+      fi
+      (( i=i+1 ))
+    done
+    ;;
+  *D|*d)
+    Length=$( echo ${Period} | sed -e "s/[dD]//" ) ;;
+  *)
+    IGCM_debug_Exit "IGCM_date_DaysInPreviousPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D."
+    IGCM_debug_Verif_Exit_Post ;;
+  esac
+  echo ${Length}
+
+  IGCM_debug_PopStack "IGCM_date_DaysInPreviousPeriod"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysInNextPeriod ()
+#D-* Purpose: Give the numbers of days during the next prd1 period from grg1 date # OLD create_ts_next_date
+#D-* Usage: IGCM_date_DaysInNextPeriod grg1 prd1
+#D-         where grg1 gregorian date is in the form yyyymmdd
+#D-         where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer
+#D-
+function IGCM_date_DaysInNextPeriod {
+  IGCM_debug_PushStack "IGCM_date_DaysInNextPeriod" $@
+  typeset Length Period
+  Period=${2}
+  case ${Period} in
+  *Y|*y) 
+    PeriodLengthInYears=$( echo ${Period} | awk -F '[yY]' '{print $1}' )
+    IGCM_date_GetYearMonth ${1} year month
+    year=$( IGCM_date_SupressZeros ${year} )
+    (( Length=0 ))
+    (( i=0 ))
+    until [ $i -ge $PeriodLengthInYears ] ; do
+      (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) 
+      (( i=i+1 ))
+    done
+    ;;
+  *M|*m) 
+    PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' )
+    IGCM_date_GetYearMonth ${1} year month
+    year=$( IGCM_date_SupressZeros ${year} )
+    (( year0 = year ))
+    if [ $(( month + 1 )) -lt 13 ] ; then
+      month0=$(( month + 1 ))
+    else
+      month0=$(( month + 1 - 12 ))
+      (( year = year0 + 1 ))
+    fi
+    (( Length=0 ))
+    (( i=0 ))
+    until [ $i -ge $PeriodLengthInMonths ] ; do
+      if [ $(( month0 + i )) -lt 13 ] ; then
+	(( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))
+      else
+	(( year = year0 + 1 ))
+	(( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))
+      fi
+      (( i=i+1 ))
+    done
+    ;;
+  *D|*d)
+    Length=$( echo ${Period} | sed -e "s/[dD]//" ) ;;
+  *)
+    IGCM_debug_Exit "IGCM_date_DaysInNextPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D."
+    IGCM_debug_Verif_Exit_Post ;;
+  esac
+  echo ${Length}
+
+  IGCM_debug_PopStack "IGCM_date_DaysInNextPeriod"
+}
+
 
 #D-#==================================================================
@@ -799,39 +950,39 @@
 function IGCM_date_Check
 {
-    IGCM_debug_PushStack "IGCM_date_Check"
+  IGCM_debug_PushStack "IGCM_date_Check"
 
 #---------------------
-    if [ ! -n "${libIGCM}" ] ; then
-	echo "Check libIGCM_date ...........................................[ FAILED ]"
-        echo "--Error--> libIGCM variable is not defined"
-	IGCM_debug_Exit "IGCM_date_Check"
-    fi
+  if [ ! -n "${libIGCM}" ] ; then
+    echo "Check libIGCM_date ...........................................[ FAILED ]"
+    echo "--Error--> libIGCM variable is not defined"
+    IGCM_debug_Exit "IGCM_date_Check"
+  fi
 
 #---------------------
-    whence -v gawk > /dev/null 2>&1
-    if [ ! $? -eq 0 ] ; then
-	echo "Check libIGCM_date ...........................................[ FAILED ]"
-        echo "--Error--> gawk command is not defined"
-	IGCM_debug_Exit "IGCM_date_Check"
-    fi
+  whence -v gawk > /dev/null 2>&1
+  if [ ! $? -eq 0 ] ; then
+    echo "Check libIGCM_date ...........................................[ FAILED ]"
+    echo "--Error--> gawk command is not defined"
+    IGCM_debug_Exit "IGCM_date_Check"
+  fi
 
 #---------------------
-    ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh > IGCM_date_Test.ref.failed 2>&1
-    
-    if diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref > /dev/null 2>&1 ; then 
-	echo "Check libIGCM_date ...............................................[ OK ]"
-	rm -f IGCM_date_Test.ref.failed
-    else 
-	echo "Check libIGCM_date ...........................................[ FAILED ]"
-        echo "--Error--> Execution of ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh"
-        echo "           has produced the file IGCM_date_Test.ref.failed"
-        echo "           Please analyse differences with the reference file by typing:"
-        echo "           diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref"
-	echo "           Report errors to the author: Sebastien.Denvil@ipsl.jussieu.fr"
-	IGCM_debug_Exit "IGCM_date_Check"
-    fi
+  ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh > IGCM_date_Test.ref.failed 2>&1
+  
+  if diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref > /dev/null 2>&1 ; then 
+    echo "Check libIGCM_date ...............................................[ OK ]"
+    rm -f IGCM_date_Test.ref.failed
+  else 
+    echo "Check libIGCM_date ...........................................[ FAILED ]"
+    echo "--Error--> Execution of ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh"
+    echo "           has produced the file IGCM_date_Test.ref.failed"
+    echo "           Please analyse differences with the reference file by typing:"
+    echo "           diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref"
+    echo "           Report errors to the author: Sebastien.Denvil@ipsl.jussieu.fr"
+    IGCM_debug_Exit "IGCM_date_Check"
+  fi
 
 #---------------------
-    IGCM_debug_PopStack "IGCM_date_Check"
+  IGCM_debug_PopStack "IGCM_date_Check"
 }
 
Index: branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_debug/libIGCM_debug.ksh	(revision 571)
@@ -28,10 +28,10 @@
 
 if ( $DEBUG_debug ) ; then
-    if [ -f stack ] ;
-    then
-	echo "Stack of an libIGCM job :" >> stack
-    else
-	echo "Stack of an libIGCM job :" >  stack
-    fi
+  if [ -f stack ] ;
+  then
+    echo "Stack of an libIGCM job :" >> stack
+  else
+    echo "Stack of an libIGCM job :" >  stack
+  fi
 fi
 
@@ -68,26 +68,26 @@
 #D-
 function IGCM_debug_CallStack {
-    echo
-    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    echo "!! IGCM_debug_CallStack !!"
+  echo
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  echo "!! IGCM_debug_CallStack !!"
+  echo "!------------------------!"
+  echo
+  if ( $DEBUG_debug ) ; then
+    # La pile d'appels est affichée de la plus vieille à la plus récente 
+    # (c'est donc l'inverse de la norme d'affichage).
+    typeset i decal
+    (( i=0 ))
+    until [ $i -eq ${IGCM_debug_LenStack} ]; do
+      decal=0
+      until [ $decal -eq ${i} ]; do
+	printf -- ' '
+	let $(( decal=decal+1 ))
+      done
+      echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
+		"(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
+      let $((i=i+1))
+    done
     echo "!------------------------!"
-    echo
-    if ( $DEBUG_debug ) ; then
-       # La pile d'appels est affichée de la plus vieille à la plus récente 
-       # (c'est donc l'inverse de la norme d'affichage).
-	typeset i decal
-	(( i=0 ))
-	until [ $i -eq ${IGCM_debug_LenStack} ]; do
-	    decal=0
-	    until [ $decal -eq ${i} ]; do
-		printf -- ' '
-		let $(( decal=decal+1 ))
-	    done
-	    echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
-		"(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
-	    let $((i=i+1))
-	done
-	echo "!------------------------!"
-    fi
+  fi
 }
 
@@ -97,30 +97,30 @@
 #D-
 function IGCM_debug_PushStack {
-    if ( $DEBUG_debug ) ; then
-       typeset decal
-       echo >> stack
-       decal=0
-       while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+  if ( $DEBUG_debug ) ; then
+    typeset decal
+    echo >> stack
+    decal=0
+    while [ $decal -lt ${IGCM_debug_LenStack} ]; do
 #          printf -- ' ' >> stack
-           printf ' ' >> stack
-           let $(( decal=decal+1 ))
-       done
-       echo "> ${IGCM_debug_LenStack} : ${@}" >> stack
-
-       # We add function call name on beginning of the stack
-       set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]}
-
-       # We include the "null" Args in the beginning of the StackArgs
-       set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
-       # Then, we shift StackArgs tabular
-       if [ $# -gt 1 ]; then 
-	   shift; 
-	   IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2
-       fi
-       (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
-
-       # If you want to print CallStack each time :
-       # IGCM_debug_CallStack
-    fi
+      printf ' ' >> stack
+      let $(( decal=decal+1 ))
+    done
+    echo "> ${IGCM_debug_LenStack} : ${@}" >> stack
+
+    # We add function call name on beginning of the stack
+    set +A IGCM_debug_Stack -- ${1} ${IGCM_debug_Stack[*]}
+
+    # We include the "null" Args in the beginning of the StackArgs
+    set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
+    # Then, we shift StackArgs tabular
+    if [ $# -gt 1 ]; then 
+      shift; 
+      IGCM_debug_StackArgs[0]=$(echo ${@} | sed -e "s/\ /,/g") >&2
+    fi
+    (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
+
+    # If you want to print CallStack each time :
+    # IGCM_debug_CallStack
+  fi
 }
 
@@ -130,50 +130,49 @@
 #D-
 function IGCM_debug_PopStack {
-    if ( $DEBUG_debug ) ; then
-	if ( ${ExitFlag} ) ; then
-	    echo '!!! ExitFlag has been activated !!!' >> stack
-	fi
-	if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
-	    let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
-
-	    IGCM_debug_Stack[0]="" 
-	    IGCM_debug_StackArgs[0]=""
-	    
-	    set +A tmpStack -- ${IGCM_debug_Stack[*]}
-	    unset IGCM_debug_Stack
-	    set +A IGCM_debug_Stack -- ${tmpStack[*]} 
-
-	    set +A tmpStack -- ${IGCM_debug_StackArgs[*]}
-	    unset IGCM_debug_StackArgs
-	    set +A IGCM_debug_StackArgs -- ${tmpStack[*]}
-	    unset tmpStack
-	else
-	    echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
-	    IGCM_debug_Exit $@
-	fi
-	typeset decal=0
-	while [ $decal -lt ${IGCM_debug_LenStack} ]; do
-	  # printf -- ' ' >> stack
-	  printf ' ' >> stack
- 	  (( decal=decal+1 ))
-	done
-      echo "< ${IGCM_debug_LenStack} : ${@}" >> stack
-
-      if [ ${IGCM_debug_LenStack} = 0 ]; then
-	  # Reset array only when necessary
-	  #echo
-	  #IGCM_debug_Print 3 "Clean stack array"
-	  #echo
-	  #set -A IGCM_debug_Stack ${NULL_STR}
-	  #set -A IGCM_debug_StackArgs ${NULL_STR}
-	  unset IGCM_debug_Stack
-	  unset IGCM_debug_StackArgs
-	  IGCM_debug_Stack[0]=${NULL_STR}
-          IGCM_debug_StackArgs[0]=${NULL_STR}
-      fi
-
-    fi
-
-    #IGCM_debug_CallStack
+  if ( $DEBUG_debug ) ; then
+    if ( ${ExitFlag} ) ; then
+      echo '!!! ExitFlag has been activated !!!' >> stack
+    fi
+    if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
+      let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
+
+      IGCM_debug_Stack[0]="" 
+      IGCM_debug_StackArgs[0]=""
+      
+      set +A tmpStack -- ${IGCM_debug_Stack[*]}
+      unset IGCM_debug_Stack
+      set +A IGCM_debug_Stack -- ${tmpStack[*]} 
+
+      set +A tmpStack -- ${IGCM_debug_StackArgs[*]}
+      unset IGCM_debug_StackArgs
+      set +A IGCM_debug_StackArgs -- ${tmpStack[*]}
+      unset tmpStack
+    else
+      echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
+      IGCM_debug_Exit $@
+    fi
+    typeset decal=0
+    while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+      # printf -- ' ' >> stack
+      printf ' ' >> stack
+      (( decal=decal+1 ))
+    done
+    echo "< ${IGCM_debug_LenStack} : ${@}" >> stack
+
+    if [ ${IGCM_debug_LenStack} = 0 ]; then
+      # Reset array only when necessary
+      #echo
+      #IGCM_debug_Print 3 "Clean stack array"
+      #echo
+      #set -A IGCM_debug_Stack ${NULL_STR}
+      #set -A IGCM_debug_StackArgs ${NULL_STR}
+      unset IGCM_debug_Stack
+      unset IGCM_debug_StackArgs
+      IGCM_debug_Stack[0]=${NULL_STR}
+      IGCM_debug_StackArgs[0]=${NULL_STR}
+    fi
+
+  fi
+  #IGCM_debug_CallStack
 }
 
@@ -183,9 +182,9 @@
 #D-
 function IGCM_debug_Exit {
-    IGCM_debug_PushStack "IGCM_debug_Exit"
-    echo "IGCM_debug_Exit : " "${@}"
-    IGCM_debug_CallStack
-    ExitFlag=true
-    IGCM_debug_PopStack "IGCM_debug_Exit"
+  IGCM_debug_PushStack "IGCM_debug_Exit"
+  echo "IGCM_debug_Exit : " "${@}"
+  IGCM_debug_CallStack
+  ExitFlag=true
+  IGCM_debug_PopStack "IGCM_debug_Exit"
 }
 
@@ -195,22 +194,22 @@
 #D-
 function IGCM_debug_Verif_Exit {
-    if ( ${ExitFlag} ) ; then
-	# Plan to send an email here with IGCM_sys_SendMail
-	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal"
-	echo "IGCM_debug_Verif_Exit : Something wrong append."
-	echo "                        EXIT THE JOB."
-	echo
-	if ( $DEBUG_debug ) ; then
-	    IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
-	    echo "Your files on ${R_OUT} :"
-	    IGCM_sys_Tree ${R_SAVE}
-	    echo
-	fi
-	# Mail notification
-	IGCM_sys_SendMail
-	# And Good Bye
-	date
-	exit 1
-    fi
+  if ( ${ExitFlag} ) ; then
+    # Plan to send an email here with IGCM_sys_SendMail
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal"
+    echo "IGCM_debug_Verif_Exit : Something wrong append."
+    echo "                        EXIT THE JOB."
+    echo
+    if ( $DEBUG_debug ) ; then
+      IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+      echo "Your files on ${R_OUT} :"
+      IGCM_sys_Tree ${R_SAVE}
+      echo
+    fi
+    # Mail notification
+    IGCM_sys_SendMail
+    # And Good Bye
+    date
+    exit 1
+  fi
 }
 
@@ -220,28 +219,28 @@
 #D-
 function IGCM_debug_Verif_Exit_Post {
-    if ( ${ExitFlag} ) ; then
-	echo "IGCM_debug_Verif_Exit_Post : Something wrong append."
-	# If SpaceName is PROD then we stop if post_processing fails
-	# Plan to send an email here with IGCM_sys_SendMail
-	if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then
-	    echo "                        EXIT THE JOB."
-	    echo
-	    if ( $DEBUG_debug ) ; then
-		IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
-		echo
-	    fi
-	    # Mail notification
-	    #IGCM_sys_SendMailPost
-	    # And Good Bye
-	    date
-	    exit 1
-	else
-	    echo "Either inside config.card the variable SpaceName is not in PROD"
-	    echo "or insinde the main Job the variable JobType is not in RUN mode"
-	    echo "              SO WE DO NOT EXIT THE JOB."
-	    echo
-	    date
-	fi
-    fi
+  if ( ${ExitFlag} ) ; then
+    echo "IGCM_debug_Verif_Exit_Post : Something wrong append."
+    # If SpaceName is PROD then we stop if post_processing fails
+    # Plan to send an email here with IGCM_sys_SendMail
+    if ( [ X${config_UserChoices_SpaceName} = XPROD ] && [ X${JobType} = XRUN ] ) ; then
+      echo "                        EXIT THE JOB."
+      echo
+      if ( $DEBUG_debug ) ; then
+	IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+	echo
+      fi
+      # Mail notification
+      #IGCM_sys_SendMailPost
+      # And Good Bye
+      date
+      exit 1
+    else
+      echo "Either inside config.card the variable SpaceName is not in PROD"
+      echo "or insinde the main Job the variable JobType is not in RUN mode"
+      echo "              SO WE DO NOT EXIT THE JOB."
+      echo
+      date
+    fi
+  fi
 }
 
@@ -252,28 +251,28 @@
 function IGCM_debug_Print
 {
-    typeset level=$1
+  typeset level=$1
+  shift
+
+  if [ X"${1}" = X"-e" ]; then
+    typeset cmd_echo="echo -e"
     shift
-
-    if [ X"${1}" = X"-e" ]; then
-	typeset cmd_echo="echo -e"
-	shift
-    else
-	typeset cmd_echo="echo"
-    fi
-
-    if [ ${level} -le ${Verbosity} ] ; then
-	typeset i
-	case "${level}" in
-	    1) for i in "$@" ; do
-		    ${cmd_echo} "--Debug1-->" ${i}
-	      done ;; 
-	    2) for i in "$@" ; do
-		    ${cmd_echo} "--------Debug2-->" ${i}
-	      done ;; 
-	    3) for i in "$@" ; do
-		    ${cmd_echo} "--------------Debug3-->" ${i}
-	      done ;; 
-	esac
-    fi
+  else
+    typeset cmd_echo="echo"
+  fi
+
+  if [ ${level} -le ${Verbosity} ] ; then
+    typeset i
+    case "${level}" in
+    1) for i in "$@" ; do
+      ${cmd_echo} "--Debug1-->" ${i}
+      done ;; 
+    2) for i in "$@" ; do
+      ${cmd_echo} "--------Debug2-->" ${i}
+      done ;; 
+    3) for i in "$@" ; do
+      ${cmd_echo} "--------------Debug3-->" ${i}
+      done ;; 
+    esac
+  fi
 }
 
@@ -284,12 +283,12 @@
 function IGCM_debug_PrintVariables
 {
-    typeset level=$1
-    shift
-
-    list=$( set | grep $1 | sed -e "s/'//g" )
-
-    if [ "X${list}" != X ]  ; then
-        IGCM_debug_Print ${level} ${list}
-    fi
+  typeset level=$1
+  shift
+
+  list=$( set | grep $1 | sed -e "s/'//g" )
+
+  if [ "X${list}" != X ]  ; then
+    IGCM_debug_Print ${level} ${list}
+  fi
 }
 
@@ -299,34 +298,34 @@
 function IGCM_debug_Check
 {
-    #---------------------
-    if [ ! -n "${libIGCM}" ] ; then
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> libIGCM variable is not defined"
-        exit 2
-    fi
-
-    #---------------------
-    if [ ! -n "${Verbosity}" ] ; then
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> Verbosity variable is not defined"
-        exit 3
-    fi
-
-    #---------------------
-    ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1
-    sleep 2
-
-    if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then
-        echo "Check libIGCM_debug ..............................................[ OK ]"
-        rm -f IGCM_debug_Test.ref.failed
-    else
-        echo "Check libIGCM_debug ..........................................[ FAILED ]"
-        echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh"
-        echo "           has produced the file IGCM_debug_Test.ref.failed"
-        echo "           Please analyse differences with the reference file by typing:"
-	echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref"
-	echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
-        exit 4
-    fi
-    #---------------------
-}
+  #---------------------
+  if [ ! -n "${libIGCM}" ] ; then
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> libIGCM variable is not defined"
+    exit 2
+  fi
+
+  #---------------------
+  if [ ! -n "${Verbosity}" ] ; then
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> Verbosity variable is not defined"
+    exit 3
+  fi
+
+  #---------------------
+  ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1
+  sleep 2
+
+  if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then
+    echo "Check libIGCM_debug ..............................................[ OK ]"
+    rm -f IGCM_debug_Test.ref.failed
+  else
+    echo "Check libIGCM_debug ..........................................[ FAILED ]"
+    echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh"
+    echo "           has produced the file IGCM_debug_Test.ref.failed"
+    echo "           Please analyse differences with the reference file by typing:"
+    echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref"
+    echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
+    exit 4
+  fi
+  #---------------------
+}
Index: branches/libIGCM_MPI_OpenMP/libIGCM_post/check_expe_files_size.sh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_post/check_expe_files_size.sh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_post/check_expe_files_size.sh	(revision 571)
@@ -125,5 +125,5 @@
 # On deduit de la liste des fichiers des patterns de annee+mois, annee, intervalles de date ...
 sed -r \
-    -e 's/[0-2][0-9]{3}[01][0-9]/YYMM/g' \
+    -e 's/[0-5][0-9]{3}[01][0-9]/YYMM/g' \
     -e 's/YYMM01_YYMM(28|29|30|31)/YYmmdd_YYmmdd/g' \
                                            /tmp/$$.ldir | sort -u > /tmp/$$.lpat
@@ -146,5 +146,5 @@
         # On transforme le pattern pour mettre une sequences  
         # de capture des annees de debut et fin d'intervalle
-        p2=$(echo $pattern | sed -e 's/YYmmdd_YYmmdd/([0-2][0-9]{3}[01][0-9])01_[0-2][0-9]{3}[01][0-9](28|29|30|31)/g' )
+        p2=$(echo $pattern | sed -e 's/YYmmdd_YYmmdd/([0-5][0-9]{3}[01][0-9])01_[0-5][0-9]{3}[01][0-9](28|29|30|31)/g' )
 
        # On balaye le repertoire avec le(s) pattern(s) transforme(s) pour capturer les annees
@@ -162,5 +162,5 @@
     awk '{
         if (NR==1) {avant=$1; print $1}
-        else { for (i=avant+1 ; i<=$1 ; i++) print i}}'
+        else { for (i=avant+1 ; i<=$1 ; i++) printf "%04i\n", i}}'
 }
 sort -u /tmp/$$.dates > /tmp/$$.toutes_dates
@@ -227,5 +227,5 @@
            # On transforme le pattern pour mettre une sequences  
            # avec le mois courant
-           px=$(echo $pattern | sed -e "s/YYmmdd_YYmmdd/([0-2][0-9]{3})${mois}01_[0-2][0-9]{3}${mois}(28|29|30|31)/g" )
+           px=$(echo $pattern | sed -e "s/YYmmdd_YYmmdd/([0-5][0-9]{3})${mois}01_[0-5][0-9]{3}${mois}(28|29|30|31)/g" )
 
            # On balaye le repertoire avec le(s) pattern(s) transforme(s) pour capturer les tailles des fichiers de ce mois
Index: branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh	(revision 571)
@@ -16,171 +16,176 @@
 function IGCM_post_Configure
 {
-    IGCM_debug_PushStack "IGCM_post_Configure"
-
-    # Debug Print :
-    echo
-    IGCM_debug_Print 1 "IGCM_post_Configure"
-    #
-    # Initialize
-    #
-    POST=false
-    RebuildFrequency=false
-    TimeSeriesFrequency=false
-    SeasonalFrequency=false
-    #
-    # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS
-    #
-    if [ X${AsynchronousRebuild} = Xtrue ] ; then
-	list_post="RebuildFrequency"
+  IGCM_debug_PushStack "IGCM_post_Configure"
+
+  # Debug Print :
+  echo
+  IGCM_debug_Print 1 "IGCM_post_Configure"
+  #
+  # Initialize
+  #
+  POST=false
+  RebuildFrequency=false
+  PackFrequency=false
+  TimeSeriesFrequency=false
+  SeasonalFrequency=false
+  unset list_post
+  #
+  # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS
+  #
+  if [ X${AsynchronousRebuild} = Xtrue ] ; then
+    list_post="RebuildFrequency"
+  fi
+  #
+  if [ X${Pack} = Xtrue ] ; then
+    list_post="${list_post} PackFrequency"
+  fi
+  #
+  if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then
+    list_post="${list_post} TimeSeriesFrequency"
+  fi
+  #
+  if [ X${Seasonal} = Xtrue ] ; then
+    list_post="${list_post} SeasonalFrequency"
+  fi
+
+  # Overrule special cases
+  if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
+    [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]           && \
+    [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
+    TimeSeriesFrequency=true
+    POST=true
+  fi
+  #
+  if ( [ X${AsynchronousRebuild} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
+    RebuildFrequency=true
+    POST=true
+  fi
+
+  # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY
+  # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO
+  for post_freq in ${list_post} ; do
+    # Extract frequency from previously defined variable
+    config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
+    # Offset for Seasonal Average starting period
+    if [ ${post_freq} = SeasonalFrequency ] ; then
+      if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
+	PeriodOffset=0
+      else
+	PeriodOffset=${config_Post_SeasonalFrequencyOffset}
+      fi
+    else
+      PeriodOffset=0
     fi
-    #
-    if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then
-	list_post="${list_post} TimeSeriesFrequency"
+    # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\)
+    # RebuildFrequency needs additionnal information
+    if [ ${post_freq} = RebuildFrequency ] ; then
+      IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir
+    else
+      IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength
     fi
     #
-    if [ X${Seasonal} = Xtrue ] ; then
-	list_post="${list_post} SeasonalFrequency"
-    fi
-
-    # Overrule special cases
-    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
-	 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
-	 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
-	TimeSeriesFrequency=true
-	POST=true
-    fi
-    #
-    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
-	 [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
-	 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
-	RebuildFrequency=true
-	POST=true
-    fi
-
-    # READ REBUILD OR TIME SERIES OR SEASONAL FREQUENCY
-    # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO
-    for post_freq in ${list_post} ; do
-        # Extract frequency from previously defined variable
-        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
-	# Offset for Seasonal Average starting period
-	if [ ${post_freq} = SeasonalFrequency ] ; then
-	    if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
-		PeriodOffset=0
-	    else
-		PeriodOffset=${config_Post_SeasonalFrequencyOffset}
-	    fi
-	else
-	    PeriodOffset=0
-	fi
-        # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\)
-	# RebuildFrequency needs additionnal information
-	if [ ${post_freq} = RebuildFrequency ] ; then
-	    IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbRebuildDir
-	else
-	    IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength
-	fi
-	#
-	IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}"
-    done
-    #
-    IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}"
-    #
-    IGCM_debug_PopStack "IGCM_post_Configure"
+    IGCM_debug_Print 1 "${post_freq} flag value : ${RebuildFrequency}"
+  done
+  #
+  IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}"
+  #
+  IGCM_debug_PopStack "IGCM_post_Configure"
 }
 
 function IGCM_post_Submit
 {
-    IGCM_debug_PushStack "IGCM_post_Submit"
-
-    typeset listVarEnv
-
-    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-
-    if [ ${POST} = true ]; then
+  IGCM_debug_PushStack "IGCM_post_Submit"
+
+  typeset listVarEnv DaysTemp
+
+  #POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  POST_DIR=${R_BUF_KSH}
+  # trick for IDRIS
+  POST_DIR=$( echo ${R_BUF_KSH} | sed -e "s/workgpfs/workdir/" )
+
+  if [ ${POST} = true ]; then
+    echo
+    IGCM_debug_Print 1 "IGCM_post_Submit"
+    echo
+    IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}"
+  fi
+
+  #============ TIME SERIES POST-PROCESSING ===========#
+  if [ ${TimeSeriesFrequency} = true ] ; then
+
+    IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED"
+    echo
+
+
+
+    # Get information from last execution
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted
+    CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
+    #
+
+
+
+    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
+    #
+    jLoop=${#ListDimension[*]}
+    j=0
+    until [ $j -ge ${jLoop} ]; do
+      Dimension=${ListDimension[${j}]}
+      #
+      if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then
+	#
+	IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED"
 	echo
-	IGCM_debug_Print 1 "IGCM_post_Submit"
-	echo
-	IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}"
-    fi
-
-    #============ TIME SERIES POST-TREATMENT ===========#
-    if [ ${TimeSeriesFrequency} = true ] ; then
-
-        IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ACTIVATED"
-        echo
-
-
-
-	# Get information from last execution
-	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted
-	CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
         #
-
-
-
-        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
+	if [ X${Dimension} = X ] ; then
+	  TsTask="empty"
+	  Script_Post_Output=create_ts.${PeriodDateEnd}
+	else
+	  TsTask=${Dimension}
+	  Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
+	fi
 	#
-	jLoop=${#ListDimension[*]}
-	j=0
-	until [ $j -ge ${jLoop} ]; do
-	    Dimension=${ListDimension[${j}]}
-	    #
-	    if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then
-		#
-		IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED"
-		echo
-                #
-		if [ X${Dimension} = X ] ; then
-		    TsTask="empty"
-		    Script_Post_Output=create_ts.${PeriodDateEnd}
-		else
-		    TsTask=${Dimension}
-		    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
-		fi
-	        #
-		if [ ${RebuildFrequency} = true ] ; then
-	            #
-		    if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-			if [ X${MASTER} = Xtitane ] ; then
-			    echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-			echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export DateBegin=${DateBegin}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export CompletedFlag=${CompletedFlag}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export TsTask=${TsTask}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "unset  CompToRead                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "unset  FlagToRead                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			if [ X${MASTER} = Xtitane ] ; then
-			    echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-			echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			echo "IGCM_sys_QsubPost create_ts                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			if [ X${MASTER} = Xtitane ] ; then
-			    echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			fi
-		    fi
-	            #
-		else
-	            #
-		    IGCM_sys_RshPost <<-EOF
+	if [ ${RebuildFrequency} = true ] ; then
+	  #
+	  if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+#	    if [ X${MASTER} = Xtitane ] ; then
+#	      echo "IGCM_sys_RshPost <<-EOF"                       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	    fi
+	    echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export DateBegin=${DateBegin}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export CompletedFlag=${CompletedFlag}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export TsTask=${TsTask}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "unset  CompToRead                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "unset  FlagToRead                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	    if [ X${MASTER} = Xtitane ] ; then
+#	      echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	    fi
+	    echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "IGCM_sys_QsubPost create_ts                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	    if [ X${MASTER} = Xtitane ] ; then
+#	      echo "EOF"                                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	    fi
+	  fi
+	else
+	  IGCM_sys_RshPost <<-EOF
                     export DEBUG_debug=${DEBUG_debug}
                     export MODIPSL=${MODIPSL}
@@ -212,85 +217,83 @@
                     IGCM_sys_QsubPost create_ts
 EOF
-		fi
+	fi
+      fi
+      #
+      if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then
+	#
+	IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED"
+	echo
+	# Need to Remember This One
+	SavedDateBegin=${DateBegin}
+	# Kind of task create_ts will perform
+	TsTask=Chunck${Dimension}
+	# Number of chunck jobs to configure and submit
+	eval NbJob=\${#CHUNCK${Dimension}_COMP[@]}
+	typeset i
+	i=0
+	until [ $i -ge $NbJob ]; do
+	  CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} )
+	  FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} )
+	  NameToRead=$( eval echo \${CHUNCK${Dimension}_NAME[\${i}]} )
+	  ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} )
+	  # Chunck Length (mandatory in Year)
+	  YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" )
+	  #
+	  IGCM_date_GetYearMonth ${DateBegin}     YearBegin MonthBegin
+	  #
+	  IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd   MonthEnd
+	  # How many chunck in total since simulation began
+	  NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} ))
+	  #  Tweak special case
+	  [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 ))
+	  # Starting Year of the current chunck
+	  ChunckTsYearBegin=$(( ${NbYearsChunckLoop} *  ${YearsChunckLength} + ${YearBegin} ))
+	  # Starting date of the current chunck
+	  ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01
+	  #
+	  Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead}
+	  #
+	  if [ ${RebuildFrequency} = true ] ; then
+	    #
+	    if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+#	      if [ X${MASTER} = Xtitane ] ; then
+#		echo "IGCM_sys_RshPost <<-EOF"                       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      fi
+	      echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export DateBegin=${ChunckTsDateBegin}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export CompletedFlag=${CompletedFlag}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export TsTask=${TsTask}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export CompToRead=${CompToRead}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export FlagToRead=${FlagToRead}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      if [ X${MASTER} = Xtitane ] ; then
+#		echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#		echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      fi
+	      echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_sys_QsubPost create_ts                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      if [ X${MASTER} = Xtitane ] ; then
+#		echo "EOF"                                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      fi
 	    fi
-	    #
-	    if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then
-		#
-		IGCM_debug_Print 1 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED"
-		echo
-		# Need to Remember This One
-		SavedDateBegin=${DateBegin}
-		# Kind of task create_ts will perform
-		TsTask=Chunck${Dimension}
-	        # Number of chunck jobs to configure and submit
-		eval NbJob=\${#CHUNCK${Dimension}_COMP[@]}
-		typeset i
-		i=0
-		until [ $i -ge $NbJob ]; do
-		    CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} )
-		    FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} )
-		    NameToRead=$( eval echo \${CHUNCK${Dimension}_NAME[\${i}]} )
-		    ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} )
-		    # Chunck Length (mandatory in Year)
-		    YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" )
-		    #
-		    IGCM_date_GetYearMonth ${DateBegin}     YearBegin MonthBegin
-		    #
-		    IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd   MonthEnd
-		    # How many chunck in total since simulation began
-		    NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} ))
-		    #  Tweak special case
-		    [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 ))
-		    # Starting Year of the current chunck
-		    ChunckTsYearBegin=$(( ${NbYearsChunckLoop} *  ${YearsChunckLength} + ${YearBegin} ))
-		    # Starting date of the current chunck
-		    ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01
-		    #
-		    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead}
-		    #
-		    if [ ${RebuildFrequency} = true ] ; then
-	                #
-			if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-			    if [ X${MASTER} = Xtitane ] ; then
-				echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    fi
-			    echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export DateBegin=${ChunckTsDateBegin}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export CompletedFlag=${CompletedFlag}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export TsTask=${TsTask}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export CompToRead=${CompToRead}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export FlagToRead=${FlagToRead}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    if [ X${MASTER} = Xtitane ] ; then
-				echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-				echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    fi
-			    echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    echo "IGCM_sys_QsubPost create_ts                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    if [ X${MASTER} = Xtitane ] ; then
-				echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-			    fi
-			fi
-	                #
-		    else
-	                #
-			IGCM_sys_RshPost <<-EOF
+	  else
+	    IGCM_sys_RshPost <<-EOF
                         export DEBUG_debug=${DEBUG_debug}
                         export MODIPSL=${MODIPSL}
@@ -322,68 +325,66 @@
                         IGCM_sys_QsubPost create_ts
 EOF
-	                #
-		    fi
-		    #
-		    export DateBegin=${SavedDateBegin}
-		    #
-		    (( i=i+1 ))
-		    #
-		done
-	    fi
-	    (( j=j+1 ))
+	  #
+	  fi
+	  #
+	  export DateBegin=${SavedDateBegin}
+	  #
+	  (( i=i+1 ))
+	  #
 	done
-    fi
-
-    #=============  SEASONAL POST-TREATMENT ============#
-    if [ ${SeasonalFrequency} = true ] ; then
-        #
-        IGCM_debug_Print 1 "SEASONNAL POST-TREATMENT"
-        echo
+      fi
+      (( j=j+1 ))
+    done
+  fi
+
+  #=============  SEASONAL POST-PROCESSING ============#
+  if [ ${SeasonalFrequency} = true ] ; then
+    #
+    IGCM_debug_Print 1 "SEASONNAL POST-PROCESSING"
+    echo
+    #
+    Script_Post_Output=create_se.${PeriodDateEnd}
+    #
+    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
+
+    if [ ${RebuildFrequency} = true ] ; then
+      #
+      if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
 	#
-	Script_Post_Output=create_se.${PeriodDateEnd}
-        #
-	listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
-
-	if [ ${RebuildFrequency} = true ] ; then
-	    #
-	    if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-	        #
-		if [ X${MASTER} = Xtitane ] ; then
-		    echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		fi
-		echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export DateBegin=${DateBegin}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		if [ X${MASTER} = Xtitane ] ; then
-		    echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		    echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		fi
-		echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "IGCM_sys_QsubPost create_se                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		if [ X${MASTER} = Xtitane ] ; then
-		    echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		fi
-	        #
-	    fi
-	else
-	    #
-            IGCM_sys_RshPost <<-EOF
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+	echo "export DEBUG_debug=${DEBUG_debug}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export MODIPSL=${MODIPSL}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export libIGCM_SX=${libIGCM}                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export libIGCM=${libIGCM_POST}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export POST_DIR=${POST_DIR}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export MASTER=${MASTER}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RebuildFrequency=${RebuildFrequency}    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export DateBegin=${DateBegin}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	  echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+	echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "IGCM_sys_QsubPost create_se                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+      fi
+    else
+      IGCM_sys_RshPost <<-EOF
             export DEBUG_debug=${DEBUG_debug}
             export MODIPSL=${MODIPSL}
@@ -411,73 +412,138 @@
             IGCM_sys_QsubPost create_se
 EOF
-	#
-	fi
     fi
-
-    #============== REBUILD POST-TREATMENT =============#
-    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
-	# -----------------------------------------------------------------------------------
-        # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now
-        # -----------------------------------------------------------------------------------
-	if [ ${DRYRUN} -le 1 ] ; then
-	    echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	    echo "}                                         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	fi
-        if [ ${config_Post_RebuildFromArchive} = true ] ; then
-            IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
-        else
-            IGCM_sys_Mv      REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
-        fi
+  fi
+
+  #============== REBUILD POST-PROCESSING =============#
+  if [ X${AsynchronousRebuild} = Xtrue ] ; then
+    # -----------------------------------------------------------------------------------
+    # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now
+    # -----------------------------------------------------------------------------------
+    if [ ${DRYRUN} -le 1 ] ; then
+      echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+      echo "}                                         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
     fi
-    #
-    if [ ${RebuildFrequency} = true ] ; then
-        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
-            IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM ARCHIVE"
-            echo
-            #
-	    script=rebuild_fromArchive
-	else
-            IGCM_debug_Print 1 "REBUILD POST-TREATMENT FROM WORKDIR"
-	    echo
-	    #
-	    script=rebuild_fromWorkdir
-	fi
-	#
-	Script_Post_Output=${script}.${PeriodDateEnd}
-	#
-        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
-        IGCM_sys_RshPost <<-EOF
-        export DEBUG_debug=${DEBUG_debug}
-        export MODIPSL=${MODIPSL}
-	export libIGCM_SX=${libIGCM}
-        export libIGCM=${libIGCM_POST}
-        export SUBMIT_DIR=${SUBMIT_DIR}
-        export REBUILD_DIR=${REBUILD_DIR}
-        export POST_DIR=${POST_DIR}
-        export MASTER=${MASTER}
-        export RebuildFromArchive=${config_Post_RebuildFromArchive}
-        export DateBegin=${DateBegin}
-        export PeriodDateBegin=${PeriodDateBegin}
-        export PeriodDateEnd=${PeriodDateEnd}
-        export NbRebuildDir=${NbRebuildDir}
-        export StandAlone=false
-        export RESOL_ATM=${RESOL_ATM}
-        export RESOL_OCE=${RESOL_OCE}
-        export RESOL_ICE=${RESOL_ICE}
-        export RESOL_MBG=${RESOL_MBG}
-        export RESOL_SRF=${RESOL_SRF}
-        export RESOL_SBG=${RESOL_SBG}
-        export listVarEnv=${listVarEnv}
-        export Script_Post_Output=${Script_Post_Output}
-        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
-        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
-        IGCM_sys_MkdirWork ${POST_DIR}
-        IGCM_debug_Verif_Exit_Post
-        IGCM_sys_QsubPost ${script}
+    if [ ${config_Post_RebuildFromArchive} = true ] ; then
+      IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
+    else
+      IGCM_sys_Mv      REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
+    fi
+  fi
+  #
+  if [ ${RebuildFrequency} = true ] ; then
+    if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
+      IGCM_debug_Print 1 "REBUILD POST-PROCESSING FROM ARCHIVE"
+      echo
+      #
+      script=rebuild_fromArchive
+    else
+      IGCM_debug_Print 1 "REBUILD POST-PROCESSING FROM WORKDIR"
+      echo
+      #
+      script=rebuild_fromWorkdir
+    fi
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
+    IGCM_sys_RshPost <<-EOF
+    export DEBUG_debug=${DEBUG_debug}
+    export MODIPSL=${MODIPSL}
+    export libIGCM_SX=${libIGCM}
+    export libIGCM=${libIGCM_POST}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+    export REBUILD_DIR=${REBUILD_DIR}
+    export POST_DIR=${POST_DIR}
+    export MASTER=${MASTER}
+    export RebuildFromArchive=${config_Post_RebuildFromArchive}
+    export DateBegin=${DateBegin}
+    export PeriodDateBegin=${PeriodDateBegin}
+    export PeriodDateEnd=${PeriodDateEnd}
+    export NbRebuildDir=${NbRebuildDir}
+    export StandAlone=false
+    export RESOL_ATM=${RESOL_ATM}
+    export RESOL_OCE=${RESOL_OCE}
+    export RESOL_ICE=${RESOL_ICE}
+    export RESOL_MBG=${RESOL_MBG}
+    export RESOL_SRF=${RESOL_SRF}
+    export RESOL_SBG=${RESOL_SBG}
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
 EOF
-
-    fi
-
-    IGCM_debug_PopStack "IGCM_post_Submit"
+  fi
+
+  #============== PACK PROCESSING FOR RESTART AND DEBUG FILES =============#
+  if [ ${PackFrequency} = true ] ; then
+    IGCM_debug_Print 1 "PACK POST-PROCESSING"
+    echo
+    ## Need to Remember This One
+    SavedDateBegin=${DateBegin}
+    ## Need to Remember This One
+    SavedDateEnd=${DateEnd}
+    #
+    DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 ))
+    #
+    PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} )
+    #
+    script=pack_debug
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone"
+    IGCM_sys_RshPost <<-EOF
+    export DEBUG_debug=${DEBUG_debug}
+    export MODIPSL=${MODIPSL}
+    export libIGCM_SX=${libIGCM}
+    export libIGCM=${libIGCM_POST}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+    export POST_DIR=${POST_DIR}
+    export MASTER=${MASTER}
+    export DateBegin=${PackDateBegin}
+    export DateEnd=${PeriodDateEnd}
+    export PeriodPack=${config_Post_PackFrequency}
+    export StandAlone=false
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
+EOF
+    #
+    script=pack_restart
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    IGCM_sys_RshPost <<-EOF
+    export DEBUG_debug=${DEBUG_debug}
+    export MODIPSL=${MODIPSL}
+    export libIGCM_SX=${libIGCM}
+    export libIGCM=${libIGCM_POST}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+    export POST_DIR=${POST_DIR}
+    export MASTER=${MASTER}
+    export DateBegin=${PackDateBegin}
+    export DateEnd=${PeriodDateEnd}
+    export PeriodPack=${config_Post_PackFrequency}
+    export StandAlone=false
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
+EOF
+
+    export DateBegin=${SavedDateBegin}
+    export DateEnd=${SavedDateEnd}
+  fi
+  IGCM_debug_PopStack "IGCM_post_Submit"
 }
 
@@ -485,113 +551,113 @@
 function IGCM_post_CheckModuloFrequency
 {
-    IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $*
-
-    # Used by IGCM_config_Check
-    # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d)
-    # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero
-    # Input parameter are the name of the variable, not the frequency value itself
-    # example
-    # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength
-
-    typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay
-
-    # Get the name of the variable
-    MasterName=$1
-    SlaveName=$2
-    # Get the value the above name points to
-    MasterFrequency=$( eval echo \${${1}} )
-    SlaveFrequency=$( eval echo \${${2}} )
-
-    IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}"
-
-    case ${MasterFrequency} in
-        *y|*Y)
-            PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" )
-	    case ${SlaveFrequency} in
-		*Y|*y)
-		    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
-		    if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \
-			[ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] );  then
-			IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-			IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			IGCM_debug_Exit "Check your frequency"
-		    fi ;;
-		*M|*m)
- 	            PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
-		    if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \
-			[ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then
-			IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-			IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			IGCM_debug_Exit "Check your frequency"
- 	            fi ;;
-                *D|*d)
-                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
-		    NbDays=$( IGCM_date_DaysInYear ${year} )
-		    if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then
-			if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \
-			    [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then
-			    IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-			    IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			    IGCM_debug_Exit "Check your frequency"
-			fi
-		    else
-			IGCM_debug_Print 1 "For ${MasterName} with leap calendar:"
-			IGCM_debug_Print 1 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}"
-			IGCM_debug_Print 1 "No post-treatment. Case not properly handle at this moment by libIGCM. Sorry"
-			IGCM_debug_Exit    "Check your frequency ${MasterName} and choose a daily frequency for this one too."
-                    fi ;;
-	    esac ;;
-	*M|*m)
-	    PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" )
-            case ${SlaveFrequency} in		    
-		*Y|*y)
-		    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
-		    if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \
-			[ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then
-			IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-			IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			IGCM_debug_Exit "Check your frequency"
- 	            fi ;;
-		*M|*m)
-		    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
-		    if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \
-			[ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ;  then		
-			IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-			IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			IGCM_debug_Exit "Check your frequency"
-		    fi ;;
-		*D|*d)
-		    IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-		    IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-		    IGCM_debug_Exit "Check your frequency" ;;
-	    esac ;;
-        *D|*d)
-            PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" )
-            case ${SlaveFrequency} in
-                *Y|*y)
-                    IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-                    IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}"
-		    IGCM_debug_Exit "Check your frequency" ;;
-                *M|*m)
-                    IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-                    IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}"
-		    IGCM_debug_Exit "Check your frequency" ;;
-                *D|*d)
-                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
-                    if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \
-                        [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ;  then
-                        IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
-                        IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
-			IGCM_debug_Exit "Check your frequency"
-                    fi ;;
-            esac ;;
-        NONE|none) 
-	    ;;
-	*)
-	    IGCM_debug_Print 1 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card"
-	    IGCM_debug_Exit "Check your ${MasterName} in config.card" ;;
-    esac
-
-    IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency"
+  IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $*
+
+  # Used by IGCM_config_Check
+  # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d)
+  # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero
+  # Input parameter are the name of the variable, not the frequency value itself
+  # example
+  # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength
+
+  typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay
+
+  # Get the name of the variable
+  MasterName=$1
+  SlaveName=$2
+  # Get the value the above name points to
+  MasterFrequency=$( eval echo \${${1}} )
+  SlaveFrequency=$( eval echo \${${2}} )
+
+  IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}"
+
+  case ${MasterFrequency} in
+  *y|*Y)
+    PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" )
+    case ${SlaveFrequency} in
+    *Y|*y)
+      PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
+      if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \
+	[ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] );  then
+	IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+	IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	IGCM_debug_Exit "Check your frequency"
+      fi ;;
+    *M|*m)
+      PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
+      if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \
+	[ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then
+	IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+	IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	IGCM_debug_Exit "Check your frequency"
+      fi ;;
+    *D|*d)
+      PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
+      NbDays=$( IGCM_date_DaysInYear ${year} )
+      if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then
+	if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \
+	  [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then
+	  IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+	  IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	  IGCM_debug_Exit "Check your frequency"
+	fi
+      else
+	IGCM_debug_Print 1 "For ${MasterName} with leap calendar:"
+	IGCM_debug_Print 1 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}"
+	IGCM_debug_Print 1 "No post-treatment. Case not properly handle at this moment by libIGCM. Sorry"
+	IGCM_debug_Exit    "Check your frequency ${MasterName} and choose a daily frequency for this one too."
+      fi ;;
+    esac ;;
+  *M|*m)
+    PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" )
+    case ${SlaveFrequency} in		    
+    *Y|*y)
+      PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
+      if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \
+	[ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then
+	IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+	IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	IGCM_debug_Exit "Check your frequency"
+      fi ;;
+    *M|*m)
+      PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
+      if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \
+	[ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ;  then		
+	IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+	IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	IGCM_debug_Exit "Check your frequency"
+      fi ;;
+    *D|*d)
+      IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+      IGCM_debug_Exit "Check your frequency" ;;
+    esac ;;
+  *D|*d)
+    PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" )
+    case ${SlaveFrequency} in
+    *Y|*y)
+      IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}"
+      IGCM_debug_Exit "Check your frequency" ;;
+    *M|*m)
+      IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}"
+      IGCM_debug_Exit "Check your frequency" ;;
+    *D|*d)
+      PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
+      if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \
+        [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ;  then
+        IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with"
+        IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}"
+	IGCM_debug_Exit "Check your frequency"
+      fi ;;
+    esac ;;
+  NONE|none)
+    ;;
+  *)
+    IGCM_debug_Print 1 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card"
+    IGCM_debug_Exit "Check your ${MasterName} in config.card" ;;
+  esac
+
+  IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency"
 }
 
@@ -599,105 +665,105 @@
 function IGCM_post_ModuloRuntimeFrequency
 {
-    IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $*
-
-    # Used by IGCM_post_Configure
-    # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and 
-    # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d)
-    # --> turn on post-processing submission when their modulo is zero
-    # Input parameter are the name of the variable, not the frequency value itself
-    # example
-    # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength
-
-    typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay
-
-    # Get the name of the variable
-    MasterName=$1
-    SlaveName=$2
- 
-    # Get the value the above name points to
-    eval MasterFrequency=\${${1}}
-    eval SlaveFrequency=\${${2}}
-
-    echo
-    IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}"
-
-    case ${MasterFrequency} in
-	*y|*Y)
-	    PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" )
-	    case ${SlaveFrequency} in
-		*Y|*y)
-		    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
-		    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ;  then
-			if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} ))
-			fi
-		    fi;;
-		*M|*m)
- 		    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
-		    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then
-			if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} ))
-			fi
-		    fi;;
-		*D|*d)
-		    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
-		    NbDays=$( IGCM_date_DaysInYear ${year} )
-		    if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then
-			if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} ))
-			fi
-		    fi;;
-	    esac ;;
-	*M|*m)
-	    PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" )
-	    case ${SlaveFrequency} in
-		*Y|*y)
-		    PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
-		    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then
-			if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) ))
-			fi
-		    fi;;
-		*M|*m)
-		    PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
-		    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ;  then
-			if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} -  ${PeriodOffset} )) -ne 0 ] ; then 
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} ))
-			fi
-		    fi;;
-		*D|*d)
-		    IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
-		    IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
-	    esac ;;
-        *D|*d)
-            PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" )
-            case ${SlaveFrequency} in
-                *Y|*y)
-                    IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
-                    IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
-                *M|*m)
-                    IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
-                    IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
-                *D|*d)
-                    PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
-                    if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ;  then
-                        if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then
-			    eval ${post_freq}=true ; POST=true
-			    [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} ))
-			fi
-                    fi;;
-            esac ;;
-	NONE|none)
-	    ;;
-	*)
-	    IGCM_debug_Print 1 "KeyWord not allowed for ${post_freq} in config.card"
-	    ;;
-    esac
-
-    IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency"
+  IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $*
+
+  # Used by IGCM_post_Configure
+  # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and 
+  # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d)
+  # --> turn on post-processing submission when their modulo is zero
+  # Input parameter are the name of the variable, not the frequency value itself
+  # example
+  # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength
+
+  typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay
+
+  # Get the name of the variable
+  MasterName=$1
+  SlaveName=$2
+  
+  # Get the value the above name points to
+  eval MasterFrequency=\${${1}}
+  eval SlaveFrequency=\${${2}}
+
+  echo
+  IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}"
+
+  case ${MasterFrequency} in
+  *y|*Y)
+    PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" )
+    case ${SlaveFrequency} in
+    *Y|*y)
+      PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
+      if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ;  then
+	if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} ))
+	fi
+      fi;;
+    *M|*m)
+      PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
+      if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then
+	if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} ))
+	fi
+      fi;;
+    *D|*d)
+      PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
+      NbDays=$( IGCM_date_DaysInYear ${year} )
+      if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then
+	if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} ))
+	fi
+      fi;;
+    esac ;;
+  *M|*m)
+    PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" )
+    case ${SlaveFrequency} in
+    *Y|*y)
+      PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
+      if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then
+	if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) ))
+	fi
+      fi;;
+    *M|*m)
+      PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" )
+      if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ;  then
+	if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} -  ${PeriodOffset} )) -ne 0 ] ; then 
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} ))
+	fi
+      fi;;
+    *D|*d)
+      IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
+    esac ;;
+  *D|*d)
+    PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" )
+    case ${SlaveFrequency} in
+    *Y|*y)
+      IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
+    *M|*m)
+      IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with"
+      IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;;
+    *D|*d)
+      PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" )
+      if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ;  then
+        if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then
+	  eval ${post_freq}=true ; POST=true
+	  [ X${3} = XNbRebuildDir ] && NbRebuildDir=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} ))
+	fi
+      fi;;
+    esac ;;
+  NONE|none)
+    ;;
+  *)
+    IGCM_debug_Print 1 "KeyWord not allowed for ${post_freq} in config.card"
+    ;;
+  esac
+
+  IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency"
 }
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 571)
@@ -117,14 +117,14 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
 #====================================================
-#- OUT
+#- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
 
 #====================================================
-#- OUT_SCR (ONLY FOR double copy an scratch)
-typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
+#- R_BUF (ONLY FOR double copy an scratch)
+typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT
 
 #====================================================
@@ -151,14 +151,14 @@
 #D-
 function IGCM_sys_RshMaster {
-    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
-    typeset NB_ESSAI DELAI status i
-    # number of tentative
-    NB_ESSAI=10
-    # time delay between tentative
-    DELAI=10
-    #
-    (( i = 0 ))
-    while [ $i -lt $NB_ESSAI ] ; do
-	ssh ${MASTER} exec /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+  typeset NB_ESSAI DELAI status i
+  # number of tentative
+  NB_ESSAI=10
+  # time delay between tentative
+  DELAI=10
+  #
+  (( i = 0 ))
+  while [ $i -lt $NB_ESSAI ] ; do
+    ssh ${MASTER} exec /bin/ksh <<-EOF
     export libIGCM=${libIGCM_SX}
     export DEBUG_debug=${DEBUG_debug}
@@ -167,16 +167,16 @@
     ${@}
 EOF
-	status=$?
-	if [ ${status} -gt 0 ]; then
-	    IGCM_debug_Print 2 "IGCM_sys_RshMaster : ssh failed ${i}/${NB_ESSAI}"
-	    IGCM_debug_Print 2 "IGCM_sys_RshMaster : sleep ${DELAI} seconds and try again."
-	    sleep $DELAI
-        else
-	    break
-        fi
-        (( i = i + 1 ))
-    done
-
-    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+    status=$?
+    if [ ${status} -gt 0 ]; then
+      IGCM_debug_Print 2 "IGCM_sys_RshMaster : ssh failed ${i}/${NB_ESSAI}"
+      IGCM_debug_Print 2 "IGCM_sys_RshMaster : sleep ${DELAI} seconds and try again."
+      sleep $DELAI
+    else
+      break
+    fi
+    (( i = i + 1 ))
+  done
+
+  IGCM_debug_PopStack "IGCM_sys_RshMaster"
 }
 
@@ -187,13 +187,13 @@
 #D-
 function IGCM_sys_RshArchive {
-    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+  /bin/ksh <<-EOF
     ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshArchive : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshArchive"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshArchive"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshArchive"
 }
 
@@ -204,14 +204,24 @@
 #D-
 function IGCM_sys_RshPost {
-    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RshPost :" $@
-    fi
-    /bin/ksh ${@}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshPost : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshPost"
+  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RshPost :" $@
+  fi
+
+  #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL
+  #cat tmp_IGCM_sys_RshPost_$$
+  # keep standard input (stdin) for the loop onto temporary file
+  cat >tmp_IGCM_sys_RshPost_$$
+
+  /bin/ksh <tmp_IGCM_sys_RshPost_$$
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshPost : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshPost"
+    cat tmp_IGCM_sys_RshPost_$$
+  fi
+  # delete temporary file
+  \rm tmp_IGCM_sys_RshPost_$$
+
+  IGCM_debug_PopStack "IGCM_sys_RshPost"
 }
 
@@ -222,16 +232,16 @@
 #D-
 function IGCM_sys_SendMail {
-    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_SendMail :" $@
-    fi
-
-    if ( ${ExitFlag} ) ; then
-	status=failed
-    else
-	status=completed
-    fi
-
-    ssh mercure <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_SendMail :" $@
+  fi
+
+  if ( ${ExitFlag} ) ; then
+    status=failed
+  else
+    status=completed
+  fi
+
+  ssh mercure <<-EOF
     export LOGIN=${LOGIN}
     export config_UserChoices_JobName=${config_UserChoices_JobName}
@@ -262,9 +272,9 @@
 EOF
 
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_SendMail : erreur."
-	IGCM_debug_Exit "IGCM_sys_SendMail"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_SendMail"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_SendMail : erreur."
+    IGCM_debug_Exit "IGCM_sys_SendMail"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_SendMail"
 }
 
@@ -275,21 +285,21 @@
 #D-
 function IGCM_sys_Mkdir {
-    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mkdir :" $@
-    fi
-    if [ ! -d ${1} ]; then
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Mkdir : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Mkdir"
-	fi
-    fi
-    # vérification :
-    if [ ! -d ${1} ] ; then
-	echo "IGCM_sys_Mkdir : erreur."
-	IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mkdir :" $@
+  fi
+  if [ ! -d ${1} ]; then
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Mkdir : erreur."
+      IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+  fi
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_Mkdir : erreur."
+    IGCM_debug_Exit "IGCM_sys_Mkdir"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mkdir"
 }
 
@@ -300,17 +310,17 @@
 #D-
 function IGCM_sys_MkdirArchive {
-    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirArchive :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirArchive : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirArchive :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirArchive : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
 }
 
@@ -321,17 +331,17 @@
 #D-
 function IGCM_sys_MkdirWork {
-    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirWork :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirWork : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirWork :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirWork : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
 }
 
@@ -342,14 +352,14 @@
 #D-
 function IGCM_sys_Cd {
-    IGCM_debug_PushStack "IGCM_sys_Cd" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cd :" $@
-    fi
-    \cd $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Cd : erreur."
-	IGCM_debug_Exit "IGCM_sys_Cd"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cd"
+  IGCM_debug_PushStack "IGCM_sys_Cd" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cd :" $@
+  fi
+  \cd $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Cd : erreur."
+    IGCM_debug_Exit "IGCM_sys_Cd"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cd"
 }
 
@@ -360,18 +370,18 @@
 #D-
 function IGCM_sys_Chmod {
-    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Chmod :" $@
-    fi
-    if [ $DRYRUN -le 1 ]; then
-	\chmod $@
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Chmod : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Chmod"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Chmod"
+  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Chmod :" $@
+  fi
+  if [ $DRYRUN -le 1 ]; then
+    \chmod $@
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Chmod : erreur."
+      IGCM_debug_Exit "IGCM_sys_Chmod"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Chmod"
 }
 
@@ -382,14 +392,14 @@
 #D-
 function IGCM_sys_FileSize {
-    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
-
-    typeset sizeF
-    set +A sizeF -- $( ls -la ${1} )
-    if [ $? -gt 0 ] ; then
-	IGCM_debug_Exit "IGCM_sys_FileSize"
-    fi
-    eval ${2}=${sizeF[4]}
-
-    IGCM_debug_PopStack "IGCM_sys_FileSize"
+  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+  typeset sizeF
+  set +A sizeF -- $( ls -la ${1} )
+  if [ $? -gt 0 ] ; then
+    IGCM_debug_Exit "IGCM_sys_FileSize"
+  fi
+  eval ${2}=${sizeF[4]}
+
+  IGCM_debug_PopStack "IGCM_sys_FileSize"
 }
 
@@ -400,13 +410,13 @@
 #D-
 function IGCM_sys_TestDir {
-    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDir :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDir"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDir :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+  return ${ExistFlag}
 }
 
@@ -417,13 +427,30 @@
 #D-
 function IGCM_sys_TestDirArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDirArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDirArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/dmnfs ) != X ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
 }
 
@@ -434,13 +461,27 @@
 #D-
 function IGCM_sys_TestFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestFileArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestFileArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
 }
 
@@ -451,10 +492,24 @@
 #D-
 function IGCM_sys_CountFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
-    ls ${@} 2>/dev/null | wc -l
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_CountFileArchive : erreur."
-    fi
-    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileArchive : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Master Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
 }
 
@@ -465,32 +520,30 @@
 #D-
 function IGCM_sys_Tree {
-    IGCM_debug_PushStack "IGCM_sys_Tree" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tree :" $@
-    fi
-
-    \tree -f $@
-
-    IGCM_debug_PopStack "IGCM_sys_Tree"
+  IGCM_debug_PushStack "IGCM_sys_Tree" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tree :" $@
+  fi
+
+  \tree -f $@
+
+  IGCM_debug_PopStack "IGCM_sys_Tree"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Tar
-#D-* Purpose: master un-tar command
+#D-* Purpose: master tar command
 #D-* Examples:
 #D-
 function IGCM_sys_Tar {
-    IGCM_debug_PushStack "IGCM_sys_Tar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tar :" $@
-    fi
-    \tar cvf $@
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Tar : erreur."
-	IGCM_debug_Exit "IGCM_sys_Tar"
-    fi
-    \tar tvf $1
-
-    IGCM_debug_PopStack "IGCM_sys_Tar"
+  IGCM_debug_PushStack "IGCM_sys_Tar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tar :" $@
+  fi
+  \tar cf $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Tar : erreur."
+    IGCM_debug_Exit "IGCM_sys_Tar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Tar"
 }
 
@@ -501,14 +554,14 @@
 #D-
 function IGCM_sys_UnTar {
-    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_UnTar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_UnTar : erreur."
-	IGCM_debug_Exit "IGCM_sys_UnTar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_UnTar"
+  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_UnTar :" $@
+  fi
+  \tar xvf $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_UnTar : erreur."
+    IGCM_debug_Exit "IGCM_sys_UnTar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_UnTar"
 }
 
@@ -519,14 +572,14 @@
 #D-
 function IGCM_sys_Qsub {
-    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Qsub :" $@
-    fi
-    /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output}.e < $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Qsub : erreur  -o ${Script_Output} -e ${Script_Output}.e $@"
-	IGCM_debug_Exit "IGCM_sys_Qsub"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Qsub"
+  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Qsub :" $@
+  fi
+  /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output}.e < $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Qsub : erreur  -o ${Script_Output} -e ${Script_Output}.e $@"
+    IGCM_debug_Exit "IGCM_sys_Qsub"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Qsub"
 }
 
@@ -537,14 +590,14 @@
 #D-
 function IGCM_sys_QsubPost {
-    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_QsubPost :" $@
-    fi
-    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM}/$1.job
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_QsubPost : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_QsubPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_QsubPost :" $@
+  fi
+  /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM}/$1.job
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_QsubPost : erreur " $@
+    IGCM_debug_Exit "IGCM_sys_QsubPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
 
@@ -560,108 +613,108 @@
 #D-  Error values and explanations can depend on your system version.
 function IGCM_sys_Rsync_out {
-    RET=$1
-    if [ ! $RET ] ; then
-	echo "rsync error !"
-    fi
-
-    if [ $MYLANG = "fr" ]; then
-	case $RET in
-	    0)  return ;;
-	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
-		echo "Erreur de syntaxe ou d'utilisation."
-		return;;
-	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
-		echo "Incompatibilité de protocole."
-		return;;
-	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
-		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
-		echo "répertoires"
-		return;;
-	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
-		echo "Action demandée non supportée : une tentative de manipulation de"
-		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
-		echo "été faite ; ou une option qui est supportée par le  client  mais"
-		echo "pas par le serveur a été spécifiée."
-		return;;
-	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
-		echo "Erreur dans le socket d'entrée sortie"
-		return;;
-	    11) echo "Erreur de rsync ; RERR_FILEIO"
-		echo "Erreur d'entrée sortie fichier"
-		return;;
-	    12) echo "Erreur de rsync ; RERR_STREAMIO"
-		echo "Erreur dans flux de donnée du protocole rsync"
-		return;;
-	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
-		echo "Erreur avec les diagnostics du programme"
-		return;;
-	    14) echo "Erreur de rsync ; RERR_IPC"
-		echo "Erreur dans le code IPC"
-		return;;
-	    20) echo "Erreur de rsync ; RERR_SIGNAL"
-		echo "SIGUSR1 ou SIGINT reçu"
-		return;;
-	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
-		echo "Une erreur retournée par waitpid()"
-		return;;
-	    22) echo "Erreur de rsync ; RERR_MALLOC"
-		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
-		return;;
-	    23) echo ""
-                echo "Erreur fichier inexistant"
-		return;;
-	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
-		echo "Temps d'attente écoulé dans l'envoi/réception de données"
-		return;;
-	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
-		return;;
-	esac
-    elif [ $MYLANG = "en" ] ; then
-	case $RET in
-	    0)  return;;		
-	    1)  echo "rsync error : Syntax or usage error "
-		return;;
-	    2)  echo "rsync error : Protocol incompatibility "
-		return;;
-	    3)  echo "rsync error : Errors selecting input/output files, dirs"
-		return;;
-	    4)  echo "rsync error : Requested action not supported: an attempt"
-		echo "was made to manipulate 64-bit files on a platform that cannot support"
-		echo "them; or an option was specified that is supported by the client and"
-		echo "not by the server."
-		return;;
-	    5)  echo "rsync error : Error starting client-server protocol"
-		return;;
-	    10) echo "rsync error : Error in socket I/O "
-		return;;
-	    11) echo "rsync error : Error in file I/O "
-		return;;
-	    12) echo "rsync error : Error in rsync protocol data stream "
-		return;;
-	    13) echo "rsync error : Errors with program diagnostics "
-		return;;
-	    14) echo "rsync error : Error in IPC code "
-		return;;
-	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
-		return;;
-	    21) echo "rsync error : Some error returned by waitpid() "
-		return;;
-	    22) echo "rsync error : Error allocating core memory buffers "
-		return;;
-	    23) echo "rsync error : Partial transfer due to error"
-		return;;
-	    24) echo "rsync error : Partial transfer due to vanished source files"
-		return;;
-	    30) echo "rsync error : Timeout in data send/receive "
-		return;;
-	    *)  echo "rsync error : return code of rsync unknown :" $RET
-		return;;
-	esac
-    else
-	echo "unknown language $MYLANG."
-	return
-    fi
-}
-    
+  RET=$1
+  if [ ! $RET ] ; then
+    echo "rsync error !"
+  fi
+
+  if [ $MYLANG = "fr" ]; then
+    case $RET in
+    0)  return ;;
+    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+      echo "Erreur de syntaxe ou d'utilisation."
+      return;;
+    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+      echo "Incompatibilité de protocole."
+      return;;
+    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+      echo "répertoires"
+      return;;
+    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+      echo "Action demandée non supportée : une tentative de manipulation de"
+      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+      echo "été faite ; ou une option qui est supportée par le  client  mais"
+      echo "pas par le serveur a été spécifiée."
+      return;;
+    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+      echo "Erreur dans le socket d'entrée sortie"
+      return;;
+    11) echo "Erreur de rsync ; RERR_FILEIO"
+      echo "Erreur d'entrée sortie fichier"
+      return;;
+    12) echo "Erreur de rsync ; RERR_STREAMIO"
+      echo "Erreur dans flux de donnée du protocole rsync"
+      return;;
+    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+      echo "Erreur avec les diagnostics du programme"
+      return;;
+    14) echo "Erreur de rsync ; RERR_IPC"
+      echo "Erreur dans le code IPC"
+      return;;
+    20) echo "Erreur de rsync ; RERR_SIGNAL"
+      echo "SIGUSR1 ou SIGINT reçu"
+      return;;
+    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+      echo "Une erreur retournée par waitpid()"
+      return;;
+    22) echo "Erreur de rsync ; RERR_MALLOC"
+      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+      return;;
+    23) echo ""
+      echo "Erreur fichier inexistant"
+      return;;
+    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+      echo "Temps d'attente écoulé dans l'envoi/réception de données"
+      return;;
+    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+      return;;
+    esac
+  elif [ $MYLANG = "en" ] ; then
+    case $RET in
+    0)  return;;		
+    1)  echo "rsync error : Syntax or usage error "
+      return;;
+    2)  echo "rsync error : Protocol incompatibility "
+      return;;
+    3)  echo "rsync error : Errors selecting input/output files, dirs"
+      return;;
+    4)  echo "rsync error : Requested action not supported: an attempt"
+      echo "was made to manipulate 64-bit files on a platform that cannot support"
+      echo "them; or an option was specified that is supported by the client and"
+      echo "not by the server."
+      return;;
+    5)  echo "rsync error : Error starting client-server protocol"
+      return;;
+    10) echo "rsync error : Error in socket I/O "
+      return;;
+    11) echo "rsync error : Error in file I/O "
+      return;;
+    12) echo "rsync error : Error in rsync protocol data stream "
+      return;;
+    13) echo "rsync error : Errors with program diagnostics "
+      return;;
+    14) echo "rsync error : Error in IPC code "
+      return;;
+    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+      return;;
+    21) echo "rsync error : Some error returned by waitpid() "
+      return;;
+    22) echo "rsync error : Error allocating core memory buffers "
+      return;;
+    23) echo "rsync error : Partial transfer due to error"
+      return;;
+    24) echo "rsync error : Partial transfer due to vanished source files"
+      return;;
+    30) echo "rsync error : Timeout in data send/receive "
+      return;;
+    *)  echo "rsync error : return code of rsync unknown :" $RET
+      return;;
+    esac
+  else
+    echo "unknown language $MYLANG."
+    return
+  fi
+}
+
 #D-#==================================================
 #D-function IGCM_sys_Cp
@@ -670,23 +723,23 @@
 #D-
 function IGCM_sys_Cp {
-    IGCM_debug_PushStack "IGCM_sys_Cp" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cp :" $@
-    fi
-
-    typeset RET
-
-    echo cp $@ > out_rsync 2>&1
-    \cp $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Cp : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Cp"
-     else
-	 \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cp"
+  IGCM_debug_PushStack "IGCM_sys_Cp" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cp :" $@
+  fi
+
+  typeset RET
+
+  echo cp $@ > out_rsync 2>&1
+  \cp $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Cp"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cp"
 }
 
@@ -697,23 +750,23 @@
 #D-
 function IGCM_sys_Rm {
-    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Rm :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Rm : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Rm"
-    else
-	\rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Rm"
+  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Rm :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Rm"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Rm"
 }
 
@@ -725,24 +778,23 @@
 #D-
 function IGCM_sys_RmRunDir {
-    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RmRunDir :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_RmRunDir : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_RmRunDir"
-    else
-	\rm out_rsync
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RmRunDir :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_RmRunDir : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_RmRunDir"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
 }
 
@@ -753,29 +805,29 @@
 #D-
 function IGCM_sys_Mv {
-    IGCM_debug_PushStack "IGCM_sys_Mv" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mv :" $@
-    fi
-
-    if [ $DRYRUN = 0 ]; then
-
-        typeset RET
-            
-        echo mv $@ > out_rsync 2>&1
-        \mv $@ >> out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Mv" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mv :" $@
+  fi
+
+  if [ $DRYRUN = 0 ]; then
+
+    typeset RET
     
-        if [ ${RET} -gt 0 ] ; then
-            echo "IGCM_sys_Mv : error in mv."
-            cat out_rsync
-            IGCM_debug_Exit "IGCM_sys_Mv"
-	else
-	    \rm out_rsync
-        fi
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error in mv."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Mv"
     else
-        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_Mv"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_Mv"
 }
 
@@ -786,76 +838,76 @@
 #D-
 function IGCM_sys_Put_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      return
+    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Get_Dir
-#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Purpose: Copy a complete directory from ${ARCHIVE}
 #D-* Examples:
 #D-
 function IGCM_sys_Get_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-#	if [ ! -d ${1} ] ; then
-#	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
-#	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
-#	    return
-#	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-        # add dmget (to demigrate all offline files) to reduce time of this command :
-        dmget $1/*
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+#    if [ ! -d ${1} ] ; then
+#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+#      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+#      return
+#    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    # USUAL WAY
+    # add dmfind/dmget (to demigrate all offline files) :
+    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
 }
 
@@ -866,84 +918,83 @@
 #D-
 function IGCM_sys_Get_Master {
-    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Master :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-
-	typeset TEST NB_ESSAI DELAI status i
-	
-	TEST=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 )
-	if [ ${TEST} -ne 1 ] ; then
-	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}."
-	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
-	    return
-	fi
-
-	# number of tentative
-	NB_ESSAI=10
-        # time delay between tentative
-	DELAI=10
-	#
-	(( i = 0 ))
-	while [ $i -lt $NB_ESSAI ] ; do
+  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Master :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+
+    typeset TEST NB_ESSAI DELAI status i
+    
+    TEST=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 )
+    if [ ${TEST} -ne 1 ] ; then
+      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}."
+      IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      return
+    fi
+
+    # number of tentative
+    NB_ESSAI=10
+    # time delay between tentative
+    DELAI=10
+    #
+    (( i = 0 ))
+    while [ $i -lt $NB_ESSAI ] ; do
 	    #USUAL WAY
-	    scp -r ${MASTER}:$1 $2 > out_rsync 2>&1
-  	    status=$?
-	    if [ ${status} -gt 0 ]; then
-		IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}"
-		IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
-		sleep $DELAI
-            else
-		break
-            fi
-            (( i = i + 1 ))
-	done
-
-	if [ ${status} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Master : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Master"
-	else
-	    \rm out_rsync
-	fi
+      scp -r ${MASTER}:$1 $2 > out_rsync 2>&1
+      status=$?
+      if [ ${status} -gt 0 ]; then
+	IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}"
+	IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
+	sleep $DELAI
+      else
+	break
+      fi
+      (( i = i + 1 ))
+    done
+
+    if [ ${status} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Master : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Master"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Master"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Rest
-#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-* Purpose: Put computied restarts on ${ARCHIVE}.
 #D-           File and target directory must exist.
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Rest {
-    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Rest :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	fi
-
-	typeset RET
-	#
-	if [ X${JobType} = XRUN ] ; then
-	    IGCM_sys_Chmod 444 ${1}
-	fi
-	#
-	IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	# USUAL WAY
-	\cp $1 $2 > out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -957,88 +1008,88 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Rest : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Out
-#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Out {
-    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Out :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-	    return 1
-	fi
-	#
-	IGCM_sys_MkdirArchive $( dirname $2 )
-	#
-	typeset RET exist skip
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    typeset WORKPATH FILEPATH
-	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    IGCM_sys_MkdirWork ${WORKPATH} 
-	#    FILEPATH=${WORKPATH}/$( basename $2 )
-        #    #
-	#    IGCM_sys_Cp ${1} ${FILEPATH}
-	#fi
-
-	if [ X${JobType} = XRUN ] ; then
-	    if [ X${3} = X ] ; then
-		IGCM_sys_Chmod 444 ${1}
-	    fi
-	fi
-
-	exist=false
+  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_MkdirArchive $( dirname $2 )
+    #
+    typeset RET exist skip
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    typeset WORKPATH FILEPATH
+    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
+    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    FILEPATH=${WORKPATH}/$( basename $2 )
+    #    #
+    #    IGCM_sys_Cp ${1} ${FILEPATH}
+    #fi
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+
+    exist=false
+    skip=false
+    if [ -f $2 ] ; then
+      IGCM_debug_Print 1 "$2 already exist"
+      dmget $2
+      exist=true
+      if [ "X$( diff $1 $2 )" = X ] ; then
+	IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
+	skip=true
+      else
+	IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
 	skip=false
-	if [ -f $2 ] ; then
-	    IGCM_debug_Print 1 "$2 already exist"
-	    dmget $2
-	    exist=true
-	    if [ "X$( diff $1 $2 )" = X ] ; then
-		IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
-		skip=true
-	    else
-		IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
-		skip=false
-	    fi
-	fi
+      fi
+    fi
         # 
-	if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
-	    IGCM_sys_Chmod u+w $2
-	fi
+    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
+      IGCM_sys_Chmod u+w $2
+    fi
 	# USUAL WAY
-	if [ X${skip} = Xfalse ] ; then
-	    cp $1 $2 > out_rsync 2>&1
-            RET=$?
-	    if [ ${RET} -gt 0 ] ; then
-		echo "IGCM_sys_Put_Out : error."
-		cat out_rsync
-		IGCM_debug_Exit "IGCM_sys_Put_Out"
-	    else
-		\rm out_rsync
-	    fi
-	fi
+    if [ X${skip} = Xfalse ] ; then
+      cp $1 $2 > out_rsync 2>&1
+      RET=$?
+      if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Put_Out : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Put_Out"
+      else
+	\rm out_rsync
+      fi
+    fi
 
 # 	#RSYNC WITH NETWORK RSH CALL
@@ -1057,9 +1108,9 @@
 
 
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-    return 0
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Out"
+  return 0
 }
 
@@ -1070,86 +1121,83 @@
 #D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
 function IGCM_sys_Get {
-    IGCM_debug_PushStack "IGCM_sys_Get" $@
-
-    typeset DEST RET dm_liste ifile target file_work 
-
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get :" $@
-    fi
-    if [ $DRYRUN -le 2 ]; then
-	if [ X${1} = X'/l' ] ; then
-            # test if the first file is present in the old computation :
-	    eval set +A dm_liste \${${2}}
-	else
-	    eval set +A dm_liste ${1}
-	fi
-	eval DEST=\${${#}}
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	# Is it an R_OUT file (not R_IN) ?
-	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    # Yes  ? then we try to get it in SCRATCHDIR
-	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
-	#    if [ -f ${file_work[0]} ] ; then
-	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
-	#	IGCM_debug_PopStack "IGCM_sys_Get"
-	#	return
-	#    fi
-	#fi
-
-	# test if the (first) file is present in the old computation :
-	IGCM_sys_TestFileArchive ${dm_liste[0]}
-	RET=$?
-        if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	fi
-
-	dmget ${dm_liste[*]} > out_rsync 2>&1
-	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "WARNING IGCM_sys_Get : demigration error."
-	    cat out_rsync
-	    echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
-	fi
-
-	#if [ ${RET} -gt 0 ] ; then
-	#    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
-	#	cat out_rsync
-	#	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
-	#	sleep 30
-	#	echo "We try another time"
-	#	dmget ${dm_liste[*]} > out_rsync 2>&1
-	#	RET=$?
-	#	if [ ${RET} -gt 0 ] ; then
-	#	    echo "ERROR IGCM_sys_Get : again demigration error :"
-	#	    cat out_rsync
-	#	    IGCM_debug_Exit "IGCM_sys_Get"
-	#	fi
-	#    else
-	#	echo "ERROR IGCM_sys_Get : demigration error :"
-	#	cat out_rsync
-	#	IGCM_debug_Exit "IGCM_sys_Get"
-	#    fi
-	#fi
-
-        #USUAL WAY
-	(( RET=0 ))
-	if [ X${1} = X'/l' ] ; then
-	    (( RET=0 ))
-	    for target in ${dm_liste[*]} ; do
-		local_file=$( basename ${target} )
-		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-		(( RET = RET + $? ))
-	    done
-	else
-	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-	    RET=$?
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+  typeset DEST RET dm_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A dm_liste \${${2}}
+    else
+      eval set +A dm_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    # Is it an R_OUT file (not R_IN) ?
+    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    # Yes  ? then we try to get it in SCRATCHDIR
+    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )
+    #    if [ -f ${file_work[0]} ] ; then
+    #	IGCM_sys_Cp ${file_work[*]} ${DEST}
+    #	IGCM_debug_PopStack "IGCM_sys_Get"
+    #	return
+    #    fi
+    #fi
+
+    # test if the (first) file is present in the old computation :
+    IGCM_sys_TestFileArchive ${dm_liste[0]}
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Get"
+    fi
+
+    dmget ${dm_liste[*]} > out_rsync 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : demigration error."
+      cat out_rsync
+      echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
+    fi
+    #if [ ${RET} -gt 0 ] ; then
+    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
+    #	cat out_rsync
+    #	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
+    #	sleep 30
+    #	echo "We try another time"
+    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #	RET=$?
+    #	if [ ${RET} -gt 0 ] ; then
+    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
+    #	    cat out_rsync
+    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #	fi
+    #    else
+    #	echo "ERROR IGCM_sys_Get : demigration error :"
+    #	cat out_rsync
+    #	IGCM_debug_Exit "IGCM_sys_Get"
+    #    fi
+    #fi
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${dm_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
 
 # 	#RSYNC WITH NETWORK SSH CALL
@@ -1167,37 +1215,112 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get : copy error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichWork :" $@
+  fi
+    # donne la date filesys d'un fichier sur la machine work
+  IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichArchive :" $@
+  fi
+  IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Dods_Rm
-#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
 #D-* Examples:
 #D-
 function IGCM_sys_Dods_Rm {
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Dods_Rm :" $@
-    fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
-	dods_rm public/${LOGIN}/${R_DODS}/${1} #> out_dods_rm 2>&1
-	RET=$?
-        
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Rm :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+    RET=$?
+    
 #	if [ ${RET} -gt 0 ] ; then
 #	    echo "IGCM_sys_Dods_Rm : error."
@@ -1208,10 +1331,9 @@
 #	fi
 
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
-}
-
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
+}
 
 #D-#==================================================
@@ -1221,19 +1343,19 @@
 #D-
 function IGCM_sys_Dods_Cp {
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Dods_Cp :" $@
-    fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
-	#
-	dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
-	RET=$?
-        
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Cp :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    #
+    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+    RET=$?
+
 # 	if [ ${RET} -gt 0 ] ; then
 # 	    echo "IGCM_sys_Dods_Cp : error."
@@ -1244,8 +1366,8 @@
 # 	fi
 
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
 }
 
@@ -1256,59 +1378,30 @@
 #D-
 function IGCM_sys_Put_Dods {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dods :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
-	    return
-	fi
-
-	typeset RET
+  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dods :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+
+    typeset RET
 	#
-	cd ${R_SAVE}
-	IGCM_sys_Dods_Rm ${1}
-	IGCM_sys_Dods_Cp ${1}
-	RET=0
-        
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dods : error."
-	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
-}
-
-############################################################## A FINIR !!
-
-#D-#==================================================
-#D-function IGCM_sys_GetDate_FichWork
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
-#D-* Examples:
-#D-
-function IGCM_sys_GetDate_FichWork {
-    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichWork :" $@
-    fi
-    # donne la date filesys d'un fichier sur la machine work
-    IGCM_debug_PopStack "IGCM_sys_FichWork"
-}
-
-#D-#==================================================
-#D-function IGCM_sys_GetDate_FichArchive
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
-#D-* Examples:
-#D-
-function IGCM_sys_GetDate_FichArchive {
-    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichArchive :" $@
-    fi
-    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+    cd ${R_SAVE}
+    IGCM_sys_Dods_Rm ${1}
+    IGCM_sys_Dods_Cp ${1}
+    RET=0
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dods : error."
+      IGCM_debug_Exit "IGCM_sys_Put_Dods"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
 }
 
@@ -1317,15 +1410,49 @@
 
 function IGCM_sys_rebuild {
-    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_rebuild :" $@
-    fi
-    /home/cont003/p86ipsl/CESIUM/bin/rebuild -f -o $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_rebuild : erreur ${@}."
-       IGCM_debug_Exit "rebuild"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_rebuild"
+  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_rebuild :" $@
+  fi
+  /home/cont003/p86ipsl/CESIUM/bin/rebuild -f -o $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_rebuild : erreur ${@}."
+    IGCM_debug_Exit "rebuild"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+  IGCM_debug_PushStack "IGCM_sys_activ_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_activ_variables"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_desactiv_variables"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+  IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_build_run_file"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_build_run_file"
 }
 
@@ -1334,183 +1461,183 @@
 
 function IGCM_sys_ncap2 {
-    IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncap2 :" $@
-    fi
-    ncap2 "$@"
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncap2 : erreur ${@}."
-       IGCM_debug_Exit "ncap2"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncap2"
+  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncap2 :" $@
+  fi
+  ncap2 "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncap2 : erreur ${@}."
+    IGCM_debug_Exit "ncap2"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncap2"
 }
 
 function IGCM_sys_ncatted {
-    IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncatted :" $@
-    fi
-    ncatted "$@"
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncatted : erreur ${@}."
-       IGCM_debug_Exit "ncatted"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncatted"
+  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncatted :" $@
+  fi
+  ncatted "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncatted : erreur ${@}."
+    IGCM_debug_Exit "ncatted"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncatted"
 }
 
 function IGCM_sys_ncbo {
-    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncbo :" $@
-    fi
-    ncbo $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncbo : erreur ${@}."
-       IGCM_debug_Exit "ncbo"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncbo"
+  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncbo :" $@
+  fi
+  ncbo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncbo : erreur ${@}."
+    IGCM_debug_Exit "ncbo"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncbo"
 }
 
 function IGCM_sys_ncdiff {
-    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncdiff :" $@
-    fi
-    ncdiff $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncdiff : erreur ${@}."
-       IGCM_debug_Exit "ncdiff"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncdiff :" $@
+  fi
+  ncdiff $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncdiff : erreur ${@}."
+    IGCM_debug_Exit "ncdiff"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncdiff"
 }
 
 function IGCM_sys_ncea {
-    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncea :" $@
-    fi
-    ncea $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncea : erreur ${@}."
-       IGCM_debug_Exit "ncea"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncea"
+  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncea :" $@
+  fi
+  ncea $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncea : erreur ${@}."
+    IGCM_debug_Exit "ncea"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncea"
 }
 
 function IGCM_sys_ncecat {
-    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncecat :" $@
-    fi
-    ncecat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncecat : erreur ${@}."
-       IGCM_debug_Exit "ncecat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncecat"
+  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncecat :" $@
+  fi
+  ncecat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncecat : erreur ${@}."
+    IGCM_debug_Exit "ncecat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncecat"
 }
 
 function IGCM_sys_ncflint {
-    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncflint :" $@
-    fi
-    ncflint $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncflint : erreur ${@}."
-       IGCM_debug_Exit "ncflint"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncflint"
+  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncflint :" $@
+  fi
+  ncflint $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncflint : erreur ${@}."
+    IGCM_debug_Exit "ncflint"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncflint"
 }
 
 function IGCM_sys_ncks {
-    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncks :" $@
-    fi
-    ncks $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncks : erreur ${@}."
-       IGCM_debug_Exit "ncks"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncks"
+  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncks :" $@
+  fi
+  ncks $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncks : erreur ${@}."
+    IGCM_debug_Exit "ncks"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncks"
 }
 
 function IGCM_sys_ncpdq {
-    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncpdq :" $@
-    fi
-    ncpdq $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncpdq : erreur ${@}."
-       IGCM_debug_Exit "ncpdq"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncpdq :" $@
+  fi
+  ncpdq $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncpdq : erreur ${@}."
+    IGCM_debug_Exit "ncpdq"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncpdq"
 }
 
 function IGCM_sys_ncra {
-    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncra :" $@
-    fi
-    ncra $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncra : erreur ${@}."
-       IGCM_debug_Exit "ncra"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncra"
+  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncra :" $@
+  fi
+  ncra $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncra : erreur ${@}."
+    IGCM_debug_Exit "ncra"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncra"
 }
 
 function IGCM_sys_ncrcat {
-    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrcat :" $@
-    fi
-    ncrcat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrcat : erreur ${@}."
+  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrcat :" $@
+  fi
+  ncrcat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrcat : erreur ${@}."
 #       IGCM_debug_Exit "ncrcat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrcat"
 }
 
 function IGCM_sys_ncrename {
-    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrename :" $@
-    fi
-    ncrename $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrename : erreur ${@}."
-       IGCM_debug_Exit "ncrename"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrename"
+  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrename :" $@
+  fi
+  ncrename $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrename : erreur ${@}."
+    IGCM_debug_Exit "ncrename"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrename"
 }
 
 function IGCM_sys_ncwa {
-    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncwa :" $@
-    fi
-    ncwa $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncwa : erreur ${@}."
-       IGCM_debug_Exit "ncwa"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncwa"
+  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncwa :" $@
+  fi
+  ncwa $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncwa : erreur ${@}."
+    IGCM_debug_Exit "ncwa"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncwa"
 }
 
@@ -1519,49 +1646,18 @@
 
 function IGCM_sys_cdo {
-    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
-
-    \cdo $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_cdo : erreur ${@}."
-       IGCM_debug_PopStack "IGCM_sys_cdo"
-       return 1
-    else
-	IGCM_debug_PopStack "IGCM_sys_cdo"
-	return 0
-    fi
-
+  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_cdo :" $@
+  fi
+  \cdo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_cdo : erreur ${@}."
     IGCM_debug_PopStack "IGCM_sys_cdo"
-}
-
-############################################################
-# Activate Running Environnment Variables
-
-function IGCM_sys_activ_variables {
-    IGCM_debug_PushStack "IGCM_sys_activ_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_activ_variables"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_activ_variables"
-}
-
-############################################################
-# Desactivate Running Environnment Variables
-
-function IGCM_sys_desactiv_variables {
-    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_desactiv_variables"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
-}
-
-############################################################
-# Build run file
-
-function IGCM_sys_build_run_file {
-    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_build_run_file"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_build_run_file"
-}
+    return 1
+  else
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+    return 0
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_cdo"
+}
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 571)
@@ -62,5 +62,5 @@
 
 #=====================================================
-# Host and user names 
+# Host and user names
 # $hostname ou hostname
 typeset  HOST=${HOST:=$( hostname )}
@@ -107,14 +107,18 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
 #====================================================
-#- OUT
+#- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
 
 #====================================================
-#- OUT_SCR (ONLY FOR double copy an scratch)
-typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
+#- R_BUF (ONLY FOR double copy an scratch)
+typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -125,8 +129,4 @@
 #- RUN_DIR_PATH : Temporary working directory (=> TMP)
 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${CSCRATCHDIR}/TMPDIR_IGCM/${JOBID}}
-
-#====================================================
-#- BIG_DIR : BIG_DIR to store files waiting for rebuild
-typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -144,6 +144,6 @@
 #D-
 function IGCM_sys_RshMaster {
-    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
-    /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+  /bin/ksh <<-EOF
     export libIGCM=${libIGCM}
     export DEBUG_debug=${DEBUG_debug}
@@ -152,9 +152,9 @@
     ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshMaster : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshMaster"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshMaster : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshMaster"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshMaster"
 }
 
@@ -165,13 +165,13 @@
 #D-
 function IGCM_sys_RshArchive {
-    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+  /bin/ksh <<-EOF
     ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshArchive : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshArchive"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshArchive"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshArchive"
 }
 
@@ -182,14 +182,14 @@
 #D-
 function IGCM_sys_RshPost {
-    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RshPost :" $@
-    fi
-    /bin/ksh ${@}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshPost : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshPost"
+  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RshPost :" $@
+  fi
+  /bin/ksh ${@}
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshPost : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshPost"
 }
 
@@ -200,15 +200,15 @@
 #D-
 function IGCM_sys_SendMail {
-    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_SendMail :" $@
-    fi
-
-    if ( ${ExitFlag} ) ; then
-	status=failed
-    else
-	status=completed
-    fi
-    cat  << END_MAIL > job_end.mail
+  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_SendMail :" $@
+  fi
+
+  if ( ${ExitFlag} ) ; then
+    status=failed
+  else
+    status=completed
+  fi
+  cat  << END_MAIL > job_end.mail
 Dear ${LOGIN},
 
@@ -220,17 +220,17 @@
 END_MAIL
 
-    if  [ X"${config_UserChoices_MailName}" != X ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
-    elif [ -f ~/.forward ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
-    else
-       mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail
-    fi
-
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_SendMail : erreur."
-	IGCM_debug_Exit "IGCM_sys_SendMail"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_SendMail"
+  if  [ X"${config_UserChoices_MailName}" != X ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
+  elif [ -f ~/.forward ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
+  else
+    mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail
+  fi
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_SendMail : erreur."
+    IGCM_debug_Exit "IGCM_sys_SendMail"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_SendMail"
 }
 
@@ -241,21 +241,21 @@
 #D-
 function IGCM_sys_Mkdir {
-    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mkdir :" $@
-    fi
-    if [ ! -d ${1} ]; then
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Mkdir : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Mkdir"
-	fi
-    fi
-    # vérification :
-    if [ ! -d ${1} ] ; then
-	echo "IGCM_sys_Mkdir : erreur."
-	IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mkdir :" $@
+  fi
+  if [ ! -d ${1} ]; then
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Mkdir : erreur."
+      IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+  fi
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_Mkdir : erreur."
+    IGCM_debug_Exit "IGCM_sys_Mkdir"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mkdir"
 }
 
@@ -266,17 +266,17 @@
 #D-
 function IGCM_sys_MkdirArchive {
-    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirArchive :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirArchive : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirArchive :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirArchive : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
 }
 
@@ -287,17 +287,17 @@
 #D-
 function IGCM_sys_MkdirWork {
-    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirWork :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirWork : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirWork :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirWork : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
 }
 
@@ -308,14 +308,14 @@
 #D-
 function IGCM_sys_Cd {
-    IGCM_debug_PushStack "IGCM_sys_Cd" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cd :" $@
-    fi
-    \cd $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Cd : erreur."
-	IGCM_debug_Exit "IGCM_sys_Cd"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cd"
+  IGCM_debug_PushStack "IGCM_sys_Cd" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cd :" $@
+  fi
+  \cd $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Cd : erreur."
+    IGCM_debug_Exit "IGCM_sys_Cd"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cd"
 }
 
@@ -326,18 +326,18 @@
 #D-
 function IGCM_sys_Chmod {
-    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Chmod :" $@
-    fi
-    if [ $DRYRUN -le 1 ]; then
-	\chmod $@
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Chmod : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Chmod"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Chmod"
+  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Chmod :" $@
+  fi
+  if [ $DRYRUN -le 1 ]; then
+    \chmod $@
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Chmod : erreur."
+      IGCM_debug_Exit "IGCM_sys_Chmod"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Chmod"
 }
 
@@ -348,14 +348,14 @@
 #D-
 function IGCM_sys_FileSize {
-    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
-
-    typeset sizeF
-    set +A sizeF -- $( ls -la ${1} )
-    if [ $? -gt 0 ] ; then
-	IGCM_debug_Exit "IGCM_sys_FileSize"
-    fi
-    eval ${2}=${sizeF[4]}
-
-    IGCM_debug_PopStack "IGCM_sys_FileSize"
+  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+  typeset sizeF
+  set +A sizeF -- $( ls -la ${1} )
+  if [ $? -gt 0 ] ; then
+    IGCM_debug_Exit "IGCM_sys_FileSize"
+  fi
+  eval ${2}=${sizeF[4]}
+
+  IGCM_debug_PopStack "IGCM_sys_FileSize"
 }
 
@@ -366,13 +366,13 @@
 #D-
 function IGCM_sys_TestDir {
-    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDir :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDir"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDir :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+  return ${ExistFlag}
 }
 
@@ -383,13 +383,30 @@
 #D-
 function IGCM_sys_TestDirArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDirArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDirArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/dmnfs ) != X ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
 }
 
@@ -400,13 +417,27 @@
 #D-
 function IGCM_sys_TestFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestFileArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestFileArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
 }
 
@@ -417,10 +448,24 @@
 #D-
 function IGCM_sys_CountFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
-    ls ${@} 2>/dev/null | wc -l
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_CountFileArchive : erreur."
-    fi
-    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileArchive : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
 }
 
@@ -431,32 +476,30 @@
 #D-
 function IGCM_sys_Tree {
-    IGCM_debug_PushStack "IGCM_sys_Tree" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tree :" $@
-    fi
-
-    \tree -f $@
-
-    IGCM_debug_PopStack "IGCM_sys_Tree"
+  IGCM_debug_PushStack "IGCM_sys_Tree" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tree :" $@
+  fi
+
+  \tree -f $@
+
+  IGCM_debug_PopStack "IGCM_sys_Tree"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Tar
-#D-* Purpose: master un-tar command
+#D-* Purpose: master tar command
 #D-* Examples:
 #D-
 function IGCM_sys_Tar {
-    IGCM_debug_PushStack "IGCM_sys_Tar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tar :" $@
-    fi
-    \tar cvf $@
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Tar : erreur."
-	IGCM_debug_Exit "IGCM_sys_Tar"
-    fi
-    \tar tvf $1
-
-    IGCM_debug_PopStack "IGCM_sys_Tar"
+  IGCM_debug_PushStack "IGCM_sys_Tar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tar :" $@
+  fi
+  \tar cf $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Tar : erreur."
+    IGCM_debug_Exit "IGCM_sys_Tar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Tar"
 }
 
@@ -467,14 +510,14 @@
 #D-
 function IGCM_sys_UnTar {
-    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_UnTar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_UnTar : erreur."
-	IGCM_debug_Exit "IGCM_sys_UnTar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_UnTar"
+  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_UnTar :" $@
+  fi
+  \tar xvf $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_UnTar : erreur."
+    IGCM_debug_Exit "IGCM_sys_UnTar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_UnTar"
 }
 
@@ -485,14 +528,14 @@
 #D-
 function IGCM_sys_QsubPost {
-    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_QsubPost :" $@
-    fi
-    /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_QsubPost : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_QsubPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_QsubPost :" $@
+  fi
+  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_QsubPost : erreur " $@
+    IGCM_debug_Exit "IGCM_sys_QsubPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
 
@@ -508,108 +551,108 @@
 #D-  Error values and explanations can depend on your system version.
 function IGCM_sys_Rsync_out {
-    RET=$1
-    if [ ! $RET ] ; then
-	echo "rsync error !"
-    fi
-
-    if [ $MYLANG = "fr" ]; then
-	case $RET in
-	    0)  return ;;
-	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
-		echo "Erreur de syntaxe ou d'utilisation."
-		return;;
-	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
-		echo "Incompatibilité de protocole."
-		return;;
-	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
-		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
-		echo "répertoires"
-		return;;
-	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
-		echo "Action demandée non supportée : une tentative de manipulation de"
-		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
-		echo "été faite ; ou une option qui est supportée par le  client  mais"
-		echo "pas par le serveur a été spécifiée."
-		return;;
-	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
-		echo "Erreur dans le socket d'entrée sortie"
-		return;;
-	    11) echo "Erreur de rsync ; RERR_FILEIO"
-		echo "Erreur d'entrée sortie fichier"
-		return;;
-	    12) echo "Erreur de rsync ; RERR_STREAMIO"
-		echo "Erreur dans flux de donnée du protocole rsync"
-		return;;
-	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
-		echo "Erreur avec les diagnostics du programme"
-		return;;
-	    14) echo "Erreur de rsync ; RERR_IPC"
-		echo "Erreur dans le code IPC"
-		return;;
-	    20) echo "Erreur de rsync ; RERR_SIGNAL"
-		echo "SIGUSR1 ou SIGINT reçu"
-		return;;
-	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
-		echo "Une erreur retournée par waitpid()"
-		return;;
-	    22) echo "Erreur de rsync ; RERR_MALLOC"
-		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
-		return;;
-	    23) echo ""
-                echo "Erreur fichier inexistant"
-		return;;
-	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
-		echo "Temps d'attente écoulé dans l'envoi/réception de données"
-		return;;
-	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
-		return;;
-	esac
-    elif [ $MYLANG = "en" ] ; then
-	case $RET in
-	    0)  return;;		
-	    1)  echo "rsync error : Syntax or usage error "
-		return;;
-	    2)  echo "rsync error : Protocol incompatibility "
-		return;;
-	    3)  echo "rsync error : Errors selecting input/output files, dirs"
-		return;;
-	    4)  echo "rsync error : Requested action not supported: an attempt"
-		echo "was made to manipulate 64-bit files on a platform that cannot support"
-		echo "them; or an option was specified that is supported by the client and"
-		echo "not by the server."
-		return;;
-	    5)  echo "rsync error : Error starting client-server protocol"
-		return;;
-	    10) echo "rsync error : Error in socket I/O "
-		return;;
-	    11) echo "rsync error : Error in file I/O "
-		return;;
-	    12) echo "rsync error : Error in rsync protocol data stream "
-		return;;
-	    13) echo "rsync error : Errors with program diagnostics "
-		return;;
-	    14) echo "rsync error : Error in IPC code "
-		return;;
-	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
-		return;;
-	    21) echo "rsync error : Some error returned by waitpid() "
-		return;;
-	    22) echo "rsync error : Error allocating core memory buffers "
-		return;;
-	    23) echo "rsync error : Partial transfer due to error"
-		return;;
-	    24) echo "rsync error : Partial transfer due to vanished source files"
-		return;;
-	    30) echo "rsync error : Timeout in data send/receive "
-		return;;
-	    *)  echo "rsync error : return code of rsync unknown :" $RET
-		return;;
-	esac
-    else
-	echo "unknown language $MYLANG."
-	return
-    fi
-}
-    
+  RET=$1
+  if [ ! $RET ] ; then
+    echo "rsync error !"
+  fi
+
+  if [ $MYLANG = "fr" ]; then
+    case $RET in
+    0)  return ;;
+    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+      echo "Erreur de syntaxe ou d'utilisation."
+      return;;
+    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+      echo "Incompatibilité de protocole."
+      return;;
+    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+      echo "répertoires"
+      return;;
+    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+      echo "Action demandée non supportée : une tentative de manipulation de"
+      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+      echo "été faite ; ou une option qui est supportée par le  client  mais"
+      echo "pas par le serveur a été spécifiée."
+      return;;
+    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+      echo "Erreur dans le socket d'entrée sortie"
+      return;;
+    11) echo "Erreur de rsync ; RERR_FILEIO"
+      echo "Erreur d'entrée sortie fichier"
+      return;;
+    12) echo "Erreur de rsync ; RERR_STREAMIO"
+      echo "Erreur dans flux de donnée du protocole rsync"
+      return;;
+    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+      echo "Erreur avec les diagnostics du programme"
+      return;;
+    14) echo "Erreur de rsync ; RERR_IPC"
+      echo "Erreur dans le code IPC"
+      return;;
+    20) echo "Erreur de rsync ; RERR_SIGNAL"
+      echo "SIGUSR1 ou SIGINT reçu"
+      return;;
+    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+      echo "Une erreur retournée par waitpid()"
+      return;;
+    22) echo "Erreur de rsync ; RERR_MALLOC"
+      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+      return;;
+    23) echo ""
+      echo "Erreur fichier inexistant"
+      return;;
+    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+      echo "Temps d'attente écoulé dans l'envoi/réception de données"
+      return;;
+    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+      return;;
+    esac
+  elif [ $MYLANG = "en" ] ; then
+    case $RET in
+    0)  return;;		
+    1)  echo "rsync error : Syntax or usage error "
+      return;;
+    2)  echo "rsync error : Protocol incompatibility "
+      return;;
+    3)  echo "rsync error : Errors selecting input/output files, dirs"
+      return;;
+    4)  echo "rsync error : Requested action not supported: an attempt"
+      echo "was made to manipulate 64-bit files on a platform that cannot support"
+      echo "them; or an option was specified that is supported by the client and"
+      echo "not by the server."
+      return;;
+    5)  echo "rsync error : Error starting client-server protocol"
+      return;;
+    10) echo "rsync error : Error in socket I/O "
+      return;;
+    11) echo "rsync error : Error in file I/O "
+      return;;
+    12) echo "rsync error : Error in rsync protocol data stream "
+      return;;
+    13) echo "rsync error : Errors with program diagnostics "
+      return;;
+    14) echo "rsync error : Error in IPC code "
+      return;;
+    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+      return;;
+    21) echo "rsync error : Some error returned by waitpid() "
+      return;;
+    22) echo "rsync error : Error allocating core memory buffers "
+      return;;
+    23) echo "rsync error : Partial transfer due to error"
+      return;;
+    24) echo "rsync error : Partial transfer due to vanished source files"
+      return;;
+    30) echo "rsync error : Timeout in data send/receive "
+      return;;
+    *)  echo "rsync error : return code of rsync unknown :" $RET
+      return;;
+    esac
+  else
+    echo "unknown language $MYLANG."
+    return
+  fi
+}
+
 #D-#==================================================
 #D-function IGCM_sys_Cp
@@ -618,23 +661,23 @@
 #D-
 function IGCM_sys_Cp {
-    IGCM_debug_PushStack "IGCM_sys_Cp" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cp :" $@
-    fi
-
-    typeset RET
-
-    echo cp $@ > out_rsync 2>&1
-    \cp $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Cp : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Cp"
-     else
-	 \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cp"
+  IGCM_debug_PushStack "IGCM_sys_Cp" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cp :" $@
+  fi
+
+  typeset RET
+
+  echo cp $@ > out_rsync 2>&1
+  \cp $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Cp"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cp"
 }
 
@@ -645,23 +688,23 @@
 #D-
 function IGCM_sys_Rm {
-    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Rm :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Rm : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Rm"
-    else
-	\rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Rm"
+  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Rm :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Rm"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Rm"
 }
 
@@ -673,23 +716,23 @@
 #D-
 function IGCM_sys_RmRunDir {
-    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
-    if ( $DEBUG_sys ) ; then
-        echo "IGCM_sys_RmRunDir :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-        echo "IGCM_sys_RmRunDir : error."
-        cat out_rsync
-        IGCM_debug_Exit "IGCM_sys_RmRunDir"
-    else
-        \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RmRunDir :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_RmRunDir : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_RmRunDir"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
 }
 
@@ -700,29 +743,29 @@
 #D-
 function IGCM_sys_Mv {
-    IGCM_debug_PushStack "IGCM_sys_Mv" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mv :" $@
-    fi
-
-    if [ $DRYRUN = 0 ]; then
-
-        typeset RET
-            
-        echo mv $@ > out_rsync 2>&1
-        \mv $@ >> out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Mv" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mv :" $@
+  fi
+
+  if [ $DRYRUN = 0 ]; then
+
+    typeset RET
     
-        if [ ${RET} -gt 0 ] ; then
-            echo "IGCM_sys_Mv : error in mv."
-            cat out_rsync
-            IGCM_debug_Exit "IGCM_sys_Mv"
-	else
-	    \rm out_rsync
-        fi
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error in mv."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Mv"
     else
-        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_Mv"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_Mv"
 }
 
@@ -733,35 +776,35 @@
 #D-
 function IGCM_sys_Put_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      return
+    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
 }
 
@@ -772,9 +815,9 @@
 #D-
 function IGCM_sys_Get_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
+  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
 #	if [ ! -d ${1} ] ; then
 #	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
@@ -783,26 +826,26 @@
 #	fi
 
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-        # add dmget (to demigrate all offline files) to reduce time of this command :
-        dmget $1/*
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
-	else
-	    \rm out_rsync
-	fi
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    # add dmget (to demigrate all offline files) to reduce time of this command :
+    dmget $1/*
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
 }
 
@@ -813,66 +856,65 @@
 #D-
 function IGCM_sys_Get_Master {
-    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Master :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
-	    return
-	fi
-
-	typeset RET
-
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Master : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Master"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Master :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      return
+    fi
+
+    typeset RET
+
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Master : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Master"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Master"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Rest
-#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-* Purpose: Put computied restarts on ${ARCHIVE}.
 #D-           File and target directory must exist.
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Rest {
-    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Rest :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	fi
-
-	typeset RET
-	#
-	if [ X${JobType} = XRUN ] ; then
-	    IGCM_sys_Chmod 444 ${1}
-	fi
-	#
-	IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	# USUAL WAY
-	putfer $1 $2 > out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -886,92 +928,133 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Rest : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Rest
+#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Rest {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Out
-#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Out {
-    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Out :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-	    return 1
-	fi
-	#
-	IGCM_sys_MkdirArchive $( dirname $2 )
-	#
-	typeset RET exist skip
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    typeset WORKPATH FILEPATH
-	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    IGCM_sys_MkdirWork ${WORKPATH} 
-	#    FILEPATH=${WORKPATH}/$( basename $2 )
-        #    #
-	#    IGCM_sys_Cp ${1} ${FILEPATH}
-	#fi
-
-	if [ X${JobType} = XRUN ] ; then
-	    if [ X${3} = X ] ; then
-		IGCM_sys_Chmod 444 ${1}
-	    fi
-	fi
-
-	exist=false
+  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_MkdirArchive $( dirname $2 )
+    #
+    typeset RET exist skip
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    typeset WORKPATH FILEPATH
+    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
+    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    FILEPATH=${WORKPATH}/$( basename $2 )
+    #    #
+    #    IGCM_sys_Cp ${1} ${FILEPATH}
+    #fi
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+
+    exist=false
+    skip=false
+    if [ -f $2 ] ; then
+      IGCM_debug_Print 1 "$2 already exist"
+      dmget $2
+      exist=true
+      if [ "X$( diff $1 $2 )" = X ] ; then
+	IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
+	skip=true
+      else
+	IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
 	skip=false
-	if [ -f $2 ] ; then
-	    IGCM_debug_Print 1 "$2 already exist"
-	    dmget $2
-	    exist=true
-	    if [ "X$( diff $1 $2 )" = X ] ; then
-		IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
-		skip=true
-	    else
-		IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
-		skip=false
-	    fi
-	fi
-        # 
-	if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
-	    IGCM_sys_Chmod u+w $2
-	fi
-	# USUAL WAY
-	if [ X${skip} = Xfalse ] ; then
-	    \cp $1 $2 > out_rsync 2>&1
-            RET=$?
-	    if [ ${RET} -gt 0 ] ; then
-		echo "IGCM_sys_Put_Out : error."
-		cat out_rsync
-		IGCM_debug_Exit "IGCM_sys_Put_Out"
-	    else
-		\rm out_rsync
-	    fi
-	fi
-
-# 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+      fi
+    fi
+    # 
+    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
+      IGCM_sys_Chmod u+w $2
+    fi
+    # USUAL WAY
+    if [ X${skip} = Xfalse ] ; then
+      \cp $1 $2 > out_rsync 2>&1
+      RET=$?
+      if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Put_Out : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Put_Out"
+      else
+	\rm out_rsync
+      fi
+    fi
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -985,9 +1068,54 @@
 #  	(( RET=RET+$? ))
 
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Out"
+  return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Out
+#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Out {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_Mkdir $( dirname $2 )
+    #
+    typeset RET
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-    return 0
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+  return 0
 }
 
@@ -998,90 +1126,88 @@
 #D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
 function IGCM_sys_Get {
-    IGCM_debug_PushStack "IGCM_sys_Get" $@
-
-    typeset DEST RET dm_liste ifile target file_work 
-
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get :" $@
-    fi
-    if [ $DRYRUN -le 2 ]; then
-	if [ X${1} = X'/l' ] ; then
-            # test if the first file is present in the old computation :
-	    eval set +A dm_liste \${${2}}
-	else
-	    eval set +A dm_liste ${1}
-	fi
-	eval DEST=\${${#}}
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	# Is it an R_OUT file (not R_IN) ?
-	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    # Yes  ? then we try to get it in SCRATCHDIR
-	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
-	#    if [ -f ${file_work[0]} ] ; then
-	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
-	#	IGCM_debug_PopStack "IGCM_sys_Get"
-	#	return
-	#    fi
-	#fi
-
-	# test if the (first) file is present in the old computation :
-	IGCM_sys_TestFileArchive ${dm_liste[0]}
-	RET=$?
-        if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	fi
-
-	dmget ${dm_liste[*]} > out_rsync 2>&1
-	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "WARNING IGCM_sys_Get : demigration error."
-	    cat out_rsync
-	    echo "WARNING IGCM_sys_Get : will later stop if the cp fails."
-	fi
-
-	#if [ ${RET} -gt 0 ] ; then
-	#    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
-	#	cat out_rsync
-	#	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
-	#	sleep 30
-	#	echo "We try another time"
-	#	dmget ${dm_liste[*]} > out_rsync 2>&1
-	#	RET=$?
-	#	if [ ${RET} -gt 0 ] ; then
-	#	    echo "ERROR IGCM_sys_Get : again demigration error :"
-	#	    cat out_rsync
-	#	    IGCM_debug_Exit "IGCM_sys_Get"
-	#	fi
-	#    else
-	#	echo "ERROR IGCM_sys_Get : demigration error :"
-	#	cat out_rsync
-	#	IGCM_debug_Exit "IGCM_sys_Get"
-	#    fi
-	#fi
-
-        #USUAL WAY
-	(( RET=0 ))
-	if [ X${1} = X'/l' ] ; then
-	    (( RET=0 ))
-	    for target in ${dm_liste[*]} ; do
-		local_file=$( basename ${target} )
-		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-		(( RET = RET + $? ))
-	    done
-	else
-	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-	    RET=$?
-	fi
-
-# 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+  IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+  typeset DEST RET dm_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A dm_liste \${${2}}
+    else
+      eval set +A dm_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    # Is it an R_OUT file (not R_IN) ?
+    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    # Yes  ? then we try to get it in SCRATCHDIR
+    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )
+    #    if [ -f ${file_work[0]} ] ; then
+    #	IGCM_sys_Cp ${file_work[*]} ${DEST}
+    #	IGCM_debug_PopStack "IGCM_sys_Get"
+    #	return
+    #    fi
+    #fi
+
+    # test if the (first) file is present in the old computation :
+    IGCM_sys_TestFileArchive ${dm_liste[0]}
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Get"
+    fi
+
+    dmget ${dm_liste[*]} > out_rsync 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : demigration error."
+      cat out_rsync
+      echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
+    fi
+
+    #if [ ${RET} -gt 0 ] ; then
+    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
+    #	cat out_rsync
+    #	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
+    #	sleep 30
+    #	echo "We try another time"
+    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #	RET=$?
+    #	if [ ${RET} -gt 0 ] ; then
+    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
+    #	    cat out_rsync
+    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #	fi
+    #    else
+    #	echo "ERROR IGCM_sys_Get : demigration error :"
+    #	cat out_rsync
+    #	IGCM_debug_Exit "IGCM_sys_Get"
+    #    fi
+    #fi
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${dm_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1095,15 +1221,90 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get : copy error."
-	    cat out_rsync
-#	    IGCM_debug_Exit "IGCM_sys_Get"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get : copy error."
+      cat out_rsync
+#      IGCM_debug_Exit "IGCM_sys_Get"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichWork :" $@
+  fi
+  # donne la date filesys d'un fichier sur la machine work
+  IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichArchive :" $@
+  fi
+  IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
 
@@ -1114,18 +1315,18 @@
 #D-
 function IGCM_sys_Dods_Rm {
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Dods_Rm :" $@
-    fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
-	dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
-	RET=$?
-        
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Rm :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+    RET=$?
+    
 #	if [ ${RET} -gt 0 ] ; then
 #	    echo "IGCM_sys_Dods_Rm : error."
@@ -1136,10 +1337,9 @@
 #	fi
 
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
-}
-
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
+}
 
 #D-#==================================================
@@ -1149,19 +1349,19 @@
 #D-
 function IGCM_sys_Dods_Cp {
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Dods_Cp :" $@
-    fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
-	#
-	dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
-	RET=$?
-        
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Cp :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    #
+    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+    RET=$?
+
 # 	if [ ${RET} -gt 0 ] ; then
 # 	    echo "IGCM_sys_Dods_Cp : error."
@@ -1172,8 +1372,8 @@
 # 	fi
 
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
 }
 
@@ -1184,59 +1384,30 @@
 #D-
 function IGCM_sys_Put_Dods {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dods :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
-	    return
-	fi
-
-	typeset RET
+  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dods :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+
+    typeset RET
 	#
-	cd ${R_SAVE}
-	IGCM_sys_Dods_Rm ${1}
-	IGCM_sys_Dods_Cp ${1}
-	RET=0
-        
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dods : error."
-	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
-}
-
-############################################################## A FINIR !!
-
-#D-#==================================================
-#D-function IGCM_sys_GetDate_FichWork
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
-#D-* Examples:
-#D-
-function IGCM_sys_GetDate_FichWork {
-    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichWork :" $@
-    fi
-    # donne la date filesys d'un fichier sur la machine work
-    IGCM_debug_PopStack "IGCM_sys_FichWork"
-}
-
-#D-#==================================================
-#D-function IGCM_sys_GetDate_FichArchive
-#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
-#D-* Examples:
-#D-
-function IGCM_sys_GetDate_FichArchive {
-    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichArchive :" $@
-    fi
-    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+    cd ${R_SAVE}
+    IGCM_sys_Dods_Rm ${1}
+    IGCM_sys_Dods_Cp ${1}
+    RET=0
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dods : error."
+      IGCM_debug_Exit "IGCM_sys_Put_Dods"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
 }
 
@@ -1245,15 +1416,15 @@
 
 function IGCM_sys_rebuild {
-    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_rebuild :" $@
-    fi
-    /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_rebuild : erreur ${@}."
-       IGCM_debug_Exit "rebuild"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_rebuild"
+  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_rebuild :" $@
+  fi
+  /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_rebuild : erreur ${@}."
+    IGCM_debug_Exit "rebuild"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_rebuild"
 }
 
@@ -1262,183 +1433,183 @@
 
 function IGCM_sys_ncap2 {
-    IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncap2 :" $@
-    fi
-    ncap2 "$@"
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncap2 : erreur ${@}."
-       IGCM_debug_Exit "ncap2"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncap2"
+  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncap2 :" $@
+  fi
+  ncap2 "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncap2 : erreur ${@}."
+    IGCM_debug_Exit "ncap2"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncap2"
 }
 
 function IGCM_sys_ncatted {
-    IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncatted :" $@
-    fi
-    ncatted "$@"
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncatted : erreur ${@}."
-       IGCM_debug_Exit "ncatted"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncatted"
+  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncatted :" $@
+  fi
+  ncatted "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncatted : erreur ${@}."
+    IGCM_debug_Exit "ncatted"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncatted"
 }
 
 function IGCM_sys_ncbo {
-    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncbo :" $@
-    fi
-    ncbo $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncbo : erreur ${@}."
-       IGCM_debug_Exit "ncbo"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncbo"
+  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncbo :" $@
+  fi
+  ncbo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncbo : erreur ${@}."
+    IGCM_debug_Exit "ncbo"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncbo"
 }
 
 function IGCM_sys_ncdiff {
-    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncdiff :" $@
-    fi
-    ncdiff $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncdiff : erreur ${@}."
-       IGCM_debug_Exit "ncdiff"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncdiff :" $@
+  fi
+  ncdiff $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncdiff : erreur ${@}."
+    IGCM_debug_Exit "ncdiff"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncdiff"
 }
 
 function IGCM_sys_ncea {
-    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncea :" $@
-    fi
-    ncea $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncea : erreur ${@}."
-       IGCM_debug_Exit "ncea"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncea"
+  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncea :" $@
+  fi
+  ncea $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncea : erreur ${@}."
+    IGCM_debug_Exit "ncea"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncea"
 }
 
 function IGCM_sys_ncecat {
-    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncecat :" $@
-    fi
-    ncecat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncecat : erreur ${@}."
-       IGCM_debug_Exit "ncecat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncecat"
+  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncecat :" $@
+  fi
+  ncecat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncecat : erreur ${@}."
+    IGCM_debug_Exit "ncecat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncecat"
 }
 
 function IGCM_sys_ncflint {
-    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncflint :" $@
-    fi
-    ncflint $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncflint : erreur ${@}."
-       IGCM_debug_Exit "ncflint"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncflint"
+  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncflint :" $@
+  fi
+  ncflint $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncflint : erreur ${@}."
+    IGCM_debug_Exit "ncflint"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncflint"
 }
 
 function IGCM_sys_ncks {
-    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncks :" $@
-    fi
-    ncks $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncks : erreur ${@}."
-       IGCM_debug_Exit "ncks"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncks"
+  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncks :" $@
+  fi
+  ncks $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncks : erreur ${@}."
+    IGCM_debug_Exit "ncks"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncks"
 }
 
 function IGCM_sys_ncpdq {
-    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncpdq :" $@
-    fi
-    ncpdq $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncpdq : erreur ${@}."
-       IGCM_debug_Exit "ncpdq"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncpdq :" $@
+  fi
+  ncpdq $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncpdq : erreur ${@}."
+    IGCM_debug_Exit "ncpdq"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncpdq"
 }
 
 function IGCM_sys_ncra {
-    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncra :" $@
-    fi
-    ncra $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncra : erreur ${@}."
-       IGCM_debug_Exit "ncra"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncra"
+  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncra :" $@
+  fi
+  ncra $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncra : erreur ${@}."
+    IGCM_debug_Exit "ncra"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncra"
 }
 
 function IGCM_sys_ncrcat {
-    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrcat :" $@
-    fi
-    ncrcat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrcat : erreur ${@}."
+  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrcat :" $@
+  fi
+  ncrcat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrcat : erreur ${@}."
 #       IGCM_debug_Exit "ncrcat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrcat"
 }
 
 function IGCM_sys_ncrename {
-    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrename :" $@
-    fi
-    ncrename $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrename : erreur ${@}."
-       IGCM_debug_Exit "ncrename"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrename"
+  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrename :" $@
+  fi
+  ncrename $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrename : erreur ${@}."
+    IGCM_debug_Exit "ncrename"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrename"
 }
 
 function IGCM_sys_ncwa {
-    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncwa :" $@
-    fi
-    ncwa $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncwa : erreur ${@}."
-       IGCM_debug_Exit "ncwa"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncwa"
+  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncwa :" $@
+  fi
+  ncwa $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncwa : erreur ${@}."
+    IGCM_debug_Exit "ncwa"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncwa"
 }
 
@@ -1447,17 +1618,19 @@
 
 function IGCM_sys_cdo {
-    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
-
-    \cdo $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_cdo : erreur ${@}."
-       IGCM_debug_PopStack "IGCM_sys_cdo"
-       return 1
-    else
-	IGCM_debug_PopStack "IGCM_sys_cdo"
-	return 0
-    fi
-
+  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_cdo :" $@
+  fi
+  \cdo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_cdo : erreur ${@}."
     IGCM_debug_PopStack "IGCM_sys_cdo"
+    return 1
+  else
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+    return 0
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_cdo"
 }
 
@@ -1466,9 +1639,9 @@
 
 function IGCM_sys_activ_variables {
-    IGCM_debug_PushStack "IGCM_sys_activ_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_activ_variables"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+  IGCM_debug_PushStack "IGCM_sys_activ_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_activ_variables"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_activ_variables"
 }
 
@@ -1477,9 +1650,9 @@
 
 function IGCM_sys_desactiv_variables {
-    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_desactiv_variables"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_desactiv_variables"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
 }
 
@@ -1488,8 +1661,8 @@
 
 function IGCM_sys_build_run_file {
-    IGCM_debug_PushStack "IGCM_sys_build_run_file"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_build_run_file"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_build_run_file"
-}
+  IGCM_debug_PushStack "IGCM_sys_build_run_file"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_build_run_file"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 571)
@@ -83,5 +83,5 @@
 typeset -r RSYNC_opt="-va"
 # ie storage filesystem
-typeset -r RHOST=mercure
+typeset -r STOREHOST=${MASTER}
 
 #====================================================
@@ -133,10 +133,18 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
 #====================================================
-#- OUT
+#- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_BUF (ONLY FOR double copy an scratch)
+typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -149,8 +157,4 @@
 
 #====================================================
-#- BIG_DIR : BIG_DIR to store files waiting for rebuild
-typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
-
-#====================================================
 #- HOST_MPIRUN_COMMAND
 typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
@@ -161,4 +165,25 @@
 
 #D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Connection to frontend machine.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+  ssh -t ${MASTER} /bin/ksh <<-EOF
+  export libIGCM=${libIGCM}
+  export DEBUG_debug=${DEBUG_debug}
+  . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+  . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+  ${@}
+EOF
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshMaster : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshMaster"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_RshArchive
 #D-* Purpose: Archive rsh command
@@ -166,13 +191,13 @@
 #D-
 function IGCM_sys_RshArchive {
-    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    /bin/ksh <<-EOF
-${@}
+  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+  /bin/ksh <<-EOF
+    ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshArchive : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshArchive"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshArchive"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshArchive"
 }
 
@@ -183,35 +208,49 @@
 #D-
 function IGCM_sys_RshPost {
-    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RshPost :" $@
-    fi
+  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RshPost :" $@
+  fi
+
+  #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL
+  #cat tmp_IGCM_sys_RshPost_$$
+  # keep standard input (stdin) for the loop onto temporary file
+  cat >tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND START ============ #
+
+  /bin/ksh <tmp_IGCM_sys_RshPost_$$
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshPost : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshPost"
+  fi
+  \rm tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND  END  ============ #
 
 # ============ CESIUM START ============ #
-#    typeset NB_ESSAI DELAI status
-#    #nombre d'essai avant abandon
-#    NB_ESSAI=5
-#    #temps entre chaque essai
-#    DELAI=10
-#    i=0
-#    while [ $i -ne $NB_ESSAI ] ; do
-#        ssh -t mercure ssh cesium /bin/ksh ${@} 2>/dev/null
-#        status=$?
-#        if [ ${status} -ne 0 ];
-#        then
-#            sleep $DELAI
-#        else
-#            break
-#        fi
-#        let i=$i+1
-#    done 
+#  typeset NB_ESSAI DELAI status i
+#  # number of tentative
+#  NB_ESSAI=10
+#  # time delay between tentative
+#  DELAI=10
+#  (( i = 0 ))
+#  while [ $i -lt $NB_ESSAI ] ; do
+#    ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+#    status=$?
+#    if [ ${status} -gt 0 ]; then
+#      IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}"
+#      IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again."
+#      sleep $DELAI
+#    else
+#      break
+#    fi
+#    (( i = i + 1 ))
+#  done 
+#  # delete temporary file
+#  /bin/rm tmp_IGCM_sys_RshPost_$$
 # ============ CESIUM  END  ============ #
 
-    /bin/ksh ${@}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshPost : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshPost"
+  IGCM_debug_PopStack "IGCM_sys_RshPost"
 }
 
@@ -222,28 +261,27 @@
 #D-
 function IGCM_sys_SendMail {
-    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_SendMail :" $@
-    fi
-
-    if ( ${ExitFlag} ) ; then
-	status=failed
-	# Nothing fo now
-    else
-	status=completed
-    fi
-
-    ssh ${MASTER} /bin/ksh <<-EOF
-    export LOGIN=${LOGIN}
-    export config_UserChoices_JobName=${config_UserChoices_JobName}
-    export config_UserChoices_MailName=${config_UserChoices_MailName}
-    export DateBegin=${DateBegin}
-    export DateEnd=${DateEnd}
-    export R_SAVE=${R_SAVE}
-    export SUBMIT_DIR=${SUBMIT_DIR}
-    export status=${status}
-
-    cat  << END_MAIL > job_end.mail
-Dear ${LOGIN},
+  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_SendMail :" $@
+  fi
+
+  if ( ${ExitFlag} ) ; then
+    status=failed
+  else
+    status=completed
+  fi
+
+  ssh ${MASTER} /bin/ksh <<-EOF
+  export LOGIN=${LOGIN}
+  export config_UserChoices_JobName=${config_UserChoices_JobName}
+  export config_UserChoices_MailName=${config_UserChoices_MailName}
+  export DateBegin=${DateBegin}
+  export DateEnd=${DateEnd}
+  export R_SAVE=${R_SAVE}
+  export SUBMIT_DIR=${SUBMIT_DIR}
+  export status=${status}
+
+  cat  << END_MAIL > job_end.mail
+  Dear ${LOGIN},
 
   Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`.
@@ -254,19 +292,19 @@
 END_MAIL
 
-    if [ ! -z ${config_UserChoices_MailName} ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
-    elif [ -f ~/.forward ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
-    fi
-
-    sleep 10
-    rm -f job_end.mail
+  if  [ X"${config_UserChoices_MailName}" != X ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
+  elif [ -f ~/.forward ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
+  fi
+
+  sleep 10
+  rm -f job_end.mail
 EOF
 
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_SendMail : erreur."
-	IGCM_debug_Exit "IGCM_sys_SendMail"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_SendMail"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_SendMail : erreur."
+    IGCM_debug_Exit "IGCM_sys_SendMail"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_SendMail"
 }
 
@@ -277,21 +315,21 @@
 #D-
 function IGCM_sys_Mkdir {
-    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mkdir :" $@
-    fi
-    if [ ! -d ${1} ]; then
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Mkdir : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Mkdir"
-	fi
-    fi
-    # vérification :
-    if [ ! -d ${1} ] ; then
-	echo "IGCM_sys_Mkdir : erreur."
-	IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mkdir :" $@
+  fi
+  if [ ! -d ${1} ]; then
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Mkdir : erreur."
+      IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+  fi
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_Mkdir : erreur."
+    IGCM_debug_Exit "IGCM_sys_Mkdir"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mkdir"
 }
 
@@ -302,17 +340,17 @@
 #D-
 function IGCM_sys_MkdirArchive {
-    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirArchive :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirArchive : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirArchive :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirArchive : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
 }
 
@@ -323,17 +361,17 @@
 #D-
 function IGCM_sys_MkdirWork {
-    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirWork :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirWork : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirWork :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirWork : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
 }
 
@@ -344,14 +382,14 @@
 #D-
 function IGCM_sys_Cd {
-    IGCM_debug_PushStack "IGCM_sys_Cd" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cd :" $@
-    fi
-    \cd $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Cd : erreur."
-	IGCM_debug_Exit "IGCM_sys_Cd"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cd"
+  IGCM_debug_PushStack "IGCM_sys_Cd" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cd :" $@
+  fi
+  \cd $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Cd : erreur."
+    IGCM_debug_Exit "IGCM_sys_Cd"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cd"
 }
 
@@ -362,18 +400,18 @@
 #D-
 function IGCM_sys_Chmod {
-    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Chmod :" $@
-    fi
-    if [ $DRYRUN -le 1 ]; then
-	\chmod $@
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Chmod : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Chmod"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Chmod"
+  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Chmod :" $@
+  fi
+  if [ $DRYRUN -le 1 ]; then
+    \chmod $@
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Chmod : erreur."
+      IGCM_debug_Exit "IGCM_sys_Chmod"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Chmod"
 }
 
@@ -384,14 +422,14 @@
 #D-
 function IGCM_sys_FileSize {
-    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
-
-    typeset sizeF
-    set +A sizeF -- $( ls -la ${1} )
-    if [ $? -gt 0 ] ; then
-	IGCM_debug_Exit "IGCM_sys_FileSize"
-    fi
-    eval ${2}=${sizeF[4]}
-
-    IGCM_debug_PopStack "IGCM_sys_FileSize"
+  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+  typeset sizeF
+  set +A sizeF -- $( ls -la ${1} )
+  if [ $? -gt 0 ] ; then
+    IGCM_debug_Exit "IGCM_sys_FileSize"
+  fi
+  eval ${2}=${sizeF[4]}
+
+  IGCM_debug_PopStack "IGCM_sys_FileSize"
 }
 
@@ -402,13 +440,13 @@
 #D-
 function IGCM_sys_TestDir {
-    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDir :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDir"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDir :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+  return ${ExistFlag}
 }
 
@@ -419,13 +457,30 @@
 #D-
 function IGCM_sys_TestDirArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDirArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDirArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/dmnfs ) != X ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
 }
 
@@ -436,10 +491,27 @@
 #D-
 function IGCM_sys_TestFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
-    typeset ExistFlag
-    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestFileArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
 }
 
@@ -450,10 +522,24 @@
 #D-
 function IGCM_sys_CountFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
-    ls ${@} 2>/dev/null | wc -l
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_CountFileArchive : erreur."
-    fi
-    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileArchive : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
 }
 
@@ -464,30 +550,30 @@
 #D-
 function IGCM_sys_Tree {
-    IGCM_debug_PushStack "IGCM_sys_Tree" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tree :" $@
-    fi
-
-    \ls -lR ${@}
-
-    IGCM_debug_PopStack "IGCM_sys_Tree"
+  IGCM_debug_PushStack "IGCM_sys_Tree" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tree :" $@
+  fi
+
+  \ls -lR ${@}
+
+  IGCM_debug_PopStack "IGCM_sys_Tree"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Tar
-#D-* Purpose: master un-tar command
+#D-* Purpose: master tar command
 #D-* Examples:
 #D-
 function IGCM_sys_Tar {
-    IGCM_debug_PushStack "IGCM_sys_Tar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Tar : erreur."
-	IGCM_debug_Exit "IGCM_sys_Tar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Tar"
+  IGCM_debug_PushStack "IGCM_sys_Tar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tar :" $@
+  fi
+  \tar cf $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Tar : erreur."
+    IGCM_debug_Exit "IGCM_sys_Tar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Tar"
 }
 
@@ -498,14 +584,14 @@
 #D-
 function IGCM_sys_UnTar {
-    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_UnTar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_UnTar : erreur."
-	IGCM_debug_Exit "IGCM_sys_UnTar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_UnTar"
+  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_UnTar :" $@
+  fi
+  \tar xvf $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_UnTar : erreur."
+    IGCM_debug_Exit "IGCM_sys_UnTar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_UnTar"
 }
 
@@ -516,14 +602,14 @@
 #D-
 function IGCM_sys_Qsub {
-    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Qsub :" $@
-    fi
-    /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
-	IGCM_debug_Exit "IGCM_sys_Qsub"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Qsub"
+  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Qsub :" $@
+  fi
+  /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+    IGCM_debug_Exit "IGCM_sys_Qsub"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Qsub"
 }
 
@@ -534,17 +620,41 @@
 #D-
 function IGCM_sys_QsubPost {
-    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_QsubPost :" $@
-    fi
-    # ============ CESIUM START ============ #
-    #/usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
-    # ============ CESIUM  END  ============ #
-    /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_QsubPost : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_QsubPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_QsubPost :" $@
+  fi
+
+# ============ FRONTEND START ============ #
+
+  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+
+# ============ FRONTEND  END  ============ #
+
+# ============ CESIUM START ============ #
+
+#  typeset NB_ESSAI DELAI status i
+#  # number of tentative
+#  NB_ESSAI=10
+#  # time delay between tentative
+#  DELAI=10
+#  (( i = 0 ))
+#  while [ $i -lt $NB_ESSAI ] ; do
+#    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+#    status=$?
+#    if [ ${status} -gt 0 ]; then
+#      sleep $DELAI
+#    else
+#      break
+#    fi
+#    (( i = i + 1 ))
+#  done 
+
+# ============ CESIUM  END  ============ #
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_QsubPost : erreur " $@
+    IGCM_debug_Exit "IGCM_sys_QsubPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
 
@@ -560,108 +670,107 @@
 #D-  Error values and explanations can depend on your system version.
 function IGCM_sys_Rsync_out {
-    RET=$1
-    if [ ! $RET ] ; then
-	echo "rsync error !"
-    fi
-
-    if [ $MYLANG = "fr" ]; then
-	case $RET in
-	    0)  return ;;
-	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
-		echo "Erreur de syntaxe ou d'utilisation."
-		return;;
-	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
-		echo "Incompatibilité de protocole."
-		return;;
-	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
-		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
-		echo "répertoires"
-		return;;
-	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
-		echo "Action demandée non supportée : une tentative de manipulation de"
-		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
-		echo "été faite ; ou une option qui est supportée par le  client  mais"
-		echo "pas par le serveur a été spécifiée."
-		return;;
-	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
-		echo "Erreur dans le socket d'entrée sortie"
-		return;;
-	    11) echo "Erreur de rsync ; RERR_FILEIO"
-		echo "Erreur d'entrée sortie fichier"
-		return;;
-	    12) echo "Erreur de rsync ; RERR_STREAMIO"
-		echo "Erreur dans flux de donnée du protocole rsync"
-		return;;
-	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
-		echo "Erreur avec les diagnostics du programme"
-		return;;
-	    14) echo "Erreur de rsync ; RERR_IPC"
-		echo "Erreur dans le code IPC"
-		return;;
-	    20) echo "Erreur de rsync ; RERR_SIGNAL"
-		echo "SIGUSR1 ou SIGINT reçu"
-		return;;
-	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
-		echo "Une erreur retournée par waitpid()"
-		return;;
-	    22) echo "Erreur de rsync ; RERR_MALLOC"
-		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
-		return;;
-	    23) echo ""
-                echo "Erreur fichier inexistant"
-		return;;
-	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
-		echo "Temps d'attente écoulé dans l'envoi/réception de données"
-		return;;
-	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
-		return;;
-	esac
-    elif [ $MYLANG = "en" ] ; then
-	case $RET in
-	    0)  return;;		
-	    1)  echo "rsync error : Syntax or usage error "
-		return;;
-	    2)  echo "rsync error : Protocol incompatibility "
-		return;;
-	    3)  echo "rsync error : Errors selecting input/output files, dirs"
-		return;;
-	    4)  echo "rsync error : Requested action not supported: an attempt"
-		echo "was made to manipulate 64-bit files on a platform that cannot support"
-		echo "them; or an option was specified that is supported by the client and"
-		echo "not by the server."
-		return;;
-	    5)  echo "rsync error : Error starting client-server protocol"
-		return;;
-	    10) echo "rsync error : Error in socket I/O "
-		return;;
-	    11) echo "rsync error : Error in file I/O "
-		return;;
-	    12) echo "rsync error : Error in rsync protocol data stream "
-		return;;
-	    13) echo "rsync error : Errors with program diagnostics "
-		return;;
-	    14) echo "rsync error : Error in IPC code "
-		return;;
-	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
-		return;;
-	    21) echo "rsync error : Some error returned by waitpid() "
-		return;;
-	    22) echo "rsync error : Error allocating core memory buffers "
-		return;;
-	    23) echo "rsync error : Partial transfer due to error"
-		return;;
-	    24) echo "rsync error : Partial transfer due to vanished source files"
-		return;;
-	    30) echo "rsync error : Timeout in data send/receive "
-		return;;
-	    *)  echo "rsync error : return code of rsync unknown :" $RET
-		return;;
-	esac
-    else
-	echo "unknown language $MYLANG."
-	return
-    fi
-}
-    
+  RET=$1
+  if [ ! $RET ] ; then
+    echo "rsync error !"
+  fi
+
+  if [ $MYLANG = "fr" ]; then
+    case $RET in
+    0)  return ;;
+    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+      echo "Erreur de syntaxe ou d'utilisation."
+      return;;
+    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+      echo "Incompatibilité de protocole."
+      return;;
+    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+      echo "répertoires"
+      return;;
+    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+      echo "Action demandée non supportée : une tentative de manipulation de"
+      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+      echo "été faite ; ou une option qui est supportée par le  client  mais"
+      echo "pas par le serveur a été spécifiée."
+      return;;
+    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+      echo "Erreur dans le socket d'entrée sortie"
+      return;;
+    11) echo "Erreur de rsync ; RERR_FILEIO"
+      echo "Erreur d'entrée sortie fichier"
+      return;;
+    12) echo "Erreur de rsync ; RERR_STREAMIO"
+      echo "Erreur dans flux de donnée du protocole rsync"
+      return;;
+    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+      echo "Erreur avec les diagnostics du programme"
+      return;;
+    14) echo "Erreur de rsync ; RERR_IPC"
+      echo "Erreur dans le code IPC"
+      return;;
+    20) echo "Erreur de rsync ; RERR_SIGNAL"
+      echo "SIGUSR1 ou SIGINT reçu"
+      return;;
+    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+      echo "Une erreur retournée par waitpid()"
+      return;;
+    22) echo "Erreur de rsync ; RERR_MALLOC"
+      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+      return;;
+    23) echo ""
+      echo "Erreur fichier inexistant"
+      return;;
+    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+      echo "Temps d'attente écoulé dans l'envoi/réception de données"
+      return;;
+    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+      return;;
+    esac
+  elif [ $MYLANG = "en" ] ; then
+    case $RET in
+    0)  return;;		
+    1)  echo "rsync error : Syntax or usage error "
+      return;;
+    2)  echo "rsync error : Protocol incompatibility "
+      return;;
+    3)  echo "rsync error : Errors selecting input/output files, dirs"
+      return;;
+    4)  echo "rsync error : Requested action not supported: an attempt"
+      echo "was made to manipulate 64-bit files on a platform that cannot support"
+      echo "them; or an option was specified that is supported by the client and"
+      echo "not by the server."
+      return;;
+    5)  echo "rsync error : Error starting client-server protocol"
+      return;;
+    10) echo "rsync error : Error in socket I/O "
+      return;;
+    11) echo "rsync error : Error in file I/O "
+      return;;
+    12) echo "rsync error : Error in rsync protocol data stream "
+      return;;
+    13) echo "rsync error : Errors with program diagnostics "
+      return;;
+    14) echo "rsync error : Error in IPC code "
+      return;;
+    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+      return;;
+    21) echo "rsync error : Some error returned by waitpid() "
+      return;;
+    22) echo "rsync error : Error allocating core memory buffers "
+      return;;
+    23) echo "rsync error : Partial transfer due to error"
+      return;;
+    24) echo "rsync error : Partial transfer due to vanished source files"
+      return;;
+    30) echo "rsync error : Timeout in data send/receive "
+      return;;
+    *)  echo "rsync error : return code of rsync unknown :" $RET
+      return;;
+    esac
+  else
+    echo "unknown language $MYLANG."
+    return
+  fi
+}
 
 #D-#==================================================
@@ -671,22 +780,22 @@
 #D-
 function IGCM_sys_Mirror_libIGCM {
-    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mirror_libIGCM"
-    fi
-
-    typeset RET DEST
-
-    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
-
-    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
-    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
-	cat out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mirror_libIGCM"
+  fi
+
+  typeset RET DEST
+
+  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+    cat out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
 }
 
@@ -694,5 +803,5 @@
 #- Call IGCM_sys_Mirror_libIGCM now !
 if ( $MirrorlibIGCM ) ; then
-    IGCM_sys_Mirror_libIGCM
+  IGCM_sys_Mirror_libIGCM
 fi
 
@@ -703,23 +812,23 @@
 #D-
 function IGCM_sys_Cp {
-    IGCM_debug_PushStack "IGCM_sys_Cp" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cp :" $@
-    fi
-
-    typeset RET
-
-    echo cp $@ > out_rsync 2>&1
-    \cp $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Cp : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Cp"
-     else
-	 \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cp"
+  IGCM_debug_PushStack "IGCM_sys_Cp" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cp :" $@
+  fi
+
+  typeset RET
+
+  echo cp $@ > out_rsync 2>&1
+  \cp $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Cp"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cp"
 }
 
@@ -730,23 +839,23 @@
 #D-
 function IGCM_sys_Rm {
-    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Rm :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Rm : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Rm"
-    else
-	\rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Rm"
+  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Rm :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Rm"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Rm"
 }
 
@@ -757,29 +866,29 @@
 #D-
 function IGCM_sys_Mv {
-    IGCM_debug_PushStack "IGCM_sys_Mv" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mv :" $@
-    fi
-
-    if [ $DRYRUN = 0 ]; then
-
-        typeset RET
-            
-        echo mv $@ > out_rsync 2>&1
-        \mv $@ >> out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Mv" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mv :" $@
+  fi
+
+  if [ $DRYRUN = 0 ]; then
+
+    typeset RET
     
-        if [ ${RET} -gt 0 ] ; then
-            echo "IGCM_sys_Mv : error in mv."
-            cat out_rsync
-            IGCM_debug_Exit "IGCM_sys_Mv"
-	else
-	    \rm out_rsync
-        fi
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error in mv."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Mv"
     else
-        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_Mv"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_Mv"
 }
 
@@ -790,108 +899,109 @@
 #D-
 function IGCM_sys_Put_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      return
+    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Get_Dir
-#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Purpose: Copy a complete directory from ${ARCHIVE}
 #D-* Examples:
 #D-
 function IGCM_sys_Get_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+#    if [ ! -d ${1} ] ; then
+#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+#      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+#      return
+#    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    # USUAL WAY
+    # add dmfind/dmget (to demigrate all offline files) :
+    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Rest
-#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-* Purpose: Put computied restarts on ${ARCHIVE}.
 #D-           File and target directory must exist.
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Rest {
-    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Rest :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	fi
-
-	typeset RET
-	#
-	if [ X${JobType} = XRUN ] ; then
-	    IGCM_sys_Chmod 444 ${1}
-	fi
-	#
-	IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	# USUAL WAY
-	putfer $1 $2 > out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -905,65 +1015,106 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Rest : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Rest
+#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Rest {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Out
-#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Out {
-    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Out :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-	    return 1
-	fi
-	#
-	IGCM_sys_MkdirArchive $( dirname $2 )
-        #
-	typeset RET
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    typeset WORKPATH FILEPATH
-	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    IGCM_sys_MkdirWork ${WORKPATH} 
-	#    FILEPATH=${WORKPATH}/$( basename $2 )
-        #    #
-	#    IGCM_sys_Cp ${1} ${FILEPATH}
-	#fi
-
-	if [ X${JobType} = XRUN ] ; then
-	    if [ X${3} = X ] ; then
-		IGCM_sys_Chmod 444 ${1}
-	    fi
-	fi
-	#
-        # USUAL WAY
-	putfer $1 $2 > out_rsync 2>&1
-	RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_MkdirArchive $( dirname $2 )
+    #
+    typeset RET
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    typeset WORKPATH FILEPATH
+    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
+    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    FILEPATH=${WORKPATH}/$( basename $2 )
+    #    #
+    #    IGCM_sys_Cp ${1} ${FILEPATH}
+    #fi
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -977,16 +1128,61 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Out : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Out"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Out"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-    return 0
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Out"
+  return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Out
+#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Out {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_Mkdir $( dirname $2 )
+    #
+    typeset RET
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+  return 0
 }
 
@@ -997,70 +1193,88 @@
 #D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
 function IGCM_sys_Get {
-    IGCM_debug_PushStack "IGCM_sys_Get" $@
-
-    typeset DEST RET dm_liste ifile target file_work 
-
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get :" $@
-    fi
-    if [ $DRYRUN -le 2 ]; then
-	if [ X${1} = X'/l' ] ; then
-            # test if the first file is present in the old computation :
-	    eval set +A dm_liste \${${2}}
-	else
-	    eval set +A dm_liste ${1}
-	fi
-	eval DEST=\${${#}}
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	# Is it an R_OUT file (not R_IN) ?
-	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    # Yes  ? then we try to get it in SCRATCHDIR
-	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    if [ -f ${file_work[0]} ] ; then
-	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
-	#	IGCM_debug_PopStack "IGCM_sys_Get"
-	#	return
-	#    fi
-	#fi
-
-	# test if the (first) file is present in the old computation :
-	IGCM_sys_TestFileArchive ${dm_liste[0]}
-	RET=$?
-        if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	    IGCM_debug_PopStack "IGCM_sys_Get"
-	    return
-	fi
-
-	dmget ${dm_liste[*]} > out_rsync 2>&1
-  	RET=$?
-  	if [ ${RET} -gt 0 ] ; then
-  	    echo "IGCM_sys_Get : demigration error."
-  	    cat out_rsync
-  	    IGCM_debug_Exit "IGCM_sys_Get"
-  	fi
-
-        #USUAL WAY
-	if [ X${1} = X'/l' ] ; then
-	    (( RET=0 ))
-	    for target in ${dm_liste[*]} ; do
-		local_file=$( basename ${target} )
-		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-		(( RET = RET + $? ))
-	    done
-	else
-	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-	    RET=$?
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+  typeset DEST RET dm_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A dm_liste \${${2}}
+    else
+      eval set +A dm_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    # Is it an R_OUT file (not R_IN) ?
+    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    # Yes  ? then we try to get it in SCRATCHDIR
+    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )
+    #    if [ -f ${file_work[0]} ] ; then
+    #	IGCM_sys_Cp ${file_work[*]} ${DEST}
+    #	IGCM_debug_PopStack "IGCM_sys_Get"
+    #	return
+    #    fi
+    #fi
+
+    # test if the (first) file is present in the old computation :
+    IGCM_sys_TestFileArchive ${dm_liste[0]}
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Get"
+    fi
+
+    dmget ${dm_liste[*]} > out_rsync 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : demigration error."
+      cat out_rsync
+      echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
+    fi
+
+    #if [ ${RET} -gt 0 ] ; then
+    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
+    #	cat out_rsync
+    #	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
+    #	sleep 30
+    #	echo "We try another time"
+    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #	RET=$?
+    #	if [ ${RET} -gt 0 ] ; then
+    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
+    #	    cat out_rsync
+    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #	fi
+    #    else
+    #	echo "ERROR IGCM_sys_Get : demigration error :"
+    #	cat out_rsync
+    #	IGCM_debug_Exit "IGCM_sys_Get"
+    #    fi
+    #fi
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${dm_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1074,18 +1288,64 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get : copy error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get"
-}
-
-############################################################## A FINIR !!
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
+}
 
 #D-#==================================================
@@ -1095,10 +1355,14 @@
 #D-
 function IGCM_sys_GetDate_FichWork {
-    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichWork :" $@
-    fi
+  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichWork :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
     # donne la date filesys d'un fichier sur la machine work
-    IGCM_debug_PopStack "IGCM_sys_FichWork"
+  IGCM_debug_PopStack "IGCM_sys_FichWork"
 }
 
@@ -1109,9 +1373,13 @@
 #D-
 function IGCM_sys_GetDate_FichArchive {
-    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichArchive :" $@
-    fi
-    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichArchive :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
+  IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
 
@@ -1120,15 +1388,15 @@
 
 function IGCM_sys_rebuild {
-    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_rebuild :" $@
-    fi
-    /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_rebuild : erreur ${@}."
-       IGCM_debug_Exit "rebuild"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_rebuild"
+  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_rebuild :" $@
+  fi
+  /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_rebuild : erreur ${@}."
+    IGCM_debug_Exit "rebuild"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_rebuild"
 }
 
@@ -1137,8 +1405,8 @@
 
 function IGCM_sys_activ_variables {
-    IGCM_debug_PushStack "IGCM_sys_activ_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_activ_variables"
-    fi
+  IGCM_debug_PushStack "IGCM_sys_activ_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_activ_variables"
+  fi
 
 # --------------------------------------------------------------------
@@ -1147,12 +1415,12 @@
 
 #D-- MPISUSPEND
-    export MPISUSPEND=${MPISUSPEND:=OFF}
+  export MPISUSPEND=${MPISUSPEND:=OFF}
 
 #D-- MPIPROGINF #other choices : ALL_DETAIL2
-    export MPIPROGINF=ALL
+  export MPIPROGINF=ALL
 #D- activate ftrace (with -ftrace)
-    export F_FTRACE=YES
+  export F_FTRACE=YES
 #D- communication information (with -ftrace)
-    export MPICOMMINF=DETAIL
+  export MPICOMMINF=DETAIL
 
 # --------------------------------------------------------------------
@@ -1161,16 +1429,16 @@
 
 #D- max number of character/line in output job
-    export F_SYSLEN=5000
+  export F_SYSLEN=5000
 #D- number of error that can be admitted on the NEC
-    export F_ERRCNT=0
+  export F_ERRCNT=0
 #D- global performance
-    export F_PROGINF=DETAIL
+  export F_PROGINF=DETAIL
 
 #D- I/O performance (FORTRAN I/O only not netCDF)
-    export F_FILEINF=${F_FILEINF:=NO}
+  export F_FILEINF=${F_FILEINF:=NO}
 #D- netCDF I/O performance
-    export NC_FILEINF=${NC_FILEINF:=NO}
-
-    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+  export NC_FILEINF=${NC_FILEINF:=NO}
+
+  IGCM_debug_PopStack "IGCM_sys_activ_variables"
 }
 
@@ -1179,8 +1447,8 @@
 
 function IGCM_sys_desactiv_variables {
-    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_desactiv_variables"
-    fi
+  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_desactiv_variables"
+  fi
 # --------------------------------------------------------------------
 #D- MPI specifications
@@ -1188,5 +1456,5 @@
 
 #D-- MPIPROGINF
-    export MPIPROGINF=NO
+  export MPIPROGINF=NO
 
 # --------------------------------------------------------------------
@@ -1195,7 +1463,7 @@
 
 #D- global performance
-    export F_PROGINF=NO  
-
-    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  export F_PROGINF=NO  
+
+  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
 }
 
@@ -1204,29 +1472,26 @@
 
 function IGCM_sys_build_run_file {
-    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_build_run_file " $@
-    fi
-    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 ))
-    (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
-    (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
-    
-    if [ $1 = MPI2 ]; then
-	cat <<EOF > run_file
+  IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_build_run_file " $@
+  fi
+  (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 ))
+  (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+  (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+  
+  if [ $1 = MPI2 ]; then
+    cat <<EOF > run_file
 -p 1 -np 1 -e ./oasis
 EOF
-	(( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 ))
-	config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"'
-
-    elif [ $1 = MPI1 ]; then
-	cat <<EOF > run_file
+    (( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 ))
+    config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"'
+
+  elif [ $1 = MPI1 ]; then
+    cat <<EOF > run_file
 -p $NUM_PROC_OASIS -e ./oasis
 -p $NUM_PROC_ATM -e ./lmdz.x
 -p $NUM_PROC_OCE -e ./opa.xx
 EOF
- 
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_build_run_file"
-  
-}
+  fi
+  IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 571)
@@ -9,6 +9,4 @@
 # IPSL (2006)
 #  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
-# History:
-# Modification:
 #
 #**************************************************************
@@ -85,5 +83,5 @@
 typeset -r RSYNC_opt="-va"
 # ie storage filesystem
-typeset -r RHOST=mercure
+typeset -r STOREHOST=${MASTER}
 
 #====================================================
@@ -107,9 +105,9 @@
 #====================================================
 #- Mirror libIGCM from mercure to cesium if needed
-ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )
+ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' )
 if [ ! ${ROOTSYS} = "home" ] ; then
-    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
 else
-    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
 fi
 
@@ -117,8 +115,8 @@
 #- libIGCM_POST
 if ( ${MirrorlibIGCM} ) ; then
-    PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
-    typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+  PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+  typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
 else
-    typeset -r libIGCM_POST=${libIGCM}
+  typeset -r libIGCM_POST=${libIGCM}
 fi
 
@@ -135,10 +133,18 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
 #====================================================
-#- OUT
+#- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_BUF (ONLY FOR double copy an scratch)
+typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -149,8 +155,4 @@
 #- RUN_DIR_PATH : Temporary working directory (=> TMP)
 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${LOCALTMPDIR}}
-
-#====================================================
-#- BIG_DIR : BIG_DIR to store files waiting for rebuild
-typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -172,4 +174,25 @@
 
 #D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Connection to frontend machine.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+  ssh -t ${MASTER} /bin/ksh <<-EOF
+  export libIGCM=${libIGCM}
+  export DEBUG_debug=${DEBUG_debug}
+  . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+  . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+  ${@}
+EOF
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshMaster : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshMaster"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_RshArchive
 #D-* Purpose: Archive rsh command
@@ -177,13 +200,13 @@
 #D-
 function IGCM_sys_RshArchive {
-    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    /bin/ksh <<-EOF
-${@}
+  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+  /bin/ksh <<-EOF
+    ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshArchive : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshArchive"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshArchive"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshArchive"
 }
 
@@ -194,42 +217,49 @@
 #D-
 function IGCM_sys_RshPost {
-    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RshPost :" $@
-    fi
+  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RshPost :" $@
+  fi
+
+  #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL
+  #cat tmp_IGCM_sys_RshPost_$$
+  # keep standard input (stdin) for the loop onto temporary file
+  cat >tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND START ============ #
+
+#  /bin/ksh <tmp_IGCM_sys_RshPost_$$
+#  if [ $? -gt 0 ] ; then
+#    echo "IGCM_sys_RshPost : erreur."
+#    IGCM_debug_Exit "IGCM_sys_RshPost"
+#  fi
+#  \rm tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND  END  ============ #
 
 # ============ CESIUM START ============ #
-    typeset NB_ESSAI DELAI status i
-    # keep standard input for the loop onto temporary file
-    cat >tmp_IGCM_sys_RshPost_$$
-    # number of tentative
-    NB_ESSAI=10
-    # time delay between tentative
-    DELAI=10
-    (( i = 0 ))
-    while [ $i -lt $NB_ESSAI ] ; do
-        ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
-        status=$?
-        if [ ${status} -gt 0 ]; then
-	    IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}"
-	    IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again."
-            sleep $DELAI
-        else
-            break
-        fi
-        (( i = i + 1 ))
-    done 
-    # delete temporary file
-    /bin/rm tmp_IGCM_sys_RshPost_$$
+  typeset NB_ESSAI DELAI status i
+  # number of tentative
+  NB_ESSAI=10
+  # time delay between tentative
+  DELAI=10
+  (( i = 0 ))
+  while [ $i -lt $NB_ESSAI ] ; do
+    ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+    status=$?
+    if [ ${status} -gt 0 ]; then
+      IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}"
+      IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again."
+      sleep $DELAI
+    else
+      break
+    fi
+    (( i = i + 1 ))
+  done 
+  # delete temporary file
+  /bin/rm tmp_IGCM_sys_RshPost_$$
 # ============ CESIUM  END  ============ #
 
-# Uncomment for frontend 
-#    /bin/ksh ${@}
-#    if [ $? -gt 0 ] ; then
-#	echo "IGCM_sys_RshPost : erreur."
-#	IGCM_debug_Exit "IGCM_sys_RshPost"
-#    fi
-
-    IGCM_debug_PopStack "IGCM_sys_RshPost"
+  IGCM_debug_PopStack "IGCM_sys_RshPost"
 }
 
@@ -240,16 +270,16 @@
 #D-
 function IGCM_sys_SendMail {
-    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_SendMail :" $@
-    fi
-
-    if ( ${ExitFlag} ) ; then
-	status=failed
-    else
-	status=completed
-    fi
-    cat  << END_MAIL > job_end.mail
-Dear ${LOGIN},
+  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_SendMail :" $@
+  fi
+
+  if ( ${ExitFlag} ) ; then
+    status=failed
+  else
+    status=completed
+  fi
+  cat  << END_MAIL > job_end.mail
+  Dear ${LOGIN},
 
   Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`.
@@ -260,17 +290,17 @@
 END_MAIL
 
-    if  [ X"${config_UserChoices_MailName}" != X ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
-    elif [ -f ~/.forward ] ; then
-       mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
-    else
-       mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail
-    fi
-
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_SendMail : erreur."
-	IGCM_debug_Exit "IGCM_sys_SendMail"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_SendMail"
+  if  [ X"${config_UserChoices_MailName}" != X ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
+  elif [ -f ~/.forward ] ; then
+    mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
+  else
+    mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail
+  fi
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_SendMail : erreur."
+    IGCM_debug_Exit "IGCM_sys_SendMail"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_SendMail"
 }
 
@@ -281,21 +311,21 @@
 #D-
 function IGCM_sys_Mkdir {
-    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mkdir :" $@
-    fi
-    if [ ! -d ${1} ]; then
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Mkdir : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Mkdir"
-	fi
-    fi
-    # vérification :
-    if [ ! -d ${1} ] ; then
-	echo "IGCM_sys_Mkdir : erreur."
-	IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mkdir :" $@
+  fi
+  if [ ! -d ${1} ]; then
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Mkdir : erreur."
+      IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+  fi
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_Mkdir : erreur."
+    IGCM_debug_Exit "IGCM_sys_Mkdir"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mkdir"
 }
 
@@ -306,17 +336,17 @@
 #D-
 function IGCM_sys_MkdirArchive {
-    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirArchive :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirArchive : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirArchive :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirArchive : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
 }
 
@@ -327,17 +357,17 @@
 #D-
 function IGCM_sys_MkdirWork {
-    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirWork :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirWork : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirWork :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirWork : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
 }
 
@@ -348,14 +378,14 @@
 #D-
 function IGCM_sys_Cd {
-    IGCM_debug_PushStack "IGCM_sys_Cd" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cd :" $@
-    fi
-    \cd $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Cd : erreur."
-	IGCM_debug_Exit "IGCM_sys_Cd"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cd"
+  IGCM_debug_PushStack "IGCM_sys_Cd" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cd :" $@
+  fi
+  \cd $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Cd : erreur."
+    IGCM_debug_Exit "IGCM_sys_Cd"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cd"
 }
 
@@ -366,18 +396,18 @@
 #D-
 function IGCM_sys_Chmod {
-    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Chmod :" $@
-    fi
-    if [ $DRYRUN -le 1 ]; then
-	\chmod $@
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Chmod : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Chmod"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Chmod"
+  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Chmod :" $@
+  fi
+  if [ $DRYRUN -le 1 ]; then
+    \chmod $@
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Chmod : erreur."
+      IGCM_debug_Exit "IGCM_sys_Chmod"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Chmod"
 }
 
@@ -388,14 +418,14 @@
 #D-
 function IGCM_sys_FileSize {
-    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
-
-    typeset sizeF
-    set +A sizeF -- $( ls -la ${1} )
-    if [ $? -gt 0 ] ; then
-	IGCM_debug_Exit "IGCM_sys_FileSize"
-    fi
-    eval ${2}=${sizeF[4]}
-
-    IGCM_debug_PopStack "IGCM_sys_FileSize"
+  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+  typeset sizeF
+  set +A sizeF -- $( ls -la ${1} )
+  if [ $? -gt 0 ] ; then
+    IGCM_debug_Exit "IGCM_sys_FileSize"
+  fi
+  eval ${2}=${sizeF[4]}
+
+  IGCM_debug_PopStack "IGCM_sys_FileSize"
 }
 
@@ -406,13 +436,13 @@
 #D-
 function IGCM_sys_TestDir {
-    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDir :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDir"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDir :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+  return ${ExistFlag}
 }
 
@@ -423,13 +453,30 @@
 #D-
 function IGCM_sys_TestDirArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDirArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDirArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/dmnfs ) != X ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
 }
 
@@ -440,10 +487,27 @@
 #D-
 function IGCM_sys_TestFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
-    typeset ExistFlag
-    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestFileArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
 }
 
@@ -454,10 +518,24 @@
 #D-
 function IGCM_sys_CountFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
-    ls ${@} 2>/dev/null | wc -l
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_CountFileArchive : erreur."
-    fi
-    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileArchive : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
 }
 
@@ -468,30 +546,30 @@
 #D-
 function IGCM_sys_Tree {
-    IGCM_debug_PushStack "IGCM_sys_Tree" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tree :" $@
-    fi
-
-    \ls -lR ${@}
-
-    IGCM_debug_PopStack "IGCM_sys_Tree"
+  IGCM_debug_PushStack "IGCM_sys_Tree" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tree :" $@
+  fi
+
+  \ls -lR ${@}
+
+  IGCM_debug_PopStack "IGCM_sys_Tree"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Tar
-#D-* Purpose: master un-tar command
+#D-* Purpose: master tar command
 #D-* Examples:
 #D-
 function IGCM_sys_Tar {
-    IGCM_debug_PushStack "IGCM_sys_Tar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Tar : erreur."
-	IGCM_debug_Exit "IGCM_sys_Tar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Tar"
+  IGCM_debug_PushStack "IGCM_sys_Tar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tar :" $@
+  fi
+  \tar cf $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Tar : erreur."
+    IGCM_debug_Exit "IGCM_sys_Tar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Tar"
 }
 
@@ -502,14 +580,14 @@
 #D-
 function IGCM_sys_UnTar {
-    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_UnTar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_UnTar : erreur."
-	IGCM_debug_Exit "IGCM_sys_UnTar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_UnTar"
+  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_UnTar :" $@
+  fi
+  \tar xvf $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_UnTar : erreur."
+    IGCM_debug_Exit "IGCM_sys_UnTar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_UnTar"
 }
 
@@ -520,14 +598,14 @@
 #D-
 function IGCM_sys_Qsub {
-    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Qsub :" $@
-    fi
-    /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
-	IGCM_debug_Exit "IGCM_sys_Qsub"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Qsub"
+  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Qsub :" $@
+  fi
+  /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+    IGCM_debug_Exit "IGCM_sys_Qsub"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Qsub"
 }
 
@@ -538,33 +616,39 @@
 #D-
 function IGCM_sys_QsubPost {
-    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_QsubPost :" $@
-    fi
-    # ============ CESIUM START ============ #
-    typeset NB_ESSAI DELAI status i
-    # number of tentative
-    NB_ESSAI=10
-    # time delay between tentative
-    DELAI=10
-    (( i = 0 ))
-    while [ $i -lt $NB_ESSAI ] ; do
-	/usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
-        status=$?
-        if [ ${status} -gt 0 ];
-        then
-            sleep $DELAI
-        else
-            break
-        fi
-        (( i = i + 1 ))
-    done 
-    # ============ CESIUM  END  ============ #
-    #/usr/bin/nqsII/qsub -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM}/$1.job -v ${listVarEnv}
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_QsubPost : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_QsubPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_QsubPost :" $@
+  fi
+
+# ============ FRONTEND START ============ #
+
+#  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+
+# ============ FRONTEND  END  ============ #
+
+# ============ CESIUM START ============ #
+  typeset NB_ESSAI DELAI status i
+  # number of tentative
+  NB_ESSAI=10
+  # time delay between tentative
+  DELAI=10
+  (( i = 0 ))
+  while [ $i -lt $NB_ESSAI ] ; do
+    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+    status=$?
+    if [ ${status} -gt 0 ]; then
+      sleep $DELAI
+    else
+      break
+    fi
+    (( i = i + 1 ))
+  done 
+# ============ CESIUM  END  ============ #
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_QsubPost : erreur " $@
+    IGCM_debug_Exit "IGCM_sys_QsubPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
 
@@ -580,108 +664,107 @@
 #D-  Error values and explanations can depend on your system version.
 function IGCM_sys_Rsync_out {
-    RET=$1
-    if [ ! $RET ] ; then
-	echo "rsync error !"
-    fi
-
-    if [ $MYLANG = "fr" ]; then
-	case $RET in
-	    0)  return ;;
-	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
-		echo "Erreur de syntaxe ou d'utilisation."
-		return;;
-	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
-		echo "Incompatibilité de protocole."
-		return;;
-	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
-		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
-		echo "répertoires"
-		return;;
-	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
-		echo "Action demandée non supportée : une tentative de manipulation de"
-		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
-		echo "été faite ; ou une option qui est supportée par le  client  mais"
-		echo "pas par le serveur a été spécifiée."
-		return;;
-	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
-		echo "Erreur dans le socket d'entrée sortie"
-		return;;
-	    11) echo "Erreur de rsync ; RERR_FILEIO"
-		echo "Erreur d'entrée sortie fichier"
-		return;;
-	    12) echo "Erreur de rsync ; RERR_STREAMIO"
-		echo "Erreur dans flux de donnée du protocole rsync"
-		return;;
-	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
-		echo "Erreur avec les diagnostics du programme"
-		return;;
-	    14) echo "Erreur de rsync ; RERR_IPC"
-		echo "Erreur dans le code IPC"
-		return;;
-	    20) echo "Erreur de rsync ; RERR_SIGNAL"
-		echo "SIGUSR1 ou SIGINT reçu"
-		return;;
-	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
-		echo "Une erreur retournée par waitpid()"
-		return;;
-	    22) echo "Erreur de rsync ; RERR_MALLOC"
-		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
-		return;;
-	    23) echo ""
-                echo "Erreur fichier inexistant"
-		return;;
-	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
-		echo "Temps d'attente écoulé dans l'envoi/réception de données"
-		return;;
-	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
-		return;;
-	esac
-    elif [ $MYLANG = "en" ] ; then
-	case $RET in
-	    0)  return;;		
-	    1)  echo "rsync error : Syntax or usage error "
-		return;;
-	    2)  echo "rsync error : Protocol incompatibility "
-		return;;
-	    3)  echo "rsync error : Errors selecting input/output files, dirs"
-		return;;
-	    4)  echo "rsync error : Requested action not supported: an attempt"
-		echo "was made to manipulate 64-bit files on a platform that cannot support"
-		echo "them; or an option was specified that is supported by the client and"
-		echo "not by the server."
-		return;;
-	    5)  echo "rsync error : Error starting client-server protocol"
-		return;;
-	    10) echo "rsync error : Error in socket I/O "
-		return;;
-	    11) echo "rsync error : Error in file I/O "
-		return;;
-	    12) echo "rsync error : Error in rsync protocol data stream "
-		return;;
-	    13) echo "rsync error : Errors with program diagnostics "
-		return;;
-	    14) echo "rsync error : Error in IPC code "
-		return;;
-	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
-		return;;
-	    21) echo "rsync error : Some error returned by waitpid() "
-		return;;
-	    22) echo "rsync error : Error allocating core memory buffers "
-		return;;
-	    23) echo "rsync error : Partial transfer due to error"
-		return;;
-	    24) echo "rsync error : Partial transfer due to vanished source files"
-		return;;
-	    30) echo "rsync error : Timeout in data send/receive "
-		return;;
-	    *)  echo "rsync error : return code of rsync unknown :" $RET
-		return;;
-	esac
-    else
-	echo "unknown language $MYLANG."
-	return
-    fi
-}
-    
+  RET=$1
+  if [ ! $RET ] ; then
+    echo "rsync error !"
+  fi
+
+  if [ $MYLANG = "fr" ]; then
+    case $RET in
+    0)  return ;;
+    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+      echo "Erreur de syntaxe ou d'utilisation."
+      return;;
+    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+      echo "Incompatibilité de protocole."
+      return;;
+    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+      echo "répertoires"
+      return;;
+    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+      echo "Action demandée non supportée : une tentative de manipulation de"
+      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+      echo "été faite ; ou une option qui est supportée par le  client  mais"
+      echo "pas par le serveur a été spécifiée."
+      return;;
+    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+      echo "Erreur dans le socket d'entrée sortie"
+      return;;
+    11) echo "Erreur de rsync ; RERR_FILEIO"
+      echo "Erreur d'entrée sortie fichier"
+      return;;
+    12) echo "Erreur de rsync ; RERR_STREAMIO"
+      echo "Erreur dans flux de donnée du protocole rsync"
+      return;;
+    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+      echo "Erreur avec les diagnostics du programme"
+      return;;
+    14) echo "Erreur de rsync ; RERR_IPC"
+      echo "Erreur dans le code IPC"
+      return;;
+    20) echo "Erreur de rsync ; RERR_SIGNAL"
+      echo "SIGUSR1 ou SIGINT reçu"
+      return;;
+    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+      echo "Une erreur retournée par waitpid()"
+      return;;
+    22) echo "Erreur de rsync ; RERR_MALLOC"
+      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+      return;;
+    23) echo ""
+      echo "Erreur fichier inexistant"
+      return;;
+    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+      echo "Temps d'attente écoulé dans l'envoi/réception de données"
+      return;;
+    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+      return;;
+    esac
+  elif [ $MYLANG = "en" ] ; then
+    case $RET in
+    0)  return;;		
+    1)  echo "rsync error : Syntax or usage error "
+      return;;
+    2)  echo "rsync error : Protocol incompatibility "
+      return;;
+    3)  echo "rsync error : Errors selecting input/output files, dirs"
+      return;;
+    4)  echo "rsync error : Requested action not supported: an attempt"
+      echo "was made to manipulate 64-bit files on a platform that cannot support"
+      echo "them; or an option was specified that is supported by the client and"
+      echo "not by the server."
+      return;;
+    5)  echo "rsync error : Error starting client-server protocol"
+      return;;
+    10) echo "rsync error : Error in socket I/O "
+      return;;
+    11) echo "rsync error : Error in file I/O "
+      return;;
+    12) echo "rsync error : Error in rsync protocol data stream "
+      return;;
+    13) echo "rsync error : Errors with program diagnostics "
+      return;;
+    14) echo "rsync error : Error in IPC code "
+      return;;
+    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+      return;;
+    21) echo "rsync error : Some error returned by waitpid() "
+      return;;
+    22) echo "rsync error : Error allocating core memory buffers "
+      return;;
+    23) echo "rsync error : Partial transfer due to error"
+      return;;
+    24) echo "rsync error : Partial transfer due to vanished source files"
+      return;;
+    30) echo "rsync error : Timeout in data send/receive "
+      return;;
+    *)  echo "rsync error : return code of rsync unknown :" $RET
+      return;;
+    esac
+  else
+    echo "unknown language $MYLANG."
+    return
+  fi
+}
 
 #D-#==================================================
@@ -691,22 +774,22 @@
 #D-
 function IGCM_sys_Mirror_libIGCM {
-    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mirror_libIGCM"
-    fi
-
-    typeset RET DEST
-
-    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
-
-    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
-    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
-	cat out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mirror_libIGCM"
+  fi
+
+  typeset RET DEST
+
+  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+    cat out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
 }
 
@@ -714,5 +797,5 @@
 #- Call IGCM_sys_Mirror_libIGCM now !
 if ( $MirrorlibIGCM ) ; then
-    IGCM_sys_Mirror_libIGCM
+  IGCM_sys_Mirror_libIGCM
 fi
 
@@ -723,23 +806,23 @@
 #D-
 function IGCM_sys_Cp {
-    IGCM_debug_PushStack "IGCM_sys_Cp" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cp :" $@
-    fi
-
-    typeset RET
-
-    echo cp $@ > out_rsync 2>&1
-    \cp $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Cp : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Cp"
-     else
-	 \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cp"
+  IGCM_debug_PushStack "IGCM_sys_Cp" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cp :" $@
+  fi
+
+  typeset RET
+
+  echo cp $@ > out_rsync 2>&1
+  \cp $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Cp"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cp"
 }
 
@@ -750,23 +833,23 @@
 #D-
 function IGCM_sys_Rm {
-    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Rm :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Rm : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Rm"
-    else
-	\rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Rm"
+  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Rm :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Rm"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Rm"
 }
 
@@ -777,29 +860,29 @@
 #D-
 function IGCM_sys_Mv {
-    IGCM_debug_PushStack "IGCM_sys_Mv" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mv :" $@
-    fi
-
-    if [ $DRYRUN = 0 ]; then
-
-        typeset RET
-            
-        echo mv $@ > out_rsync 2>&1
-        \mv $@ >> out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Mv" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mv :" $@
+  fi
+
+  if [ $DRYRUN = 0 ]; then
+
+    typeset RET
     
-        if [ ${RET} -gt 0 ] ; then
-            echo "IGCM_sys_Mv : error in mv."
-            cat out_rsync
-            IGCM_debug_Exit "IGCM_sys_Mv"
-	else
-	    \rm out_rsync
-        fi
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error in mv."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Mv"
     else
-        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_Mv"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_Mv"
 }
 
@@ -810,108 +893,109 @@
 #D-
 function IGCM_sys_Put_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      return
+    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Get_Dir
-#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Purpose: Copy a complete directory from ${ARCHIVE}
 #D-* Examples:
 #D-
 function IGCM_sys_Get_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+#    if [ ! -d ${1} ] ; then
+#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+#      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+#      return
+#    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    # USUAL WAY
+    # add dmfind/dmget (to demigrate all offline files) :
+    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Rest
-#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-* Purpose: Put computied restarts on ${ARCHIVE}.
 #D-           File and target directory must exist.
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Rest {
-    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Rest :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	fi
-
-	typeset RET
-	#
-	if [ X${JobType} = XRUN ] ; then
-	    IGCM_sys_Chmod 444 ${1}
-	fi
-	#
-	IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	# USUAL WAY
-	putfer $1 $2 > out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -925,65 +1009,106 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Rest : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Rest
+#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Rest {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Out
-#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Out {
-    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Out :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-	    return 1
-	fi
-	#
-	IGCM_sys_MkdirArchive $( dirname $2 )
-        #
-	typeset RET
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    typeset WORKPATH FILEPATH
-	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    IGCM_sys_MkdirWork ${WORKPATH} 
-	#    FILEPATH=${WORKPATH}/$( basename $2 )
-        #    #
-	#    IGCM_sys_Cp ${1} ${FILEPATH}
-	#fi
-
-	if [ X${JobType} = XRUN ] ; then
-	    if [ X${3} = X ] ; then
-		IGCM_sys_Chmod 444 ${1}
-	    fi
-	fi
-	#
-        # USUAL WAY
-	putfer $1 $2 > out_rsync 2>&1
-	RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_MkdirArchive $( dirname $2 )
+    #
+    typeset RET
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    typeset WORKPATH FILEPATH
+    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
+    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    FILEPATH=${WORKPATH}/$( basename $2 )
+    #    #
+    #    IGCM_sys_Cp ${1} ${FILEPATH}
+    #fi
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -997,16 +1122,61 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Out : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Out"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Out"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-    return 0
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Out"
+  return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Out
+#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Out {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_Mkdir $( dirname $2 )
+    #
+    typeset RET
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+  return 0
 }
 
@@ -1017,70 +1187,88 @@
 #D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
 function IGCM_sys_Get {
-    IGCM_debug_PushStack "IGCM_sys_Get" $@
-
-    typeset DEST RET dm_liste ifile target file_work 
-
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get :" $@
-    fi
-    if [ $DRYRUN -le 2 ]; then
-	if [ X${1} = X'/l' ] ; then
-            # test if the first file is present in the old computation :
-	    eval set +A dm_liste \${${2}}
-	else
-	    eval set +A dm_liste ${1}
-	fi
-	eval DEST=\${${#}}
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	# Is it an R_OUT file (not R_IN) ?
-	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    # Yes  ? then we try to get it in SCRATCHDIR
-	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    if [ -f ${file_work[0]} ] ; then
-	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
-	#	IGCM_debug_PopStack "IGCM_sys_Get"
-	#	return
-	#    fi
-	#fi
-
-	# test if the (first) file is present in the old computation :
-	IGCM_sys_TestFileArchive ${dm_liste[0]}
-	RET=$?
-        if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	    IGCM_debug_PopStack "IGCM_sys_Get"
-	    return
-	fi
-
-	dmget ${dm_liste[*]} > out_rsync 2>&1
-  	RET=$?
-  	if [ ${RET} -gt 0 ] ; then
-  	    echo "IGCM_sys_Get : demigration error."
-  	    cat out_rsync
-  	    IGCM_debug_Exit "IGCM_sys_Get"
-  	fi
-
-        #USUAL WAY
-	if [ X${1} = X'/l' ] ; then
-	    (( RET=0 ))
-	    for target in ${dm_liste[*]} ; do
-		local_file=$( basename ${target} )
-		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-		(( RET = RET + $? ))
-	    done
-	else
-	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-	    RET=$?
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+  typeset DEST RET dm_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A dm_liste \${${2}}
+    else
+      eval set +A dm_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    # Is it an R_OUT file (not R_IN) ?
+    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    # Yes  ? then we try to get it in SCRATCHDIR
+    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )
+    #    if [ -f ${file_work[0]} ] ; then
+    #	IGCM_sys_Cp ${file_work[*]} ${DEST}
+    #	IGCM_debug_PopStack "IGCM_sys_Get"
+    #	return
+    #    fi
+    #fi
+
+    # test if the (first) file is present in the old computation :
+    IGCM_sys_TestFileArchive ${dm_liste[0]}
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Get"
+    fi
+
+    dmget ${dm_liste[*]} > out_rsync 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : demigration error."
+      cat out_rsync
+      echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
+    fi
+
+    #if [ ${RET} -gt 0 ] ; then
+    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
+    #	cat out_rsync
+    #	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
+    #	sleep 30
+    #	echo "We try another time"
+    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #	RET=$?
+    #	if [ ${RET} -gt 0 ] ; then
+    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
+    #	    cat out_rsync
+    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #	fi
+    #    else
+    #	echo "ERROR IGCM_sys_Get : demigration error :"
+    #	cat out_rsync
+    #	IGCM_debug_Exit "IGCM_sys_Get"
+    #    fi
+    #fi
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${dm_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1094,18 +1282,64 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get : copy error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get"
-}
-
-############################################################## A FINIR !!
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
+}
 
 #D-#==================================================
@@ -1115,10 +1349,14 @@
 #D-
 function IGCM_sys_GetDate_FichWork {
-    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichWork :" $@
-    fi
+  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichWork :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
     # donne la date filesys d'un fichier sur la machine work
-    IGCM_debug_PopStack "IGCM_sys_FichWork"
+  IGCM_debug_PopStack "IGCM_sys_FichWork"
 }
 
@@ -1129,9 +1367,13 @@
 #D-
 function IGCM_sys_GetDate_FichArchive {
-    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichArchive :" $@
-    fi
-    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichArchive :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
+  IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
 
@@ -1140,15 +1382,15 @@
 
 function IGCM_sys_rebuild {
-    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_rebuild :" $@
-    fi
-    /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_rebuild : erreur ${@}."
-       IGCM_debug_Exit "rebuild"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_rebuild"
+  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_rebuild :" $@
+  fi
+  /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_rebuild : erreur ${@}."
+    IGCM_debug_Exit "rebuild"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_rebuild"
 }
 
@@ -1157,8 +1399,8 @@
 
 function IGCM_sys_activ_variables {
-    IGCM_debug_PushStack "IGCM_sys_activ_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_activ_variables"
-    fi
+  IGCM_debug_PushStack "IGCM_sys_activ_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_activ_variables"
+  fi
 
 # --------------------------------------------------------------------
@@ -1167,12 +1409,12 @@
 
 #D-- MPISUSPEND
-    export MPISUSPEND=${MPISUSPEND:=OFF}
+  export MPISUSPEND=${MPISUSPEND:=OFF}
 
 #D-- MPIPROGINF #other choices : ALL_DETAIL2
-    export MPIPROGINF=ALL
+  export MPIPROGINF=ALL
 #D- activate ftrace (with -ftrace)
-    export F_FTRACE=YES
+  export F_FTRACE=YES
 #D- communication information (with -ftrace)
-    export MPICOMMINF=DETAIL
+  export MPICOMMINF=DETAIL
 
 # --------------------------------------------------------------------
@@ -1181,16 +1423,16 @@
 
 #D- max number of character/line in output job
-    export F_SYSLEN=5000
+  export F_SYSLEN=5000
 #D- number of error that can be admitted on the NEC
-    export F_ERRCNT=0
+  export F_ERRCNT=0
 #D- global performance
-    export F_PROGINF=DETAIL
+  export F_PROGINF=DETAIL
 
 #D- I/O performance (FORTRAN I/O only not netCDF)
-    export F_FILEINF=${F_FILEINF:=NO}
+  export F_FILEINF=${F_FILEINF:=NO}
 #D- netCDF I/O performance
-    export NC_FILEINF=${NC_FILEINF:=NO}
-
-    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+  export NC_FILEINF=${NC_FILEINF:=NO}
+
+  IGCM_debug_PopStack "IGCM_sys_activ_variables"
 }
 
@@ -1199,8 +1441,8 @@
 
 function IGCM_sys_desactiv_variables {
-    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_desactiv_variables"
-    fi
+  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_desactiv_variables"
+  fi
 # --------------------------------------------------------------------
 #D- MPI specifications
@@ -1208,5 +1450,5 @@
 
 #D-- MPIPROGINF
-    export MPIPROGINF=NO
+  export MPIPROGINF=NO
 
 # --------------------------------------------------------------------
@@ -1215,7 +1457,7 @@
 
 #D- global performance
-    export F_PROGINF=NO  
-
-    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  export F_PROGINF=NO  
+
+  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
 }
 
@@ -1325,4 +1567,5 @@
 
     IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
+
 }
 
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_obelix.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 571)
@@ -64,5 +64,5 @@
 # Host and user names 
 # $hostname ou hostname
-typeset  HOST=${HOST:=$( hostname )}
+typeset  MASTER=${MASTER:=$( hostname )}
 # $username ou whoami
 typeset  LOGIN=${LOGIN:=$( whoami )}
@@ -168,5 +168,5 @@
     IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
 
-    ssh ${HOST} exec /bin/ksh  <<-EOF
+    ssh obelix3 exec /bin/ksh  <<-EOF
     export libIGCM=${libIGCM}
     export DEBUG_debug=${DEBUG_debug}
@@ -474,10 +474,9 @@
 	echo "IGCM_sys_Tar :" $@
     fi
-    \tar cvf $@
+    \tar cf $@
     if [ $? -gt 0 ] ; then
 	echo "IGCM_sys_Tar : erreur."
 	IGCM_debug_Exit "IGCM_sys_Tar"
     fi
-    \tar tvf $1
 
     IGCM_debug_PopStack "IGCM_sys_Tar"
@@ -1044,26 +1043,5 @@
 	echo "IGCM_sys_Dods_Rm :" $@
     fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
- 	IGCM_sys_Rm -Rf /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}/${1}
-	RET=$?
-        
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dods : error."
-	    cat out_dods_rm
-	    IGCM_debug_Exit "IGCM_sys_Dods_Rm"
-	else
-	    rm out_dods_rm
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
+    return 0
 }
 
@@ -1078,28 +1056,5 @@
 	echo "IGCM_sys_Dods_Cp :" $@
     fi
-    typeset RET
-    RET=0
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-	    echo "Nothing has been done."
-	    return
-	fi
-	#
- 	IGCM_sys_Mkdir /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}
- 	IGCM_sys_Cp -Rp --parents ${1} /tmp/DODS/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-	RET=$?
-        
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Dods_Cp : error."
-	    cat out_dods_cp
-	    IGCM_debug_Exit "IGCM_sys_Dods_Cp"
-	else
-	    rm out_dods_cp
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    return $RET
+    return 0
 }
 
@@ -1115,15 +1070,4 @@
     fi
     if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${R_SAVE}/${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
-	    return
-	fi
-
-	typeset RET
-	#
- 	cd ${R_SAVE}
-	IGCM_sys_Dods_Rm ${1}
-	IGCM_sys_Dods_Cp ${1}
 	RET=0
         
@@ -1138,6 +1082,4 @@
 }
 
-############################################################## A FINIR !!
-
 #D-#==================================================
 #D-function IGCM_sys_GetDate_FichWork
@@ -1150,4 +1092,8 @@
 	echo "IGCM_sys_GetDate_FichWork :" $@
     fi
+    typeset dateF
+    set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+    eval ${2}=${dateF[5]}
+
     # donne la date filesys d'un fichier sur la machine work
     IGCM_debug_PopStack "IGCM_sys_FichWork"
@@ -1164,4 +1110,8 @@
 	echo "IGCM_sys_GetDate_FichArchive :" $@
     fi
+    typeset dateF
+    set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+    eval ${2}=${dateF[5]}
+
     IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 571)
@@ -80,5 +80,5 @@
 typeset -r RSYNC_opt="-va"
 # ie storage filesystem
-typeset -r RHOST=titane
+typeset -r STOREHOST=${MASTER}
 
 #====================================================
@@ -91,4 +91,6 @@
 #====================================================
 . /home/cont003/p86ipsl/.atlas_env_titane_ksh
+
+module switch nco/4.0.8 nco/3.9.4_netcdf4
 
 #====================================================
@@ -113,34 +115,50 @@
 typeset -r ARCHIVE=${DMFDIR}
 
+# ============ CESIUM START ============ #
+
 #====================================================
 #- Mirror libIGCM from titane to cesium if needed
-ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )
-if [ ! ${ROOTSYS} = "home" ] ; then
-    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
-else
-    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
-fi
+#ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' )
+#if [ ! ${ROOTSYS} = "home" ] ; then
+#  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+#else
+#  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+#fi
 
 #====================================================
 #- libIGCM_POST
-if ( ${MirrorlibIGCM} ) ; then
-    PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
-    typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
-else
-    typeset -r libIGCM_POST=${libIGCM}
-fi
+#if ( ${MirrorlibIGCM} ) ; then
+#  PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+#  typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+#else
+#  typeset -r libIGCM_POST=${libIGCM}
+#fi
+
+# ============ CESIUM  END  ============ #
+
+#====================================================
+#- MirrorlibIGCM for frontend
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+
+#====================================================
+#- libIGCM_POST for frontend
+typeset -r libIGCM_POST=${libIGCM}
 
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
 #====================================================
-#- OUT
+#- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
 
 #====================================================
-#- OUT_SCR (ONLY FOR double copy an scratch)
-typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
+#- R_BUF (ONLY FOR double copy an scratch)
+typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -151,12 +169,8 @@
 #- RUN_DIR_PATH : Temporary working directory (=> TMP)
 if [ ! X${LSB_QUEUE} = Xmono ] ; then
-    typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${LSB_JOBID}}
+  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${LSB_JOBID}}
 else
-    typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${LSB_JOBID}}
+  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${LSB_JOBID}}
 fi
-
-#====================================================
-#- BIG_DIR : BIG_DIR to store files waiting for rebuild
-typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
 
 #====================================================
@@ -181,14 +195,10 @@
 #D-#==================================================
 #D-function IGCM_sys_RshMaster
-#D-* Purpose: Just a fake command to wrapp
-#D-           IGCM_card call in post-treatment
-#D-           Ulam do not see brodie filesystem
-#D-           Cesium do not see all mercure filesystem
-#D-           That's why we need this hack.
+#D-* Purpose: Connection to frontend machine.
 #D-* Examples:
 #D-
 function IGCM_sys_RshMaster {
-    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
-    /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+  /bin/ksh <<-EOF
     export libIGCM=${libIGCM}
     export DEBUG_debug=${DEBUG_debug}
@@ -197,9 +207,9 @@
     ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshMaster : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshMaster"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshMaster : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshMaster"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshMaster"
 }
 
@@ -210,13 +220,13 @@
 #D-
 function IGCM_sys_RshArchive {
-    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    /bin/ksh <<-EOF
+  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+  /bin/ksh <<-EOF
     ${@}
 EOF
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_RshArchive : erreur."
-	IGCM_debug_Exit "IGCM_sys_RshArchive"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshArchive : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshArchive"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RshArchive"
 }
 
@@ -227,62 +237,79 @@
 #D-
 function IGCM_sys_RshPost {
-    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_RshPost :" $@
-    fi
-
-    typeset NB_ESSAI DELAI status i
-    # keep standard input for the loop onto temporary file
-    cat >tmp_IGCM_sys_RshPost_$$
-
-    #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL
-    #cat tmp_IGCM_sys_RshPost_$$
-
-    if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then
-	# little hack so that rebuild submission is done on titane not an cesium
-	#
-	libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' )
-	POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' )
-	sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
-	sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$
-	sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
-	sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$
-	#\mv tmp.txt tmp_IGCM_sys_RshPost_$$
-	#
-	#echo cat tmp_IGCM_sys_RshPost_$$ AFTER
-	#cat tmp_IGCM_sys_RshPost_$$
-	/bin/ksh <tmp_IGCM_sys_RshPost_$$
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_RshPost : erreur."
-	    IGCM_debug_Exit "IGCM_sys_RshPost"
-	fi
-        # delete temporary file
-        \rm tmp_IGCM_sys_RshPost_$$
-    else
-        # number of tentative
-	NB_ESSAI=10
-        # time delay between tentative
-	DELAI=10
-	i=0
-	while [ $i -ne $NB_ESSAI ] ; do
-            ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
-            status=$?
-            if [ ${status} -ne 0 ];
-            then
-		sleep $DELAI
-            else
-		break
-            fi
-            let i=$i+1
-	done
-        # delete temporary file
-	\rm tmp_IGCM_sys_RshPost_$$
-
-	if [ ${status} -gt 0 ] ; then
-	    echo "IGCM_sys_RshPost : erreur."
-	    IGCM_debug_Exit "IGCM_sys_RshPost"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_RshPost"
+  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RshPost :" $@
+  fi
+
+  #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL
+  #cat tmp_IGCM_sys_RshPost_$$
+  # keep standard input (stdin) for the loop onto temporary file
+  cat >tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND START ============ #
+
+  /bin/ksh <tmp_IGCM_sys_RshPost_$$
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshPost : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshPost"
+  fi
+  # delete temporary file
+  \rm tmp_IGCM_sys_RshPost_$$
+
+# ============ FRONTEND  END  ============ #
+
+# ============ CESIUM START ============ #
+#  typeset NB_ESSAI DELAI status i
+#  if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then
+#    #little hack so that rebuild submission is done on titane not an cesium
+#    
+#    libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' )
+#    POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' )
+#    sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
+#    sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$
+#    sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
+#    sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$
+#    \mv tmp.txt tmp_IGCM_sys_RshPost_$$
+#    
+#    echo cat tmp_IGCM_sys_RshPost_$$ AFTER
+#    cat tmp_IGCM_sys_RshPost_$$
+#
+#    /bin/ksh <tmp_IGCM_sys_RshPost_$$
+#    if [ $? -gt 0 ] ; then
+#      echo "IGCM_sys_RshPost : erreur."
+#      IGCM_debug_Exit "IGCM_sys_RshPost"
+#    fi
+#    # delete temporary file
+#    \rm tmp_IGCM_sys_RshPost_$$
+#
+#  else
+#    # number of tentative
+#    NB_ESSAI=10
+#    # time delay between tentative
+#    DELAI=10
+#    i=0
+#    while [ $i -ne $NB_ESSAI ] ; do
+#      ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+#      status=$?
+#      if [ ${status} -ne 0 ];
+#      then
+#	sleep $DELAI
+#      else
+#	break
+#      fi
+#      let i=$i+1
+#    done
+#    # delete temporary file
+#    \rm tmp_IGCM_sys_RshPost_$$
+#
+#    if [ ${status} -gt 0 ] ; then
+#      echo "IGCM_sys_RshPost : erreur."
+#      IGCM_debug_Exit "IGCM_sys_RshPost"
+#    fi
+#  fi
+
+# ============ CESIUM  END  ============ #
+
+  IGCM_debug_PopStack "IGCM_sys_RshPost"
 }
 
@@ -293,24 +320,14 @@
 #D-
 function IGCM_sys_SendMail {
-    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
-    if ( $DEBUG_sys ) ; then
-       echo "IGCM_sys_SendMail :" $@
-    fi
-
-    if ( ${ExitFlag} ) ; then
-	status=failed
-    else
-	status=completed
-    fi
-
-    ssh -t titane996 ssh platine /bin/ksh <<-EOF
-    export LOGIN=${LOGIN}
-    export config_UserChoices_JobName=${config_UserChoices_JobName}
-    export config_UserChoices_MailName=${config_UserChoices_MailName}
-    export DateBegin=${DateBegin}
-    export DateEnd=${DateEnd}
-    export R_SAVE=${R_SAVE}
-    export SUBMIT_DIR=${SUBMIT_DIR}
-    export status=${status}
+  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_SendMail :" $@
+  fi
+
+  if ( ${ExitFlag} ) ; then
+    status=failed
+  else
+    status=completed
+  fi
 
     cat  << END_MAIL > job_end.mail
@@ -325,18 +342,16 @@
 
     if [ ! -z ${config_UserChoices_MailName} ] ; then
-	mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail
+	mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail
     elif [ -f ~/.forward ] ; then
-	mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
-    fi
-
+	mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
+    fi
     sleep 10
     rm -f job_end.mail
-EOF
-
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_SendMail : erreur."
-	IGCM_debug_Exit "IGCM_sys_SendMail"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_SendMail"
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_SendMail : erreur."
+    IGCM_debug_Exit "IGCM_sys_SendMail"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_SendMail"
 }
 
@@ -347,21 +362,21 @@
 #D-
 function IGCM_sys_Mkdir {
-    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mkdir :" $@
-    fi
-    if [ ! -d ${1} ]; then
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Mkdir : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Mkdir"
-	fi
-    fi
-    # vérification :
-    if [ ! -d ${1} ] ; then
-	echo "IGCM_sys_Mkdir : erreur."
-	IGCM_debug_Exit "IGCM_sys_Mkdir"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mkdir :" $@
+  fi
+  if [ ! -d ${1} ]; then
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Mkdir : erreur."
+      IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+  fi
+  # vérification :
+  if [ ! -d ${1} ] ; then
+    echo "IGCM_sys_Mkdir : erreur."
+    IGCM_debug_Exit "IGCM_sys_Mkdir"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mkdir"
 }
 
@@ -372,17 +387,17 @@
 #D-
 function IGCM_sys_MkdirArchive {
-    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirArchive :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirArchive : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirArchive :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirArchive : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
 }
 
@@ -393,17 +408,17 @@
 #D-
 function IGCM_sys_MkdirWork {
-    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_MkdirWork :" $@
-    fi
-    #- creation de repertoire sur le serveur fichier
-    if [ ! -d ${1} ]; then 
-	\mkdir -p $1
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_MkdirWork : erreur."
-	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
-	fi
-    fi
-    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_MkdirWork :" $@
+  fi
+  #- creation de repertoire sur le serveur fichier
+  if [ ! -d ${1} ]; then 
+    \mkdir -p $1
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_MkdirWork : erreur."
+      IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+  fi
+  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
 }
 
@@ -414,14 +429,14 @@
 #D-
 function IGCM_sys_Cd {
-    IGCM_debug_PushStack "IGCM_sys_Cd" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cd :" $@
-    fi
-    \cd $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Cd : erreur."
-	IGCM_debug_Exit "IGCM_sys_Cd"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cd"
+  IGCM_debug_PushStack "IGCM_sys_Cd" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cd :" $@
+  fi
+  \cd $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Cd : erreur."
+    IGCM_debug_Exit "IGCM_sys_Cd"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cd"
 }
 
@@ -432,18 +447,18 @@
 #D-
 function IGCM_sys_Chmod {
-    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Chmod :" $@
-    fi
-    if [ $DRYRUN -le 1 ]; then
-	\chmod $@
-	if [ $? -gt 0 ] ; then
-	    echo "IGCM_sys_Chmod : erreur."
-	    IGCM_debug_Exit "IGCM_sys_Chmod"
-	fi
-    else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Chmod"
+  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Chmod :" $@
+  fi
+  if [ $DRYRUN -le 1 ]; then
+    \chmod $@
+    if [ $? -gt 0 ] ; then
+      echo "IGCM_sys_Chmod : erreur."
+      IGCM_debug_Exit "IGCM_sys_Chmod"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Chmod"
 }
 
@@ -454,14 +469,14 @@
 #D-
 function IGCM_sys_FileSize {
-    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
-
-    typeset sizeF
-    set +A sizeF -- $( ls -la ${1} )
-    if [ $? -gt 0 ] ; then
-	IGCM_debug_Exit "IGCM_sys_FileSize"
-    fi
-    eval ${2}=${sizeF[4]}
-
-    IGCM_debug_PopStack "IGCM_sys_FileSize"
+  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+  typeset sizeF
+  set +A sizeF -- $( ls -la ${1} )
+  if [ $? -gt 0 ] ; then
+    IGCM_debug_Exit "IGCM_sys_FileSize"
+  fi
+  eval ${2}=${sizeF[4]}
+
+  IGCM_debug_PopStack "IGCM_sys_FileSize"
 }
 
@@ -472,13 +487,13 @@
 #D-
 function IGCM_sys_TestDir {
-    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDir :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDir"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDir :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+  return ${ExistFlag}
 }
 
@@ -489,13 +504,30 @@
 #D-
 function IGCM_sys_TestDirArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_TestDirArchive :" $@
-    fi
-    typeset ExistFlag
-    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestDirArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/dmnfs ) != X ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
 }
 
@@ -506,10 +538,27 @@
 #D-
 function IGCM_sys_TestFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
-    typeset ExistFlag
-    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
-    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
-
-    return ${ExistFlag}
+  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_TestFileArchive :" $@
+  fi
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
 }
 
@@ -520,10 +569,24 @@
 #D-
 function IGCM_sys_CountFileArchive {
-    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
-    ls ${@} 2>/dev/null | wc -l
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_CountFileArchive : erreur."
-    fi
-    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileArchive : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
 }
 
@@ -534,30 +597,30 @@
 #D-
 function IGCM_sys_Tree {
-    IGCM_debug_PushStack "IGCM_sys_Tree" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tree :" $@
-    fi
-
-    \ls -lR ${@}
-
-    IGCM_debug_PopStack "IGCM_sys_Tree"
+  IGCM_debug_PushStack "IGCM_sys_Tree" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tree :" $@
+  fi
+
+  \ls -lR ${@}
+
+  IGCM_debug_PopStack "IGCM_sys_Tree"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Tar
-#D-* Purpose: master un-tar command
+#D-* Purpose: master tar command
 #D-* Examples:
 #D-
 function IGCM_sys_Tar {
-    IGCM_debug_PushStack "IGCM_sys_Tar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Tar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Tar : erreur."
-	IGCM_debug_Exit "IGCM_sys_Tar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Tar"
+  IGCM_debug_PushStack "IGCM_sys_Tar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Tar :" $@
+  fi
+  \tar cf $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Tar : erreur."
+    IGCM_debug_Exit "IGCM_sys_Tar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Tar"
 }
 
@@ -568,14 +631,14 @@
 #D-
 function IGCM_sys_UnTar {
-    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_UnTar :" $@
-    fi
-    \tar xvf $1
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_UnTar : erreur."
-	IGCM_debug_Exit "IGCM_sys_UnTar"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_UnTar"
+  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_UnTar :" $@
+  fi
+  \tar xvf $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_UnTar : erreur."
+    IGCM_debug_Exit "IGCM_sys_UnTar"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_UnTar"
 }
 
@@ -586,20 +649,21 @@
 #D-
 function IGCM_sys_Qsub {
-    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Qsub :" $@
-    fi
-
-    if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then
-        /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} < $1
-    else
-        /usr/local/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod} < $1
-    fi
-
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_Qsub : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_Qsub"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Qsub"
+  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Qsub :" $@
+  fi
+  typeset options
+  if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then
+    options=" -o ${Script_Output} -e ${Script_Output}"
+  else
+    options=" -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod}"
+  fi
+
+  /usr/local/bin/ccc_msub ${options} < $1
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_Qsub : erreur ${options} $1"
+    IGCM_debug_Exit "IGCM_sys_Qsub"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Qsub"
 }
 
@@ -610,14 +674,41 @@
 #D-
 function IGCM_sys_QsubPost {
-    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_QsubPost :" $@
-    fi
-    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
-    if [ $? -gt 0 ] ; then
-	echo "IGCM_sys_QsubPost : erreur " $@
-	IGCM_debug_Exit "IGCM_sys_QsubPost"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_QsubPost :" $@
+  fi
+
+  # Need to export listVarEnv for cesium
+  # NO Need to export listVarEnv for titane
+# ============ FRONTEND START ============ #
+
+  /usr/local/bin/ccc_msub -p ${BRIDGE_MSUB_PROJECT} -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job
+
+# ============ FRONTEND  END  ============ #
+
+# ============ CESIUM START ============ #
+#  typeset NB_ESSAI DELAI status i
+#  # number of tentative
+#  NB_ESSAI=10
+#  # time delay between tentative
+#  DELAI=10
+#  (( i = 0 ))
+#  while [ $i -lt $NB_ESSAI ] ; do
+#    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+#    status=$?
+#    if [ ${status} -gt 0 ]; then
+#      sleep $DELAI
+#    else
+#      break
+#    fi
+#    (( i = i + 1 ))
+#  done 
+# ============ CESIUM  END  ============ #
+
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_QsubPost : erreur " $@
+    IGCM_debug_Exit "IGCM_sys_QsubPost"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
 
@@ -633,108 +724,107 @@
 #D-  Error values and explanations can depend on your system version.
 function IGCM_sys_Rsync_out {
-    RET=$1
-    if [ ! $RET ] ; then
-	echo "rsync error !"
-    fi
-
-    if [ $MYLANG = "fr" ]; then
-	case $RET in
-	    0)  return ;;
-	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
-		echo "Erreur de syntaxe ou d'utilisation."
-		return;;
-	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
-		echo "Incompatibilité de protocole."
-		return;;
-	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
-		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
-		echo "répertoires"
-		return;;
-	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
-		echo "Action demandée non supportée : une tentative de manipulation de"
-		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
-		echo "été faite ; ou une option qui est supportée par le  client  mais"
-		echo "pas par le serveur a été spécifiée."
-		return;;
-	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
-		echo "Erreur dans le socket d'entrée sortie"
-		return;;
-	    11) echo "Erreur de rsync ; RERR_FILEIO"
-		echo "Erreur d'entrée sortie fichier"
-		return;;
-	    12) echo "Erreur de rsync ; RERR_STREAMIO"
-		echo "Erreur dans flux de donnée du protocole rsync"
-		return;;
-	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
-		echo "Erreur avec les diagnostics du programme"
-		return;;
-	    14) echo "Erreur de rsync ; RERR_IPC"
-		echo "Erreur dans le code IPC"
-		return;;
-	    20) echo "Erreur de rsync ; RERR_SIGNAL"
-		echo "SIGUSR1 ou SIGINT reçu"
-		return;;
-	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
-		echo "Une erreur retournée par waitpid()"
-		return;;
-	    22) echo "Erreur de rsync ; RERR_MALLOC"
-		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
-		return;;
-	    23) echo ""
-                echo "Erreur fichier inexistant"
-		return;;
-	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
-		echo "Temps d'attente écoulé dans l'envoi/réception de données"
-		return;;
-	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
-		return;;
-	esac
-    elif [ $MYLANG = "en" ] ; then
-	case $RET in
-	    0)  return;;		
-	    1)  echo "rsync error : Syntax or usage error "
-		return;;
-	    2)  echo "rsync error : Protocol incompatibility "
-		return;;
-	    3)  echo "rsync error : Errors selecting input/output files, dirs"
-		return;;
-	    4)  echo "rsync error : Requested action not supported: an attempt"
-		echo "was made to manipulate 64-bit files on a platform that cannot support"
-		echo "them; or an option was specified that is supported by the client and"
-		echo "not by the server."
-		return;;
-	    5)  echo "rsync error : Error starting client-server protocol"
-		return;;
-	    10) echo "rsync error : Error in socket I/O "
-		return;;
-	    11) echo "rsync error : Error in file I/O "
-		return;;
-	    12) echo "rsync error : Error in rsync protocol data stream "
-		return;;
-	    13) echo "rsync error : Errors with program diagnostics "
-		return;;
-	    14) echo "rsync error : Error in IPC code "
-		return;;
-	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
-		return;;
-	    21) echo "rsync error : Some error returned by waitpid() "
-		return;;
-	    22) echo "rsync error : Error allocating core memory buffers "
-		return;;
-	    23) echo "rsync error : Partial transfer due to error"
-		return;;
-	    24) echo "rsync error : Partial transfer due to vanished source files"
-		return;;
-	    30) echo "rsync error : Timeout in data send/receive "
-		return;;
-	    *)  echo "rsync error : return code of rsync unknown :" $RET
-		return;;
-	esac
-    else
-	echo "unknown language $MYLANG."
-	return
-    fi
-}
-    
+  RET=$1
+  if [ ! $RET ] ; then
+    echo "rsync error !"
+  fi
+
+  if [ $MYLANG = "fr" ]; then
+    case $RET in
+    0)  return ;;
+    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+      echo "Erreur de syntaxe ou d'utilisation."
+      return;;
+    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+      echo "Incompatibilité de protocole."
+      return;;
+    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+      echo "répertoires"
+      return;;
+    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+      echo "Action demandée non supportée : une tentative de manipulation de"
+      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+      echo "été faite ; ou une option qui est supportée par le  client  mais"
+      echo "pas par le serveur a été spécifiée."
+      return;;
+    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+      echo "Erreur dans le socket d'entrée sortie"
+      return;;
+    11) echo "Erreur de rsync ; RERR_FILEIO"
+      echo "Erreur d'entrée sortie fichier"
+      return;;
+    12) echo "Erreur de rsync ; RERR_STREAMIO"
+      echo "Erreur dans flux de donnée du protocole rsync"
+      return;;
+    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+      echo "Erreur avec les diagnostics du programme"
+      return;;
+    14) echo "Erreur de rsync ; RERR_IPC"
+      echo "Erreur dans le code IPC"
+      return;;
+    20) echo "Erreur de rsync ; RERR_SIGNAL"
+      echo "SIGUSR1 ou SIGINT reçu"
+      return;;
+    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+      echo "Une erreur retournée par waitpid()"
+      return;;
+    22) echo "Erreur de rsync ; RERR_MALLOC"
+      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+      return;;
+    23) echo ""
+      echo "Erreur fichier inexistant"
+      return;;
+    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+      echo "Temps d'attente écoulé dans l'envoi/réception de données"
+      return;;
+    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+      return;;
+    esac
+  elif [ $MYLANG = "en" ] ; then
+    case $RET in
+    0)  return;;		
+    1)  echo "rsync error : Syntax or usage error "
+      return;;
+    2)  echo "rsync error : Protocol incompatibility "
+      return;;
+    3)  echo "rsync error : Errors selecting input/output files, dirs"
+      return;;
+    4)  echo "rsync error : Requested action not supported: an attempt"
+      echo "was made to manipulate 64-bit files on a platform that cannot support"
+      echo "them; or an option was specified that is supported by the client and"
+      echo "not by the server."
+      return;;
+    5)  echo "rsync error : Error starting client-server protocol"
+      return;;
+    10) echo "rsync error : Error in socket I/O "
+      return;;
+    11) echo "rsync error : Error in file I/O "
+      return;;
+    12) echo "rsync error : Error in rsync protocol data stream "
+      return;;
+    13) echo "rsync error : Errors with program diagnostics "
+      return;;
+    14) echo "rsync error : Error in IPC code "
+      return;;
+    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+      return;;
+    21) echo "rsync error : Some error returned by waitpid() "
+      return;;
+    22) echo "rsync error : Error allocating core memory buffers "
+      return;;
+    23) echo "rsync error : Partial transfer due to error"
+      return;;
+    24) echo "rsync error : Partial transfer due to vanished source files"
+      return;;
+    30) echo "rsync error : Timeout in data send/receive "
+      return;;
+    *)  echo "rsync error : return code of rsync unknown :" $RET
+      return;;
+    esac
+  else
+    echo "unknown language $MYLANG."
+    return
+  fi
+}
 
 #D-#==================================================
@@ -744,22 +834,22 @@
 #D-
 function IGCM_sys_Mirror_libIGCM {
-    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mirror_libIGCM"
-    fi
-
-    typeset RET DEST
-
-    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
-
-    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
-    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
-	cat out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mirror_libIGCM"
+  fi
+
+  typeset RET DEST
+
+  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+    cat out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
 }
 
@@ -767,5 +857,5 @@
 #- Call IGCM_sys_Mirror_libIGCM now !
 if ( $MirrorlibIGCM ) ; then
-    IGCM_sys_Mirror_libIGCM
+  IGCM_sys_Mirror_libIGCM
 fi
 
@@ -776,23 +866,23 @@
 #D-
 function IGCM_sys_Cp {
-    IGCM_debug_PushStack "IGCM_sys_Cp" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Cp :" $@
-    fi
-
-    typeset RET
-
-    echo cp $@ > out_rsync 2>&1
-    \cp $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Cp : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Cp"
-     else
-	 \rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Cp"
+  IGCM_debug_PushStack "IGCM_sys_Cp" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Cp :" $@
+  fi
+
+  typeset RET
+
+  echo cp $@ > out_rsync 2>&1
+  \cp $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Cp"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Cp"
 }
 
@@ -803,23 +893,23 @@
 #D-
 function IGCM_sys_Rm {
-    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Rm :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-	echo "IGCM_sys_Rm : error."
-	cat out_rsync
-	IGCM_debug_Exit "IGCM_sys_Rm"
-    else
-	\rm out_rsync
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Rm"
+  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Rm :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_Rm"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Rm"
 }
 
@@ -831,24 +921,23 @@
 #D-
 function IGCM_sys_RmRunDir {
-    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
-    if ( $DEBUG_sys ) ; then
-        echo "IGCM_sys_RmRunDir :" $@
-    fi
-
-    typeset RET
-
-    echo rm $@ > out_rsync 2>&1
-    \rm $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-        echo "IGCM_sys_RmRunDir : error."
-        cat out_rsync
-        IGCM_debug_Exit "IGCM_sys_RmRunDir"
-    else
-        \rm out_rsync
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_RmRunDir :" $@
+  fi
+
+  typeset RET
+
+  echo rm $@ > out_rsync 2>&1
+  \rm $@ >> out_rsync 2>&1
+  RET=$?
+
+  if [ ${RET} -gt 0 ] ; then
+    echo "IGCM_sys_RmRunDir : error."
+    cat out_rsync
+    IGCM_debug_Exit "IGCM_sys_RmRunDir"
+  else
+    \rm out_rsync
+  fi
+  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
 }
 
@@ -859,29 +948,29 @@
 #D-
 function IGCM_sys_Mv {
-    IGCM_debug_PushStack "IGCM_sys_Mv" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Mv :" $@
-    fi
-
-    if [ $DRYRUN = 0 ]; then
-
-        typeset RET
-            
-        echo mv $@ > out_rsync 2>&1
-        \mv $@ >> out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Mv" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Mv :" $@
+  fi
+
+  if [ $DRYRUN = 0 ]; then
+
+    typeset RET
     
-        if [ ${RET} -gt 0 ] ; then
-            echo "IGCM_sys_Mv : error in mv."
-            cat out_rsync
-            IGCM_debug_Exit "IGCM_sys_Mv"
-	else
-	    \rm out_rsync
-        fi
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error in mv."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Mv"
     else
-        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_Mv"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_Mv"
 }
 
@@ -892,76 +981,76 @@
 #D-
 function IGCM_sys_Put_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
-	    return
-	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      return
+    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Get_Dir
-#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Purpose: Copy a complete directory from ${ARCHIVE}
 #D-* Examples:
 #D-
 function IGCM_sys_Get_Dir {
-    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Dir :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-#	if [ ! -d ${1} ] ; then
-#	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
-#	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
-#	    return
-#	fi
-
-	typeset RET
-
-	# Only if we use rsync
-	#IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	#USUAL WAY
-        # add dmget (to demigrate all offline files) to reduce time of this command :
-        dmget $1/*
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Dir : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
-	else
-	    \rm out_rsync
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Dir :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+#    if [ ! -d ${1} ] ; then
+#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+#      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+#      return
+#    fi
+
+    typeset RET
+
+    # Only if we use rsync
+    #IGCM_sys_TestDirArchive $( dirname $2 )
+    #
+    # USUAL WAY
+    # add dmfind/dmget (to demigrate all offline files) :
+    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Dir : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Dir"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
 }
 
@@ -972,64 +1061,65 @@
 #D-
 function IGCM_sys_Get_Master {
-    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get_Master :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -d ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
-	    return
-	fi
-
-	typeset RET
-
-	#USUAL WAY
-	\cp -r $1 $2 > out_rsync 2>&1
-  	RET=$?
-
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get_Master : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get_Master"
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get_Master :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${1} ] ; then
+      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      return
+    fi
+
+    typeset RET
+
+    #USUAL WAY
+    \cp -r $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get_Master : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get_Master"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get_Master"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Rest
-#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-* Purpose: Put computied restarts on ${ARCHIVE}.
 #D-           File and target directory must exist.
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Rest {
-    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Rest :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	fi
-
-	typeset RET
-	#
-	if [ X${JobType} = XRUN ] ; then
-	    IGCM_sys_Chmod 444 ${1}
-	fi
-	#
-	IGCM_sys_TestDirArchive $( dirname $2 )
-	#
-	# USUAL WAY
-	\cp $1 $2 > out_rsync 2>&1
-        RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1043,65 +1133,106 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Rest : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Rest"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Rest
+#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Rest {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
 }
 
 #D-#==================================================
 #D-function IGCM_sys_Put_Out
-#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
 #D-* Examples:
 #D-
 function IGCM_sys_Put_Out {
-    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Put_Out :" $@
-    fi
-    if [ $DRYRUN = 0 ]; then
-	if [ ! -f ${1} ] ; then
-	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
-	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-	    return 1
-	fi
-	#
-	IGCM_sys_MkdirArchive $( dirname $2 )
-        #
-	typeset RET
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    typeset WORKPATH FILEPATH
-	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
-	#    IGCM_sys_MkdirWork ${WORKPATH} 
-	#    FILEPATH=${WORKPATH}/$( basename $2 )
-        #    #
-	#    IGCM_sys_Cp ${1} ${FILEPATH}
-	#fi
-
-	if [ X${JobType} = XRUN ] ; then
-	    if [ X${3} = X ] ; then
-		IGCM_sys_Chmod 444 ${1}
-	    fi
-	fi
-	#
-        # USUAL WAY
-	\cp $1 $2 > out_rsync 2>&1
-	RET=$?
+  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_MkdirArchive $( dirname $2 )
+    #
+    typeset RET
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    typeset WORKPATH FILEPATH
+    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )
+    #    IGCM_sys_MkdirWork ${WORKPATH} 
+    #    FILEPATH=${WORKPATH}/$( basename $2 )
+    #    #
+    #    IGCM_sys_Cp ${1} ${FILEPATH}
+    #fi
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1115,16 +1246,61 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Put_Out : error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Put_Out"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Put_Out"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Put_Out"
-    return 0
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Out"
+  return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Out
+#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Out {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_Mkdir $( dirname $2 )
+    #
+    typeset RET
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+	IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+  return 0
 }
 
@@ -1135,89 +1311,88 @@
 #D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
 function IGCM_sys_Get {
-    IGCM_debug_PushStack "IGCM_sys_Get" $@
-
-    typeset DEST RET dm_liste ifile target file_work 
-
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_Get :" $@
-    fi
-    if [ $DRYRUN -le 2 ]; then
-	if [ X${1} = X'/l' ] ; then
-            # test if the first file is present in the old computation :
-	    eval set +A dm_liste \${${2}}
-	else
-	    eval set +A dm_liste ${1}
-	fi
-	eval DEST=\${${#}}
-
-	#=====================================================
-        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
-        #=====================================================
-
-	# Is it an R_OUT file (not R_IN) ?
-	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
-	#if [ $? -eq 0 ] ; then
-	#    # Yes  ? then we try to get it in SCRATCHDIR
-	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
-	#    if [ -f ${file_work[0]} ] ; then
-	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
-	#	IGCM_debug_PopStack "IGCM_sys_Get"
-	#	return
-	#    fi
-	#fi
-
-	# test if the (first) file is present in the old computation :
-	IGCM_sys_TestFileArchive ${dm_liste[0]}
-	RET=$?
-        if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	fi
-
-	dmget ${dm_liste[*]} > out_rsync 2>&1
-  	RET=$?
-
-  	if [ ${RET} -gt 0 ] ; then
-	    echo "WARNING IGCM_sys_Get : demigration error."
-	    cat out_rsync
-	    echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
-  	fi
-
-	#if [ ${RET} -gt 0 ] ; then
-	#    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
-	#	cat out_rsync
-	#	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
-	#	sleep 30
-	#	echo "We try another time"
-	#	dmget ${dm_liste[*]} > out_rsync 2>&1
-	#	RET=$?
-	#	if [ ${RET} -gt 0 ] ; then
-	#	    echo "ERROR IGCM_sys_Get : again demigration error :"
-	#	    cat out_rsync
-	#	    IGCM_debug_Exit "IGCM_sys_Get"
-	#	fi
-	#    else
-	#	echo "ERROR IGCM_sys_Get : demigration error :"
-	#	cat out_rsync
-	#	IGCM_debug_Exit "IGCM_sys_Get"
-	#    fi
-	#fi
-
-        #USUAL WAY
-	if [ X${1} = X'/l' ] ; then
-	    (( RET=0 ))
-	    for target in ${dm_liste[*]} ; do
-		local_file=$( basename ${target} )
-		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
-		(( RET = RET + $? ))
-	    done
-	else
-	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-	    RET=$?
-	fi
+  IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+  typeset DEST RET dm_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Get :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A dm_liste \${${2}}
+    else
+      eval set +A dm_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #=====================================================
+    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+    #=====================================================
+
+    # Is it an R_OUT file (not R_IN) ?
+    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+    #if [ $? -eq 0 ] ; then
+    #    # Yes  ? then we try to get it in SCRATCHDIR
+    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )
+    #    if [ -f ${file_work[0]} ] ; then
+    #	IGCM_sys_Cp ${file_work[*]} ${DEST}
+    #	IGCM_debug_PopStack "IGCM_sys_Get"
+    #	return
+    #    fi
+    #fi
+
+    # test if the (first) file is present in the old computation :
+    IGCM_sys_TestFileArchive ${dm_liste[0]}
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_Get"
+    fi
+
+    dmget ${dm_liste[*]} > out_rsync 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : demigration error."
+      cat out_rsync
+      echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
+    fi
+
+    #if [ ${RET} -gt 0 ] ; then
+    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
+    #	cat out_rsync
+    #	echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : "
+    #	sleep 30
+    #	echo "We try another time"
+    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #	RET=$?
+    #	if [ ${RET} -gt 0 ] ; then
+    #	    echo "ERROR IGCM_sys_Get : again demigration error :"
+    #	    cat out_rsync
+    #	    IGCM_debug_Exit "IGCM_sys_Get"
+    #	fi
+    #    else
+    #	echo "ERROR IGCM_sys_Get : demigration error :"
+    #	cat out_rsync
+    #	IGCM_debug_Exit "IGCM_sys_Get"
+    #    fi
+    #fi
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${dm_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
 
 # 	#RSYNC WITH NETWORK SSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1231,18 +1406,64 @@
 #  	(( RET=RET+$? ))
 
-	if [ ${RET} -gt 0 ] ; then
-	    echo "IGCM_sys_Get : copy error."
-	    cat out_rsync
-	    IGCM_debug_Exit "IGCM_sys_Get"
-	else
-	    \rm out_rsync
-	fi
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Get : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_Get"
     else
-	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
-    fi
-    IGCM_debug_PopStack "IGCM_sys_Get"
-}
-
-############################################################## A FINIR !!
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work 
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+	local_file=$( basename ${target} )
+	\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+	(( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
+}
 
 #D-#==================================================
@@ -1252,10 +1473,14 @@
 #D-
 function IGCM_sys_GetDate_FichWork {
-    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichWork :" $@
-    fi
+  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichWork :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
     # donne la date filesys d'un fichier sur la machine work
-    IGCM_debug_PopStack "IGCM_sys_FichWork"
+  IGCM_debug_PopStack "IGCM_sys_FichWork"
 }
 
@@ -1266,9 +1491,116 @@
 #D-
 function IGCM_sys_GetDate_FichArchive {
-    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_GetDate_FichArchive :" $@
-    fi
-    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetDate_FichArchive :" $@
+  fi
+  typeset dateF
+  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+  eval ${2}=${dateF[5]}
+
+  IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Dods_Rm
+#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Dods_Rm {
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Rm :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+    RET=$?
+    
+#	if [ ${RET} -gt 0 ] ; then
+#	    echo "IGCM_sys_Dods_Rm : error."
+#	    cat out_dods_rm
+#	    IGCM_debug_Exit "IGCM_sys_Dods_Rm"
+#	else
+#	    rm out_dods_rm
+#	fi
+
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Dods_Cp
+#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Dods_Cp {
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Dods_Cp :" $@
+  fi
+  typeset RET
+  RET=0
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+      echo "Nothing has been done."
+      return
+    fi
+    #
+    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+    RET=$?
+
+# 	if [ ${RET} -gt 0 ] ; then
+# 	    echo "IGCM_sys_Dods_Cp : error."
+# 	    cat out_dods_cp
+# 	    IGCM_debug_Exit "IGCM_sys_Dods_Cp"
+# 	else
+# 	    rm out_dods_cp
+# 	fi
+
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  return $RET
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_Put_Dods :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -d ${R_SAVE}/${1} ] ; then
+      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+
+    typeset RET
+	#
+    cd ${R_SAVE}
+    IGCM_sys_Dods_Rm ${1}
+    IGCM_sys_Dods_Cp ${1}
+    RET=0
+    
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dods : error."
+      IGCM_debug_Exit "IGCM_sys_Put_Dods"
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
 }
 
@@ -1277,15 +1609,15 @@
 
 function IGCM_sys_rebuild {
-    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_rebuild :" $@
-    fi
-    /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_rebuild : erreur ${@}."
-       IGCM_debug_Exit "rebuild"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_rebuild"
+  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_rebuild :" $@
+  fi
+  /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_rebuild : erreur ${@}."
+    IGCM_debug_Exit "rebuild"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_rebuild"
 }
 
@@ -1294,36 +1626,32 @@
 
 function IGCM_sys_activ_variables {
-    IGCM_debug_PushStack "IGCM_sys_activ_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_activ_variables"
-    fi
-#    ulimit -s 2097152
-
-    typeset max_omp
-
-    ulimit -s unlimited
-
-    (( max_omp = 0 ))
-    for comp in ${config_ListOfComponents[*]} ; do
+  IGCM_debug_PushStack "IGCM_sys_activ_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_activ_variables"
+  fi
+
+  typeset max_omp
+
+  ulimit -s unlimited
+
+  (( max_omp = 0 ))
+  for comp in ${config_ListOfComponents[*]} ; do
 	
-	eval ExeNameIn=\${config_Executable_${comp}[0]}
-	eval ExeNameOut=\${config_Executable_${comp}[1]}
-	
+    eval ExeNameIn=\${config_Executable_${comp}[0]}
+    eval ExeNameOut=\${config_Executable_${comp}[1]}
     
-	# Only if we really have an executable for the component :
-	if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
-	    eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
-
-	    if [ ${comp_proc_omp_loc} -gt ${max_omp} ] ; then
-
-		(( max_omp = comp_proc_omp_loc ))
-	    fi
-	fi
-    done
-    if [ ${max_omp} -gt 1 ] ; then
-	module load openmp/${max_omp}thds
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+    # Only if we really have an executable for the component :
+    if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
+      eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
+      if [ ${comp_proc_omp_loc} -gt ${max_omp} ] ; then
+        (( max_omp = comp_proc_omp_loc ))
+      fi
+    fi
+  done
+  if [ ${max_omp} -gt 1 ] ; then
+    module load openmp/${max_omp}thds
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_activ_variables"
 }
 
@@ -1332,9 +1660,9 @@
 
 function IGCM_sys_desactiv_variables {
-    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_desactiv_variables"
-    fi
-    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_desactiv_variables"
+  fi
+  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
 }
 
@@ -1350,274 +1678,268 @@
 ############################################################
 # Build MPI/OMP scripts
-
 function IGCM_sys_build_execution_scripts 
 {
-    IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_build_execution_scripts " $@
-    fi
-    typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut 
-    typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc 
-    typeset num_corempi nombre_restant_node nombre_restant_comp
-
-    if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then
-        IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} "
-    fi
-
-    if ( ${OK_PARA_MPMD} ) ; then
-
-        if [ -f run_file ] ; then
-            IGCM_sys_Rm -f run_file
+  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_build_execution_scripts " $@
+  fi
+  typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut 
+  typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc 
+  typeset num_corempi nombre_restant_node nombre_restant_comp
+
+  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then
+    IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} "
+  fi
+
+  if ( ${OK_PARA_MPMD} ) ; then
+
+    if [ -f run_file ] ; then
+      IGCM_sys_Rm -f run_file
+    fi
+    touch run_file
+
+    if ( ${OK_PARA_OMP} ) ; then
+
+      #  Hosts treatment
+
+      ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp
+	
+      i=0
+      rm -f hosts
+      IGCM_debug_Print 1 "sys Titane, Hosts avaible :"
+      for nodes in `cat hosts.tmp` ; do
+        host[$i]=$nodes
+        echo "${host[$i]} slots=8 max_slots=8" >> hosts
+        IGCM_debug_Print 1 ${host[$i]}
+        i=$((i+1))
+      done
+      rm -f hosts.tmp
+	    
+      listnodes=${host[*]}
+	    
+      EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 
+	
+      # Initialisation
+
+      init_node=y
+      node_num_current=0
+      start_num=0
+      init_exec=n
+
+      # Test : if oasis is there, we put it at the first position
+	    
+      for comp in ${config_ListOfComponents[*]} ; do
+		
+        if [ "X${comp}" = "XCPL" ]  ; then
+		    
+          eval ExeNameIn=\${config_Executable_${comp}[0]}
+          eval ExeNameOut=\${config_Executable_${comp}[1]}
+		    
+          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
+          echo ""  >> script_${ExeNameOut}.ksh
+          echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
+          echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
+          echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
+          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err"  >> script_${ExeNameOut}.ksh
+          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
+		    
+          init_node=n
+		    
+          (( nombre_restant_node = NUM_COREPERNODE - 1 ))
+          node_num_current=0
+          node_current=${host[${node_num_current}]}
+		    
+          EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 
+		    
+          init_exec=y
+          start_num=1
+		    
         fi
-        touch run_file
-
-	if ( ${OK_PARA_OMP} ) ; then
-
-    #  Hosts treatment
-
-	    ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp
-	
-	    i=0
-	    rm -f hosts
-	    IGCM_debug_Print 1 "sys Titane, Hosts avaible :"
-	    for nodes in `cat hosts.tmp`
-	    do
-		host[$i]=$nodes
-		echo "${host[$i]} slots=8 max_slots=8" >> hosts
-		IGCM_debug_Print 1 ${host[$i]}
-		i=$((i+1))
-	    done
-	    rm -f hosts.tmp
+		
+      done
 	    
-	    listnodes=${host[*]}
+      # Then loop on the components (except for oasis)
+
+      for comp in ${config_ListOfComponents[*]} ; do
+		
+        eval ExeNameIn=\${config_Executable_${comp}[0]}
+        eval ExeNameOut=\${config_Executable_${comp}[1]}
+		
+        # Only if we really have an executable for the component :
+        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
+
+          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
+          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
+		    
+          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
+          # echo "set -vx" >> script_${ExeNameOut}.ksh
+          echo ""  >> script_${ExeNameOut}.ksh
+          echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
+          echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
+          echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
+          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
+          echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >>  script_${ExeNameOut}.ksh
+          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}"  >> script_${ExeNameOut}.ksh
+          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
+		    
+          node_num=0
+		    
+          # We define the number of MPI process to be assigned for the component 
+
+          nombre_restant_comp=${comp_proc_mpi_loc}
+		    
+          # Loop on the allocated nodes
+
+          for node in ${listnodes} ; do
+
+            # We go to the current node
+            if [ ${node_num} = ${node_num_current} ] ; then
+
+	      node_current=${host[${node_num_current}]}
+
+              # If first time on the node : initialisation 
+
+              if [ ${init_node} = y ] ; then
+                nombre_restant_node=${NUM_COREPERNODE}
+	      fi
+			    
+              # Test on the number of OMP threads
+
+	      if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then
+                (( node_num = node_num + 1 ))
+                node_num_current=${node_num}
+                init_node=y
+                continue
+              fi
+
+              # Number of MPI process to assign
+
+              (( num_corempi = nombre_restant_node / comp_proc_omp_loc ))
+			    
+	      if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then
+                num_corempi=${nombre_restant_comp}
+              fi
+
+              (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc ))
+	      (( nombre_restant_comp = nombre_restant_comp - num_corempi ))
+			    
+	      if [ ${init_exec} = y ] ; then
+                EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
+	      else	
+                EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
+                init_exec=y
+              fi
+
+              ((  start_num = num_corempi + start_num ))
+			    
+            else
+			    
+              (( node_num = node_num + 1 )) 
+ 	      continue
+            fi
+			
+            # Test on the number of core/process remaining on the node/component 
+			
+            if [ ${nombre_restant_node} = 0 ] ; then
+              (( node_num = node_num + 1 ))
+	      node_num_current=${node_num}
+	      init_node=y
+
+              if [ ${nombre_restant_comp} = 0 ] ; then
+                break 1
+              fi
+            else
+
+              node_num_current=${node_num}
+	      init_node=n
+			    
+	      if [ ${nombre_restant_comp} = 0 ] ; then
+	        break 1
+	      fi
+            fi
+          done
+        fi
+      done
 	    
-	    EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 
-#	fi
-	
-# Initialisation
-
-	    init_node=y
-	    node_num_current=0
-	    start_num=0
-	    init_exec=n
-
-
-# Test : if oasis is there, we put it at the first position
-	    
-	    for comp in ${config_ListOfComponents[*]} ; do
+    else
+
+      # Then first loop on the components for the coupler ie oasis
+
+      ### the coupler ie oasis must be the first one
+      for comp in ${config_ListOfComponents[*]} ; do
 		
-		if [ "X${comp}" = "XCPL" ]  ; then
+        eval ExeNameOut=\${config_Executable_${comp}[1]}
+		
+        # for CPL component only
+        if [ "X${comp}" = "XCPL" ] ; then
+
+          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
 		    
-		    eval ExeNameIn=\${config_Executable_${comp}[0]}
-		    eval ExeNameOut=\${config_Executable_${comp}[1]}
+          if ( ${OK_PARA_MPI} ) ; then 
+            (( mpi_count = 1 ))
+            until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
+              echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
+              (( mpi_count = mpi_count + 1 ))
+            done
+          else
+            echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
+          fi
+        fi
+      done
+
+      # Then second loop on the components
+
+      for comp in ${config_ListOfComponents[*]} ; do
+		
+        eval ExeNameOut=\${config_Executable_${comp}[1]}
+		
+        # Only if we really have an executable for the component and not the coupler ie oasis:
+        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
+
+          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
 		    
-		    echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
-		    echo ""  >> script_${ExeNameOut}.ksh
-		    echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
-		    echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
-		    echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
-		    echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err"  >> script_${ExeNameOut}.ksh
-		    IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
-		    
-		    init_node=n
-		    
-		    (( nombre_restant_node = NUM_COREPERNODE - 1 ))
-		    node_num_current=0
-		    node_current=${host[${node_num_current}]}
-		    
-		    EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 
-		    
-		    init_exec=y
-		    start_num=1
-		    
-		fi
+          if ( ${OK_PARA_MPI} ) ; then 
+
+            (( mpi_count = 1 ))
+ 	    until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
+              echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
+              (( mpi_count = mpi_count + 1 ))
+            done
+          else
+            echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
+          fi
+        fi
+      done
+      IGCM_sys_Chmod u+x run_file
+
+      EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file"
+	  
+    fi
+
+  else # Only one executable. launch it.
+
+    for comp in ${config_ListOfComponents[*]} ; do
+
+      # Only if we really have an executable for the component :
+      eval ExeNameOut=\${config_Executable_${comp}[1]}
+      if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then	
 		
-	    done
-	    
-# Then loop on the components (except for oasis)
-
-	    for comp in ${config_ListOfComponents[*]} ; do
-		
-		eval ExeNameIn=\${config_Executable_${comp}[0]}
-		eval ExeNameOut=\${config_Executable_${comp}[1]}
-		
-		
-	# Only if we really have an executable for the component :
-		if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
-
-		    eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
-		    eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
-		    
-		    echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
-#		echo "set -vx" >> script_${ExeNameOut}.ksh
-		    echo ""  >> script_${ExeNameOut}.ksh
-		    echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
-		    echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
-		    echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
-		    echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
- 		    echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >>  script_${ExeNameOut}.ksh
-		    echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}"  >> script_${ExeNameOut}.ksh
-		    IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
-		    
-		    node_num=0
-		    
-# We define the number of MPI process to be assigned for the component 
-
-		    nombre_restant_comp=${comp_proc_mpi_loc}
-		    
-# Loop on the allocated nodes
-
-		    for node in ${listnodes} ; do
-
-# We go to the current node
-
-			if [ ${node_num} = ${node_num_current} ] ; then
-
-			    node_current=${host[${node_num_current}]}
-
-# If first time on the node : initialisation 
-
-			    if [ ${init_node} = y ] ; then
-				nombre_restant_node=${NUM_COREPERNODE}
-			    fi
-			    
-# Test on the number of OMP threads
-
-			    if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then
-				(( node_num = node_num + 1 ))
-				node_num_current=${node_num}
-				init_node=y
-				continue
-			    fi
-
-# Number of MPI process to assign
-
-			    (( num_corempi = nombre_restant_node / comp_proc_omp_loc ))
-			    
-			    if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then
-				num_corempi=${nombre_restant_comp}
-			    fi
-
-			    (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc ))
-			    (( nombre_restant_comp = nombre_restant_comp - num_corempi ))
-			    
-			    if [ ${init_exec} = y ] ; then
-				EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
-			    else	
-				EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
-				init_exec=y
-			    fi
-
-			    ((  start_num = num_corempi + start_num ))
-			    
-			else
-			    
-			    (( node_num = node_num + 1 )) 
-			    continue
-			fi
-			
-# Test on the number of core/process remaining on the node/component 
-			
-			if [ ${nombre_restant_node} = 0 ] ; then
-			    (( node_num = node_num + 1 ))
-			    node_num_current=${node_num}
-			    init_node=y
-
-			    if [ ${nombre_restant_comp} = 0 ] ; then
-				break 1
-			    fi
-			else
-
-			    node_num_current=${node_num}
-			    init_node=n
-			    
-			    if [ ${nombre_restant_comp} = 0 ] ; then
-				break 1
-			    fi
-			fi
-		    done
-		fi
-	    done
-	    
+        echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
+	echo ""  >> script_${ExeNameOut}.ksh
+        if ( ${OK_PARA_OMP} ) ; then 
+          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh	
+        fi
+	if  ( ${OK_PARA_MPI} ) ; then 
+          # Attention : a voir si sur 1 proc mais non //
+          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh
+          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
+          EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
 	else
-
- # Then first loop on the components for the coupler ie oasis
-
-### the coupler ie oasis must be the first one
-	    for comp in ${config_ListOfComponents[*]} ; do
-		
-		eval ExeNameOut=\${config_Executable_${comp}[1]}
-		
-	# for CPL component only
-		if [ "X${comp}" = "XCPL" ] ; then
-
-		    eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
-		    
-		    if ( ${OK_PARA_MPI} ) ; then 
-			(( mpi_count = 1 ))
-			until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
-			    echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
-			    (( mpi_count = mpi_count + 1 ))
-			done
-		    else
-			echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
-		    fi
-		fi
-	    done
-
-# Then second loop on the components
-
-	    for comp in ${config_ListOfComponents[*]} ; do
-		
-		eval ExeNameOut=\${config_Executable_${comp}[1]}
-		
-	# Only if we really have an executable for the component and not the coupler ie oasis:
-		if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
-
-		    eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
-		    
-		    if ( ${OK_PARA_MPI} ) ; then 
-
-			(( mpi_count = 1 ))
-			until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
-			    echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
-			    (( mpi_count = mpi_count + 1 ))
-			done
-		    else
-			echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
-		    fi
-		fi
-	    done
-	    IGCM_sys_Chmod u+x run_file
-
-	    EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file"
-	  
-	fi
-
-    else # Only one executable. launch it.
-
-	for comp in ${config_ListOfComponents[*]} ; do
-
-	# Only if we really have an executable for the component :
-	    eval ExeNameOut=\${config_Executable_${comp}[1]}
-	    if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then	
-		
-		echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
-		echo ""  >> script_${ExeNameOut}.ksh
-		if ( ${OK_PARA_OMP} ) ; then 
-		    echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh	
-		fi
-		if  ( ${OK_PARA_MPI} ) ; then 
-# Attention : a voir si sur 1 proc mais non //
-		    echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh
-		    IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
-		    EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
-		else
-		    EXECUTION="time ./${ExeNameOut}"
-		fi
-	    fi
-	done
-
-    fi
+          EXECUTION="time ./${ExeNameOut}"
+        fi
+      fi
+    done
+
+  fi
 
   IGCM_debug_Print 1 "sys Titane : La commande d execution est "
@@ -1632,169 +1954,204 @@
 # NCO OPERATOR
 
+function IGCM_sys_ncap2 {
+  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncap2 :" $@
+  fi
+  ncap2 "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncap2 : erreur ${@}."
+    IGCM_debug_Exit "ncap2"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncap2"
+}
+
 function IGCM_sys_ncatted {
-    IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncatted :" $@
-    fi
-    ncatted "$@"
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncatted : erreur ${@}."
-       IGCM_debug_Exit "ncatted"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncatted"
+  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncatted :" $@
+  fi
+  ncatted "$@"
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncatted : erreur ${@}."
+    IGCM_debug_Exit "ncatted"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncatted"
 }
 
 function IGCM_sys_ncbo {
-    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncbo :" $@
-    fi
-    ncbo $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncbo : erreur ${@}."
-       IGCM_debug_Exit "ncbo"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncbo"
+  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncbo :" $@
+  fi
+  ncbo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncbo : erreur ${@}."
+    IGCM_debug_Exit "ncbo"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncbo"
 }
 
 function IGCM_sys_ncdiff {
-    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncdiff :" $@
-    fi
-    ncdiff $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncdiff : erreur ${@}."
-       IGCM_debug_Exit "ncdiff"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncdiff :" $@
+  fi
+  ncdiff $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncdiff : erreur ${@}."
+    IGCM_debug_Exit "ncdiff"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncdiff"
 }
 
 function IGCM_sys_ncea {
-    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncea :" $@
-    fi
-    ncea $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncea : erreur ${@}."
-       IGCM_debug_Exit "ncea"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncea"
+  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncea :" $@
+  fi
+  ncea $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncea : erreur ${@}."
+    IGCM_debug_Exit "ncea"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncea"
 }
 
 function IGCM_sys_ncecat {
-    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncecat :" $@
-    fi
-    ncecat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncecat : erreur ${@}."
-       IGCM_debug_Exit "ncecat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncecat"
+  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncecat :" $@
+  fi
+  ncecat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncecat : erreur ${@}."
+    IGCM_debug_Exit "ncecat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncecat"
 }
 
 function IGCM_sys_ncflint {
-    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncflint :" $@
-    fi
-    ncflint $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncflint : erreur ${@}."
-       IGCM_debug_Exit "ncflint"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncflint"
+  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncflint :" $@
+  fi
+  ncflint $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncflint : erreur ${@}."
+    IGCM_debug_Exit "ncflint"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncflint"
 }
 
 function IGCM_sys_ncks {
-    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncks :" $@
-    fi
-    ncks $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncks : erreur ${@}."
-       IGCM_debug_Exit "ncks"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncks"
+  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncks :" $@
+  fi
+  ncks $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncks : erreur ${@}."
+    IGCM_debug_Exit "ncks"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncks"
 }
 
 function IGCM_sys_ncpdq {
-    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncpdq :" $@
-    fi
-    ncpdq $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncpdq : erreur ${@}."
-       IGCM_debug_Exit "ncpdq"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncpdq :" $@
+  fi
+  ncpdq $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncpdq : erreur ${@}."
+    IGCM_debug_Exit "ncpdq"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncpdq"
 }
 
 function IGCM_sys_ncra {
-    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncra :" $@
-    fi
-    ncra $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncra : erreur ${@}."
-       IGCM_debug_Exit "ncra"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncra"
+  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncra :" $@
+  fi
+  ncra $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncra : erreur ${@}."
+    IGCM_debug_Exit "ncra"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncra"
 }
 
 function IGCM_sys_ncrcat {
-    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrcat :" $@
-    fi
-    ncrcat $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrcat : erreur ${@}."
+  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrcat :" $@
+  fi
+  ncrcat $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrcat : erreur ${@}."
 #       IGCM_debug_Exit "ncrcat"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrcat"
 }
 
 function IGCM_sys_ncrename {
-    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncrename :" $@
-    fi
-    ncrename $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncrename : erreur ${@}."
-       IGCM_debug_Exit "ncrename"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncrename"
+  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncrename :" $@
+  fi
+  ncrename $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncrename : erreur ${@}."
+    IGCM_debug_Exit "ncrename"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncrename"
 }
 
 function IGCM_sys_ncwa {
-    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_ncwa :" $@
-    fi
-    ncwa $@
-    if [ $? -gt 0 ] ; then
-       echo "IGCM_sys_ncwa : erreur ${@}."
-       IGCM_debug_Exit "ncwa"
-    fi
-
-    IGCM_debug_PopStack "IGCM_sys_ncwa"
-}
+  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_ncwa :" $@
+  fi
+  ncwa $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_ncwa : erreur ${@}."
+    IGCM_debug_Exit "ncwa"
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+##############################################################
+# CDO OPERATOR
+
+function IGCM_sys_cdo {
+  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_cdo :" $@
+  fi
+  \cdo $@
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_cdo : erreur ${@}."
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+    return 1
+  else
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+    return 0
+  fi
+
+  IGCM_debug_PopStack "IGCM_sys_cdo"
+}
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_ulam.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_ulam.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_ulam.ksh	(revision 571)
@@ -101,11 +101,10 @@
 #====================================================
 #- ARCHIVE
-# modified 17/10/2011 /u to be used for file stored on gaya
-if (tty -s ) then 
-typeset -r ARCHIVE=${HOMEGAYA}
-else
-typeset -r ARCHIVE=$(echo ${HOMEGAYA}|sed 's,/homegaya/,/u/',)
+# modified 17/10/2011 /u to be used for file stored on gaya 
+if (tty -s ) then  
+    typeset -r ARCHIVE=${HOMEGAYA} 
+else 
+    typeset -r ARCHIVE=$(echo ${HOMEGAYA}|sed 's,/homegaya/,/u/',) 
 fi
-
 
 #====================================================
@@ -119,4 +118,8 @@
 
 #====================================================
+#- R_BUF  Buffer to pack files stored on Master
+typeset -r R_BUF=${WORKDIR}/BUFFER_IGCM
+
+#====================================================
 #- OUT_POST
 typeset -r R_OUT_POST=${WORKDIR}/IGCM_OUT
@@ -128,5 +131,5 @@
 #====================================================
 #- Max number of arguments passed to nco operator or demigration command
-UNIX_MAX_LIMIT=12
+UNIX_MAX_LIMIT=120
 
 #D-#==================================================
@@ -378,7 +381,7 @@
 	echo "IGCM_sys_TestDirArchive :" $@
     fi
-    typeset ExistFlag DirNameToTest
-    # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam
-    DirNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,')
+    typeset ExistFlag DirNameToTest 
+    # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 
+    DirNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,') 
     ExistFlag=$( [ -d ${DirNameToTest} ] && echo 0 || echo 1 )
     IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
@@ -397,8 +400,8 @@
 	echo "IGCM_sys_TestFileArchive :" $@
     fi
-    typeset ExistFlag FileNameToTest
-    # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam
-    FileNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,')
-    ExistFlag=$( IGCM_sys_RshArchive "[ -f ${FileNameToTest} ] && echo 0 || echo 1" )
+    typeset ExistFlag FileNameToTest 
+    # modified 17/10/2011 /u is not known on ulam, use /homegaya instead to test dir locally on ulam 
+    FileNameToTest=$(echo $1 | sed 's,/u/,/homegaya/,') 
+    ExistFlag=$( IGCM_sys_RshArchive "[ -f ${FileNameToTest} ] && echo 0 || echo 1" ) 
     IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
 
@@ -491,4 +494,5 @@
 	IGCM_debug_Exit "IGCM_sys_QsubPost"
     fi
+
     IGCM_debug_PopStack "IGCM_sys_QsubPost"
 }
Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 570)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 571)
@@ -81,5 +81,5 @@
 typeset -r RSYNC_opt="-va"
 # ie storage filesystem
-typeset -r RHOST=gaya.idris.fr
+typeset -r STOREHOST=gaya.idris.fr
 typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync
 
@@ -118,4 +118,8 @@
 #- OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_BUF  Buffer to pack files
+typeset -r R_BUF=${WORKDIR}/BUFFER_IGCM
 
 #====================================================
@@ -149,4 +153,43 @@
 
 #D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Connection to frontend machine.
+#D-* Examples:
+#D-
+(( RshMNum = 0 ))
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+
+    typeset THEFILE OUTFILE ERR
+
+    RshDIR=${WORKDIR}/RUN_DIR/${config_UserChoices_TagName}/${config_UserChoices_JobName}.${$}
+    if [ ! -d ${RshDIR} ] ; then
+	IGCM_sys_Mkdir ${RshDIR}
+    fi
+    THEFILE=${RshDIR}/file_sys_RshMaster_$$_${RshMNum}
+    echo '#!/bin/ksh' > ${THEFILE}
+    echo "export libIGCM=${libIGCM} > /dev/null 2>&1" >> ${THEFILE}
+    echo "export DEBUG_debug=${DEBUG_debug} > /dev/null 2>&1" >> ${THEFILE}
+    echo ". ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh > /dev/null 2>&1" >> ${THEFILE}
+    echo ". ${libIGCM}/libIGCM_card/libIGCM_card.ksh > /dev/null 2>&1" >> ${THEFILE}
+    echo "${@} " >> ${THEFILE}
+
+    # No frontend queue on brodie : just rsh the job on the frontend with submission.
+    sed -e "s@IGCM_sys_Qsub\(.*\)@\1@" ${THEFILE} > ${THEFILE}_
+
+    chmod u+x  ${THEFILE}_
+
+    OUTFILE=${RshDIR}/out_RshMaster.$$.${RshMNum}
+    (( RshMNum = RshMNum + 1 ))
+
+    rsh ${MASTER} 'bash -c "nohup '${THEFILE}'_ > '${OUTFILE}' 2>&1 &"'
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_RshArchive
 #D-* Purpose: Archive rsh command
@@ -155,5 +198,5 @@
 function IGCM_sys_RshArchive {
     IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
-    rsh gaya exec /bin/ksh <<-EOF
+    rsh ${STOREHOST} exec /bin/ksh <<-EOF
     ${@}
 EOF
@@ -177,10 +220,10 @@
 
     # keep standard input to keep it for postpone if ulam don't answer
-    cat >/tmp/tmp_IGCM_sys_RshPost_$$
+    cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
 
     ## Add submission for old postponed files only if command is a Qsub
     ##
     ISITQSUB=0
-    grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$ >/dev/null 2>&1 && ISITQSUB=1
+    grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} >/dev/null 2>&1 && ISITQSUB=1
     if  ( [ ${ISITQSUB} -gt 0 ] ) ; then 
       if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then
@@ -201,12 +244,14 @@
     RETURN=0
     # rsh ulam command
-    rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$
+    rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
     RETURN=$?
 
     # keep standard input for postpone if ulam don't answer
     if ( [ ${RETURN} -gt 0 ] ) ; then
-        IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$"
+        IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$_${LOGNAME}"
         [ -d ${SUBMIT_DIR}/POSTPONE ] || mkdir ${SUBMIT_DIR}/POSTPONE
-        mv /tmp/tmp_IGCM_sys_RshPost_$$ ${SUBMIT_DIR}/POSTPONE
+        mv /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} ${SUBMIT_DIR}/POSTPONE
+    else
+        IGCM_sys_Rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
     fi
     IGCM_debug_PopStack "IGCM_sys_RshPost"
@@ -290,5 +335,5 @@
     fi
     #- creation de repertoire sur le serveur fichier
-    rsh gaya -n mkdir -p $1
+    rsh ${STOREHOST} -n mkdir -p $1
 
     if [ $? -gt 0 ] ; then
@@ -413,4 +458,22 @@
 
 #D-#==================================================
+#D-function IGCM_sys_IsFileArchived
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* always true on vargas.
+#D-* Examples:
+#D-
+function IGCM_sys_IsFileArchived {
+  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_IsFileArchived :" $@
+  fi
+  typeset IsArchivedFlag
+  IsArchivedFlag=$( echo 0 )
+  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
+
+  return ${IsArchivedFlag}
+}
+
+#D-#==================================================
 #D-function IGCM_sys_TestFileArchive
 #D-* Purpose: Test file that must NOT EXISTS on Archive
@@ -427,4 +490,18 @@
 
 #D-#==================================================
+#D-function IGCM_sys_TestFileBuffer
+#D-* Purpose: Test file that must NOT EXISTS on Buffer
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
+  typeset ExistFlag
+  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
+
+  return ${ExistFlag}
+}
+
+#D-#==================================================
 #D-function IGCM_sys_CountFileArchive
 #D-* Purpose: Count files on Archive filesystem
@@ -441,4 +518,18 @@
 
 #D-#==================================================
+#D-function IGCM_sys_CountFileBuffer
+#D-* Purpose: Count files on Scratch filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileBuffer {
+  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
+  ls ${@} 2>/dev/null | wc -l
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_CountFileBuffer : erreur."
+  fi
+  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
+}
+
+#D-#==================================================
 #D-function IGCM_sys_Tree
 #D-* Purpose: Tree directories with files on ${ARCHIVE}
@@ -466,11 +557,9 @@
 	echo "IGCM_sys_Tar :" $@
     fi
-    \tar cvf $@
+    \tar cf $@
     if [ $? -gt 0 ] ; then
 	echo "IGCM_sys_Tar : erreur."
 	IGCM_debug_Exit "IGCM_sys_Tar"
     fi
-    \tar tvf $1
-
     IGCM_debug_PopStack "IGCM_sys_Tar"
 }
@@ -532,4 +621,5 @@
     fi
     cd ${POST_DIR}
+    echo MAF QsubPost vargas
     /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job
     cd -
@@ -742,4 +832,6 @@
 	cat out_rsync
 	IGCM_debug_Exit "IGCM_sys_Cp"
+     else
+	 \rm out_rsync
     fi
     IGCM_debug_PopStack "IGCM_sys_Cp"
@@ -784,4 +876,6 @@
             cat out_rsync
             IGCM_debug_Exit "IGCM_sys_Mv"
+	else
+	    \rm out_rsync
         fi
     else
@@ -815,5 +909,5 @@
 	#
 	#USUAL WAY
-	rcp -r $1 gaya:$2 > out_rsync 2>&1
+	rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1
   	RET=$?
 
@@ -822,4 +916,6 @@
 	    cat out_rsync
 	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	else
+	    \rm out_rsync
 	fi
     else
@@ -849,5 +945,5 @@
 
 	#USUAL WAY
-	rcp -rp gaya:$1 $2 > out_rsync 2>&1
+	rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1
   	RET=$?
 
@@ -894,6 +990,6 @@
 
 # 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -911,4 +1007,6 @@
 	    cat out_rsync
 	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	else
+	    \rm out_rsync
 	fi
     else
@@ -916,4 +1014,45 @@
     fi
     IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Rest
+#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Rest {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Rest :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    fi
+
+    typeset RET
+    #
+    if [ X${JobType} = XRUN ] ; then
+      IGCM_sys_Chmod 444 ${1}
+    fi
+
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
 }
 
@@ -951,6 +1090,6 @@
 
 # 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -968,4 +1107,6 @@
 	    cat out_rsync
 	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	else
+	    \rm out_rsync
 	fi
 	IGCM_sys_Rm out_rsync
@@ -975,4 +1116,49 @@
     IGCM_debug_PopStack "IGCM_sys_Put_Out"
     return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_PutBuffer_Out
+#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_PutBuffer_Out {
+  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_PutBuffer_Out :" $@
+  fi
+  if [ $DRYRUN = 0 ]; then
+    if [ ! -f ${1} ] ; then
+      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
+      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+      return 1
+    fi
+    #
+    IGCM_sys_Mkdir $( dirname $2 )
+    #
+    typeset RET
+
+    if [ X${JobType} = XRUN ] ; then
+      if [ X${3} = X ] ; then
+        IGCM_sys_Chmod 444 ${1}
+      fi
+    fi
+    #
+    # USUAL WAY
+    \cp $1 $2 > out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Out : error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
+  return 0
 }
 
@@ -1025,6 +1211,6 @@
 
 # 	#RSYNC WITH NETWORK RSH CALL
-# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
-# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
 #  	#RSYNC WITH NFS USE
@@ -1042,4 +1228,6 @@
 	    cat out_rsync
 	    IGCM_debug_Exit "IGCM_sys_Get"
+	else
+	    \rm out_rsync
 	fi
     else
@@ -1047,4 +1235,52 @@
     fi
     IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetBuffer
+#D-* Purpose: Get a file from ${SCRATCHDIR}
+#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
+function IGCM_sys_GetBuffer {
+  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
+
+  typeset DEST RET buf_liste ifile target file_work
+
+  if ( $DEBUG_sys ) ; then
+    echo "IGCM_sys_GetBuffer :" $@
+  fi
+  if [ $DRYRUN -le 2 ]; then
+    if [ X${1} = X'/l' ] ; then
+      # test if the first file is present in the old computation :
+      eval set +A buf_liste \${${2}}
+    else
+      eval set +A buf_liste ${1}
+    fi
+    eval DEST=\${${#}}
+
+    #USUAL WAY
+    if [ X${1} = X'/l' ] ; then
+      (( RET=0 ))
+      for target in ${buf_liste[*]} ; do
+        local_file=$( basename ${target} )
+        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+        (( RET = RET + $? ))
+      done
+    else
+      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
+      RET=$?
+    fi
+
+    if [ ${RET} -gt 0 ] ; then
+      echo "IGCM_sys_GetBuffer : copy error."
+      cat out_rsync
+      IGCM_debug_Exit "IGCM_sys_GetBuffer"
+    else
+      \rm out_rsync
+    fi
+  else
+    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+  fi
+  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
 }
 
@@ -1061,4 +1297,8 @@
 	echo "IGCM_sys_GetDate_FichWork :" $@
     fi
+    typeset dateF
+    set +A dateF -- $( rsh ${MASTER} -n /opt/freeware/bin/ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+    eval ${2}=${dateF[5]}
+
     # donne la date filesys d'un fichier sur la machine work
     IGCM_debug_PopStack "IGCM_sys_FichWork"
@@ -1075,4 +1315,8 @@
 	echo "IGCM_sys_GetDate_FichArchive :" $@
     fi
+    typeset dateF
+    set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
+    eval ${2}=${dateF[5]}
+
     IGCM_debug_PopStack "IGCM_sys_FichArchive"
 }
