Index: modipsl/trunk/util/ins_job
===================================================================
--- modipsl/trunk/util/ins_job	(revision 1642)
+++ modipsl/trunk/util/ins_job	(revision 1644)
@@ -108,11 +108,11 @@
  j=$(cd ${i%/*};/bin/pwd;)
  n_f=${F_RCI##*/};
- print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}";
 
  if [ ! X$( echo ${j} | grep USER_SPEC ) = X ] ; then
  # Do not treat config.card if it is in sub-directory of USER_SPEC
  # Continue to next config.card
-     echo "USER_SPEC directory exist in path, do not use this config.card"
      continue
+ else
+     print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}";
  fi
  
@@ -123,4 +123,6 @@
  config_UserChoices_JobNumProcTot=1
  config_UserChoices_UserSpec=""
+ RESOL_ATM_3D=this_is_a_test_string
+ RESOL=this_is_another_test_string
  typeset option
  for option in ${config_UserChoices[*]} ; do
@@ -128,8 +130,21 @@
  done
 
+# Find the JobName : JobName might contain the variable RESOL_ATM_3D that will be replaced by what is in .resol file
+ if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL_ATM_3D} ) = X ] ; then
+    TRUERESOL=$( find ../ -name ".resol" -exec tail -1 {} \; | awk "-F=" '{print $2}' )
+    JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL_ATM_3D}/${TRUERESOL}/" )
+    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName}
+ elif [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL} ) = X ] ; then
+     TRUERESOL=$( find ../ -name ".resol" -exec head -1 {} \; )
+     JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL}/${TRUERESOL}/" )
+     IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName}
+ else
+     JobName=${config_UserChoices_JobName}
+ fi
+ echo "JobName=${JobName}"
+
 # Add specific treatment for new type of directory structure 
   if [ -d ${j}/USER_SPEC ] && [ -d ${j}/GENERAL ] ; then
       echo "This is new configuration structure"
-      echo "JobName=${config_UserChoices_JobName}"
 
       if [ "X${config_UserChoices_UserSpec}" = X ] ; then
@@ -143,12 +158,12 @@
       fi
 
-      if [ -d ${j}/${config_UserChoices_JobName} ] ; then
-	  echo "Directory ${j}/${config_UserChoices_JobName} exist already, continue next config.card"
+      if [ -d ${j}/${JobName} ] ; then
+	  echo "Directory ${j}/${JobName} exist already, continue next config.card"
 	  continue
       fi
-      cp -r ${j}/USER_SPEC/${config_UserChoices_UserSpec} ${j}/${config_UserChoices_JobName}
-      cp -r ${j}/GENERAL/* ${j}/${config_UserChoices_JobName}/.
-      cp -f ${j}/${F_CFG}  ${j}/${config_UserChoices_JobName}/.
-      j=${j}/${config_UserChoices_JobName}
+      cp -r ${j}/USER_SPEC/${config_UserChoices_UserSpec} ${j}/${JobName}
+      cp -r ${j}/GENERAL/* ${j}/${JobName}/.
+      cp -f ${j}/${F_CFG}  ${j}/${JobName}/.
+      j=${j}/${JobName}
       echo new j=$j
   fi
@@ -160,21 +175,7 @@
    \cp ${F_RCI} ${j};
   }
- # We keep explicitly JobName because it is not optionnal.
- RESOL_ATM_3D=this_is_a_test_string
- RESOL=this_is_another_test_string
- if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL_ATM_3D} ) = X ] ; then
-    TRUERESOL=$( find ../ -name ".resol" -exec tail -1 {} \; | awk "-F=" '{print $2}' )
-    config_UserChoices_JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL_ATM_3D}/${TRUERESOL}/" )
-    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${config_UserChoices_JobName}
- else
-    if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL} ) = X ] ; then
-	    TRUERESOL=$( find ../ -name ".resol" -exec head -1 {} \; )
-	    config_UserChoices_JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL}/${TRUERESOL}/" )
-	    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${config_UserChoices_JobName}
-    fi
- fi
- 
+
  # File name for Job
- n_f='Job_'${config_UserChoices_JobName};
+ n_f='Job_'${JobName};
  [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; }
  print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}";
@@ -182,5 +183,5 @@
      -e "/^${W_P}/d"       \
      -e "s%::modipsl::%${F_MOD}%" \
-     -e "s/::Jobname::/${config_UserChoices_JobName}/" \
+     -e "s/::Jobname::/${JobName}/" \
      -e "s/::JobClass::/${config_UserChoices_JobClass}/" \
      -e "s/::JobNumProcTot::/${config_UserChoices_JobNumProcTot}/" \
