Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 714)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh	(revision 715)
@@ -827,5 +827,5 @@
   fi
 
-  typeset RET DEST
+  typeset status DEST
 
   mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
@@ -833,7 +833,7 @@
   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
+  status=$?
+
+  if [ ${status} -gt 0 ] ; then
     echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
     cat out_rsync
@@ -853,12 +853,12 @@
   fi
 
-  typeset RET
+  typeset status
 
   echo cp $@ > out_rsync 2>&1
   \cp $@ >> out_rsync 2>&1
-  RET=$?
-
-  if [ ${RET} -gt 0 ] ; then
-    echo "IGCM_sys_Cp : error code ${RET}"
+  status=$?
+
+  if [ ${status} -gt 0 ] ; then
+    echo "IGCM_sys_Cp : error code ${status}"
     cat out_rsync
     IGCM_debug_Exit "IGCM_sys_Cp"
@@ -880,12 +880,12 @@
   fi
 
-  typeset RET
+  typeset status
 
   echo rm $@ > out_rsync 2>&1
   \rm $@ >> out_rsync 2>&1
-  RET=$?
-
-  if [ ${RET} -gt 0 ] ; then
-    echo "IGCM_sys_Rm : error code ${RET}"
+  status=$?
+
+  if [ ${status} -gt 0 ] ; then
+    echo "IGCM_sys_Rm : error code ${status}"
     cat out_rsync
     IGCM_debug_Exit "IGCM_sys_Rm"
@@ -908,12 +908,12 @@
   fi
 
-  typeset RET
+  typeset status
 
   echo rm $@ > out_rsync 2>&1
   \rm $@ >> out_rsync 2>&1
-  RET=$?
-
-  if [ ${RET} -gt 0 ] ; then
-    echo "IGCM_sys_RmRunDir : error code ${RET}"
+  status=$?
+
+  if [ ${status} -gt 0 ] ; then
+    echo "IGCM_sys_RmRunDir : error code ${status}"
     cat out_rsync
     IGCM_debug_Exit "IGCM_sys_RmRunDir"
@@ -937,12 +937,12 @@
   if [ $DRYRUN = 0 ]; then
 
-    typeset RET
+    typeset status
 
     echo mv $@ > out_rsync 2>&1
     \mv $@ >> out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Mv : error code ${RET}"
+    status=$?
+
+    if [ ${status} -gt 0 ] ; then
+      echo "IGCM_sys_Mv : error code ${status}"
       cat out_rsync
       IGCM_debug_Exit "IGCM_sys_Mv"
@@ -974,5 +974,5 @@
     fi
 
-    typeset RET
+    typeset status
 
     # Only if we use rsync
@@ -981,8 +981,8 @@
     #USUAL WAY
     \cp -r $1 $2 > out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Put_Dir : error code ${RET}"
+    status=$?
+
+    if [ ${status} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Dir : error code ${status}"
       cat out_rsync
       IGCM_debug_Exit "IGCM_sys_Put_Dir"
@@ -1126,5 +1126,5 @@
     fi
 
-    typeset RET
+    typeset status
     #
     if [ X${JobType} = XRUN ] ; then
@@ -1135,5 +1135,5 @@
     # USUAL WAY
     \cp $1 $2 > out_rsync 2>&1
-    RET=$?
+    status=$?
 
 #       #RSYNC WITH NETWORK SSH CALL
@@ -1145,12 +1145,12 @@
 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
 
-#       RET=$?
-#       IGCM_sys_Rsync_out $RET
+#       status=$?
+#       IGCM_sys_Rsync_out $status
 
 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
-#       (( RET=RET+$? ))
-
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Put_Rest : cp failed error code ${RET}"
+#       (( status=status+$? ))
+
+    if [ ${status} -gt 0 ] ; then
+      echo "IGCM_sys_Put_Rest : cp failed error code ${status}"
       cat out_rsync
       IGCM_debug_Exit "IGCM_sys_Put_Rest"
@@ -1181,5 +1181,5 @@
     fi
 
-    typeset RET
+    typeset status
     #
     if [ X${JobType} = XRUN ] ; then
@@ -1190,8 +1190,8 @@
     # USUAL WAY
     \cp $1 $2 > out_rsync 2>&1
-    RET=$?
-
-    if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_PutBuffer_Rest : error code ${RET}"
+    status=$?
+
+    if [ ${status} -gt 0 ] ; then
+      echo "IGCM_sys_PutBuffer_Rest : error code ${status}"
       cat out_rsync
       IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
@@ -1448,12 +1448,12 @@
 
     ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
-    RET=$?
-    if [ ${RET} -gt 0 ] ; then
-      echo "WARNING IGCM_sys_Get : error code ${RET}"
+    status=$?
+    if [ ${status} -gt 0 ] ; then
+      echo "WARNING IGCM_sys_Get : error code ${status}"
       cat out_rsync
       echo "WARNING IGCM_sys_Get : will stop later if the cp fails."
     fi
 
-    #if [ ${RET} -gt 0 ] ; then
+    #if [ ${status} -gt 0 ] ; then
     #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then
     #	cat out_rsync
@@ -1463,6 +1463,6 @@
     ##	dmget ${dm_liste[*]} > out_rsync 2>&1
     #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
-    #	RET=$?
-    #	if [ ${RET} -gt 0 ] ; then
+    #	status=$?
+    #	if [ ${status} -gt 0 ] ; then
     #       echo "ERROR IGCM_sys_Get : again demigration error :"
     #       cat out_rsync
@@ -1484,6 +1484,6 @@
         # test if the target file is present before the loop
         IGCM_sys_TestFileArchive ${target}
-        RET=$?
-        if [ ${RET} -gt 0 ] ; then
+        status=$?
+        if [ ${status} -gt 0 ] ; then
           echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ."
           IGCM_debug_Exit "IGCM_sys_Get"
@@ -1506,5 +1506,5 @@
     else
       \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
-      RET=$?
+      status=$?
     fi
 
@@ -1517,6 +1517,6 @@
 #       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
 
-#       RET=$?
-#       IGCM_sys_Rsync_out $RET
+#       status=$?
+#       IGCM_sys_Rsync_out $status
 
 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
@@ -1524,6 +1524,7 @@
 
     if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_Get : error code ${RET}"
+      echo "IGCM_sys_Get : error"
       cat out_rsync
+      \rm out_rsync
       IGCM_debug_Exit "IGCM_sys_Get"
     else
@@ -1544,5 +1545,5 @@
   IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
 
-  typeset DEST RET buf_liste ifile target file_work
+  typeset DEST RET status buf_liste ifile target file_work
 
   if ( $DEBUG_sys ) ; then
@@ -1568,10 +1569,11 @@
     else
       \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
-      RET=$?
+      status=$?
     fi
 
     if [ ${RET} -gt 0 ] ; then
-      echo "IGCM_sys_GetBuffer : error code ${RET}"
+      echo "IGCM_sys_GetBuffer : error"
       cat out_rsync
+      \rm out_rsync
       IGCM_debug_Exit "IGCM_sys_GetBuffer"
     else
@@ -1628,6 +1630,5 @@
     echo "IGCM_sys_Dods_Rm :" $@
   fi
-  typeset RET
-  RET=0
+  typeset status
   if [ $DRYRUN = 0 ]; then
 
@@ -1639,7 +1640,7 @@
 
     /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
-    RET=$?
-
-#	if [ ${RET} -gt 0 ] ; then
+    status=$?
+
+#	if [ ${status} -gt 0 ] ; then
 #           echo "IGCM_sys_Dods_Rm : error."
 #           cat out_dods_rm
@@ -1652,5 +1653,5 @@
     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
   fi
-  return $RET
+  return $status
 }
 
@@ -1664,6 +1665,5 @@
     echo "IGCM_sys_Dods_Cp :" $@
   fi
-  typeset RET
-  RET=0
+  typeset status
   if [ $DRYRUN = 0 ]; then
 
@@ -1675,7 +1675,7 @@
 
     /ccc/cont003/home/dsm/p86ipsl/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
-    RET=$?
-
-#       if [ ${RET} -gt 0 ] ; then
+    status=$?
+
+#       if [ ${status} -gt 0 ] ; then
 #           echo "IGCM_sys_Dods_Cp : error."
 #           cat out_dods_cp
@@ -1688,5 +1688,5 @@
     ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
   fi
-  return $RET
+  return $status
 }
 
@@ -1702,5 +1702,5 @@
   fi
   #set -vx
-  typeset RET
+  typeset status
   if [ $DRYRUN = 0 ]; then
     if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then
@@ -1728,7 +1728,7 @@
     IGCM_sys_Dods_Rm ${1}
     IGCM_sys_Dods_Cp ${1}
-    RET=0
-
-    if [ ${RET} -gt 0 ] ; then
+    status=0
+
+    if [ ${status} -gt 0 ] ; then
       echo "IGCM_sys_Put_Dods : error."
       IGCM_debug_Exit "IGCM_sys_Put_Dods"
