Index: /trunk/libIGCM/AA_pack_output
===================================================================
--- /trunk/libIGCM/AA_pack_output	(revision 627)
+++ /trunk/libIGCM/AA_pack_output	(revision 628)
@@ -336,4 +336,11 @@
 done
 
+# Flush post-processing submission
+if [ -f ${R_BUFR}/FlushPost_${DateEnd}.ksh ] ; then
+  . ${R_BUFR}/FlushPost_${DateEnd}.ksh
+  IGCM_FlushPost
+  #IGCM_sys_Rm -f ${R_BUFR}/FlushPost_${DateEnd}.ksh
+fi
+
 # Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 627)
+++ /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 628)
@@ -90,4 +90,16 @@
   IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}"
   #
+  # Prepare headers for the shell dedicated to offline rebuild
+  if ( [ ${PackFrequency} = true ] && ( [ ${TimeSeriesFrequency} = true ] || [ ${TimeSeriesFrequency} = true ] ) ) ; then
+    if [ $DRYRUN -le 1 ]; then
+      echo "#!/bin/ksh                                     " >  ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "function IGCM_FlushPost                        " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "{                                              " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "IGCM_debug_PushStack \"IGCM_FlushPost\"        " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "echo                                           " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "IGCM_debug_Print 1 \"IGCM_FlushPost\"          " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "echo                                           " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+    fi
+  fi
   IGCM_debug_PopStack "IGCM_post_Configure"
 }
@@ -148,40 +160,46 @@
 	if [ ${RebuildFrequency} = true ] ; then
 	  #
-	  if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+          if [ ${PackFrequency} = true ] ; then
+            FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+          else
+            FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+          fi
+          #
+	  if [ -f ${FunctionPath} ] ; then
 #	    if [ X${MASTER} = Xtitane ] ; then
-#	      echo "IGCM_sys_RshPost <<-EOF"                       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      echo "IGCM_sys_RshPost <<-EOF"                       >> ${FunctionPath}
 #	    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
+	    echo "export DEBUG_debug=${DEBUG_debug}              " >> ${FunctionPath}
+	    echo "export MODIPSL=${MODIPSL}                      " >> ${FunctionPath}
+	    echo "export libIGCM_SX=${libIGCM}                   " >> ${FunctionPath}
+	    echo "export libIGCM=${libIGCM_POST}                 " >> ${FunctionPath}
+	    echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${FunctionPath}
+	    echo "export POST_DIR=${POST_DIR}                    " >> ${FunctionPath}
+	    echo "export MASTER=${MASTER}                        " >> ${FunctionPath}
+	    echo "export RebuildFrequency=${RebuildFrequency}    " >> ${FunctionPath}
+	    echo "export DateBegin=${DateBegin}                  " >> ${FunctionPath}
+	    echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${FunctionPath}
+	    echo "export StandAlone=false                        " >> ${FunctionPath}
+	    echo "export CompletedFlag=${CompletedFlag}          " >> ${FunctionPath}
+	    echo "export TsTask=${TsTask}                        " >> ${FunctionPath}
+	    echo "unset  CompToRead                              " >> ${FunctionPath}
+	    echo "unset  FlagToRead                              " >> ${FunctionPath}
+	    echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${FunctionPath}
+	    echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${FunctionPath}
+	    echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${FunctionPath}
+	    echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${FunctionPath}
+	    echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${FunctionPath}
+	    echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${FunctionPath}
+	    echo "export listVarEnv=${listVarEnv}                " >> ${FunctionPath}
+	    echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath}
 #	    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
+#	      echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath}
+#	      echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${FunctionPath}
 #	    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
+	    echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${FunctionPath}
+	    echo "IGCM_debug_Verif_Exit_Post                     " >> ${FunctionPath}
+	    echo "IGCM_sys_QsubPost create_ts                    " >> ${FunctionPath}
 #	    if [ X${MASTER} = Xtitane ] ; then
-#	      echo "EOF"                                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	      echo "EOF"                                           >> ${FunctionPath}
 #	    fi
 	  fi
@@ -256,40 +274,46 @@
 	  if [ ${RebuildFrequency} = true ] ; then
 	    #
-	    if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+            if [ ${PackFrequency} = true ] ; then
+              FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+            else
+              FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            fi
+            #
+	    if [ -f ${FunctionPath} ] ; then
 #	      if [ X${MASTER} = Xtitane ] ; then
-#		echo "IGCM_sys_RshPost <<-EOF"                       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#		echo "IGCM_sys_RshPost <<-EOF"                       >> ${FunctionPath}
 #	      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
+	      echo "export DEBUG_debug=${DEBUG_debug}              " >> ${FunctionPath}
+	      echo "export MODIPSL=${MODIPSL}                      " >> ${FunctionPath}
+	      echo "export libIGCM_SX=${libIGCM}                   " >> ${FunctionPath}
+	      echo "export libIGCM=${libIGCM_POST}                 " >> ${FunctionPath}
+	      echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${FunctionPath}
+	      echo "export POST_DIR=${POST_DIR}                    " >> ${FunctionPath}
+	      echo "export MASTER=${MASTER}                        " >> ${FunctionPath}
+	      echo "export RebuildFrequency=${RebuildFrequency}    " >> ${FunctionPath}
+	      echo "export DateBegin=${ChunckTsDateBegin}          " >> ${FunctionPath}
+	      echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${FunctionPath}
+	      echo "export StandAlone=false                        " >> ${FunctionPath}
+	      echo "export CompletedFlag=${CompletedFlag}          " >> ${FunctionPath}
+	      echo "export TsTask=${TsTask}                        " >> ${FunctionPath}
+	      echo "export CompToRead=${CompToRead}                " >> ${FunctionPath}
+	      echo "export FlagToRead=${FlagToRead}                " >> ${FunctionPath}
+	      echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${FunctionPath}
+	      echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${FunctionPath}
+	      echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${FunctionPath}
+	      echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${FunctionPath}
+	      echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${FunctionPath}
+	      echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${FunctionPath}
+	      echo "export listVarEnv=${listVarEnv}                " >> ${FunctionPath}
+	      echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath}
 #	      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
+#		echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath}
+#		echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${FunctionPath}
 #	      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
+	      echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${FunctionPath}
+	      echo "IGCM_debug_Verif_Exit_Post                     " >> ${FunctionPath}
+	      echo "IGCM_sys_QsubPost create_ts                    " >> ${FunctionPath}
 #	      if [ X${MASTER} = Xtitane ] ; then
-#		echo "EOF"                                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#		echo "EOF"                                           >> ${FunctionPath}
 #	      fi
 	    fi
@@ -350,37 +374,43 @@
     if [ ${RebuildFrequency} = true ] ; then
       #
-      if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+      if [ ${PackFrequency} = true ] ; then
+        FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      else
+        FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+      fi
+      #
+      if [ -f ${FunctionPath} ] ; then
 	#
 #	if [ X${MASTER} = Xtitane ] ; then
-#	  echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	  echo "IGCM_sys_RshPost <<-EOF"                     >> ${FunctionPath}
 #	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
+	echo "export DEBUG_debug=${DEBUG_debug}              " >> ${FunctionPath}
+	echo "export MODIPSL=${MODIPSL}                      " >> ${FunctionPath}
+	echo "export libIGCM_SX=${libIGCM}                   " >> ${FunctionPath}
+	echo "export libIGCM=${libIGCM_POST}                 " >> ${FunctionPath}
+	echo "export SUBMIT_DIR=${SUBMIT_DIR}                " >> ${FunctionPath}
+	echo "export POST_DIR=${POST_DIR}                    " >> ${FunctionPath}
+	echo "export MASTER=${MASTER}                        " >> ${FunctionPath}
+	echo "export RebuildFrequency=${RebuildFrequency}    " >> ${FunctionPath}
+	echo "export DateBegin=${DateBegin}                  " >> ${FunctionPath}
+	echo "export PeriodDateEnd=${PeriodDateEnd}          " >> ${FunctionPath}
+	echo "export StandAlone=false                        " >> ${FunctionPath}
+	echo "export RESOL_ATM=${RESOL_ATM}                  " >> ${FunctionPath}
+	echo "export RESOL_OCE=${RESOL_OCE}                  " >> ${FunctionPath}
+	echo "export RESOL_ICE=${RESOL_ICE}                  " >> ${FunctionPath}
+	echo "export RESOL_MBG=${RESOL_MBG}                  " >> ${FunctionPath}
+	echo "export RESOL_SRF=${RESOL_SRF}                  " >> ${FunctionPath}
+	echo "export RESOL_SBG=${RESOL_SBG}                  " >> ${FunctionPath}
+	echo "export listVarEnv=${listVarEnv}                " >> ${FunctionPath}
+	echo "export Script_Post_Output=${Script_Post_Output}" >> ${FunctionPath}
 #	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
+#	  echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath}
+#	  echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${FunctionPath}
 #	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
+	echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${FunctionPath}
+	echo "IGCM_debug_Verif_Exit_Post                     " >> ${FunctionPath}
+	echo "IGCM_sys_QsubPost create_se                    " >> ${FunctionPath}
 #	if [ X${MASTER} = Xtitane ] ; then
-#	  echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	  echo "EOF"                                         >> ${FunctionPath}
 #	fi
       fi
@@ -415,7 +445,14 @@
   fi
 
-  #============== PACK PROCESSING FOR RESTART AND DEBUG FILES =============#
+  #============== PACK PROCESSING FOR RESTART, DEBUG AND OUTPUT FILES =============#
   if [ ${PackFrequency} = true ] ; then
     IGCM_debug_Print 1 "PACK POST-PROCESSING"
+    # -----------------------------------------------------------------------------------
+    # Function IGCM_FlushPost called by pack_output.job has not been closed yet. Do it now
+    # -----------------------------------------------------------------------------------
+    if [ -f ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh ] ; then
+      echo "IGCM_debug_PopStack \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+      echo "}                                      " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh
+    fi
     echo
     ## Need to Remember This One
