Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 2257)
+++ palm/trunk/SCRIPTS/mrun	(revision 2261)
@@ -27,4 +27,11 @@
 # -----------------
 # $Id$
+# unified cycle numbers for output files are used,
+# paths and filenames are allowed to contain arbitrary numbers of dots ".",
+# creation of file OUTPUT_FILE_CONNECTIONS removed,
+# archive feature completely removed from the script,
+# nech related parts completely removed
+# 
+# 2257 2017-06-07 14:07:05Z witha
 # adjustments for lceddy, removed lcflow-specific code
 # 
@@ -251,6 +258,4 @@
  add_source_path=""
  afname=""
- archive_save=true
- archive_system=none
  check_namelist_files=false
  combine_plot_fields=true
@@ -288,5 +293,4 @@
  host_file=""
  hp=""
- ignore_archive_error=false
  input_list=""
  interpreted_config_file=""
@@ -348,5 +352,4 @@
  run_coupled_model=false
  run_mode=""
- store_on_archive_system=false
  dashes="  ----------------------------------------------------------------------------"
  silent=false
@@ -370,5 +373,5 @@
                            # SIDE EFFECT MAY CAUSE DATA LOSS WHEN GETOPTS IS READING THE
                            # SCRIPT-OPTION ARGUMENTS
- typeset -i  cputime i ii iia iii iio icycle inode ival jobges jobsek last_char_int maxcycle minuten nodes pes remaining_pes sekunden tp1
+ typeset -i  cputime i ii iia iii iio icycle inode ival jobges jobsek last_char_int maxcycle minuten nodes pes remaining_pes run_number sekunden tp1
 
     # ERROR HANDLING IN CASE OF EXIT
@@ -450,9 +453,8 @@
     # READ SHELLSCRIPT-OPTIONS AND REBUILD THE MRUN-COMMAND STRING (MC),
     # WHICH WILL BE USED TO START RESTART-JOBS
- while  getopts  :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY:zZ option
+ while  getopts  :a:bBc:Cd:D:Fg:G:h:H:i:kK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY:zZ option
  do
    case  $option  in
        (a)   afname=$OPTARG;;
-       (A)   store_on_archive_system=true; mc="$mc -A";;
        (b)   do_batch=true; mc="$mc -b";;
        (B)   delete_temporary_catalog=false; mc="$mc -B";;
@@ -460,5 +462,4 @@
        (C)   restart_run=true; mc="$mc -C";;
        (d)   fname=$OPTARG; mc="$mc -d$OPTARG";;
-#        (D)   cpp_opts="$cpp_opts $OPTARG"; mc="$mc -D'$OPTARG'";;
        (F)   job_on_file="-D"; mc="$mc -F";;
        (g)   group_number=$OPTARG; mc="$mc -g$OPTARG";;
@@ -467,5 +468,4 @@
        (H)   fromhost=$OPTARG; mc="$mc -H$OPTARG";;
        (i)   input_list=$OPTARG; mc="$mc -i'$OPTARG'";;
-       (I)   ignore_archive_error=true; mc="$mc -I";;
        (k)   keep_data_from_previous_run=true; mc="$mc -k";;
        (K)   additional_conditions="$OPTARG"; mc="$mc -K'$OPTARG'";;
@@ -514,5 +514,4 @@
     printf "\n      Option  Description                              Default-Value"
     printf "\n        -a    base name of input files                 equiv. -d"
-    printf "\n        -A    archiving when using file-attribute fl"
     printf "\n        -b    batch-job on local machine               ---"
     printf "\n        -B    do not delete temporary directory at end ---"
@@ -523,6 +522,4 @@
     printf "\n        -h    execution host                           $localhost_realname"
     printf "\n        -i    INPUT control list                       \"\" "
-    printf "\n        -I    archiving errors of previous batch-jobs"
-    printf "\n              will be ignored"
     printf "\n        -k    keep data from previous run"
     printf "\n        -K    additional conditions for controling"
@@ -612,11 +609,4 @@
 
 
-    # SET HOST-SPECIFIC VARIABLES
- case  $localhost_realname  in
-     (r1*|r2*|h01*|b01*)     archive_system=tivoli;;
-     (cs*)                   archive_system=ut;;
- esac
-
-
     # ??? THIS SHOULD BE DECRIBED IN THE MRUN DOCUMENTATION ??? 
     # SET BASENAME OF THE INPUT-FILES TO THE GENERAL BASENAME (GIVEN BY OPTION -d),
@@ -655,5 +645,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmkisti|ibmku|ibms|nech|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -714,19 +704,4 @@
 
  fi
-
-    # CHECK, IF FILE-ARCHIVING HAS FAILED IN PREVIOUS JOB (OF A JOB-CHAIN)
- if [[ -f ~/job_queue/ARCHIVE_ERROR_$fname ]]
- then
-    if [[ $ignore_archive_error = false ]]
-    then
-       printf "\n  +++ data archiving of previous run failed"
-       printf "\n      see directory \~/job_queue on remote machine"
-       locat=archive; exit
-    else
-       printf "\n  +++ warning: data archiving in a previous run failed"
-       printf "\n      MRUN continues, trying to get backup copy"
-    fi
- fi
-
 
     # SAVE VALUES OF MRUN-OPTIONS SICHERN IN ORDER TO OVERWRITE
@@ -813,5 +788,5 @@
                    do_remote=true
                    case  $host  in
-                       (ibm|ibmh|ibmkisti|ibmku|ibms|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|nech|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
+                       (ibm|ibmh|ibmkisti|ibmku|ibms|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
                        (*)  printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
                             printf "\n      is not available"
@@ -938,5 +913,5 @@
 
        # PROVIDE VALUES OF ENVIRONMENT-VARIABLE FOR interpret_config VIA NAMELIST-FILE
-    cat  >  .mrun_environment  <<  %%END%%
+    cat  >  .mrun_environment  <<  EOF
  &mrun_environment  cond1 = '$cond1', cond2 = '$cond2', 
                     config_file = '$config_file', do_remote = '$do_remote',
@@ -945,5 +920,5 @@
                     localhost = '$localhost', output_list = '$output_list' /
 
-%%END%%
+EOF
 
     if [[ "$host" != $localhost ]]
@@ -1077,5 +1052,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmkisti|ibmku|ibms|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|nech|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|lcbullhh|lccrayb|lccrayh|lccrayf|lceddy|lckyoto|lcocean|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lckyuh|lckyut|lcsb)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -1220,5 +1195,4 @@
         (lckyut)     queue=cx-single;;
         (lctit)      queue=S;;
-        (nech)       queue=none;;
         (unics)      queue=unics;;
     esac
@@ -1256,5 +1230,5 @@
        then
           printf "\n\n  +++ INPUT-file: "
-          if [[ "${extin[$i]}" = "" ]]
+          if [[ "${extin[$i]}" = ""  ||  "${extin[$i]}" = " " ]]
           then
              printf "\n           $filename"
@@ -1274,19 +1248,42 @@
        while  read zeile
        do
-          cycle=$(echo $zeile | cut -f2 -d".")
-          if [[ "$cycle" = "$zeile" ]]
-          then
-             (( icycle = 0 ))
-          elif [[ "$cycle" = "${extin[$i]}" ]]
-          then
-             (( icycle = 0 ))
-          else
-             (( icycle = $cycle ))
-          fi
-          if (( icycle > maxcycle ))
-          then
-             (( maxcycle = icycle ))
-             file_to_be_used=$zeile
-          fi
+              # filename without path (i.e. after the last "/")
+           basefilename=$(basename ${zeile})
+
+              # check if there is an extension
+           extension=${basefilename##*.}
+           if [[ "$extension" = "$extin[$i]" ]]
+           then
+              basefilename=${basefilename&.*}
+           fi
+
+              # check for an existing cycle number
+           cycle=${basefilename##*.}
+           if [[ $cycle =~ ^-?[0-9]+$ ]]
+           then
+              (( icycle = $cycle ))
+           else
+              (( icycle = 0 ))
+           fi
+
+           if (( icycle > maxcycle ))
+           then
+              (( maxcycle = icycle ))
+           fi
+
+#          cycle=$(echo $zeile | cut -f2 -d".")
+#          if [[ "$cycle" = "$zeile" ]]
+#          then
+#             (( icycle = 0 ))
+#          elif [[ "$cycle" = "${extin[$i]}" ]]
+#          then
+#             (( icycle = 0 ))
+#          else
+#             (( icycle = $cycle ))
+#          fi
+#          if (( icycle > maxcycle ))
+#          then
+#             (( maxcycle = icycle ))
+#          fi
        done <filelist
        rm filelist
@@ -1309,5 +1306,5 @@
        
           # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER,
-          # BECAUSE IT MIGHT BE REQUIRED LATER TO RESTORE THE FILE FROM AN ARCHIVE-SYSTEM
+          # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE)
        absnamein[$i]=$filename
        if (( maxcycle > 0 ))
@@ -1374,4 +1371,5 @@
                    printf "\n           $catalogname"
                    printf "\n      was created\n"
+                   echo "### filename = $filename"
                 else
                    printf "\n\n  +++ OUTPUT-file:"
@@ -1397,15 +1395,40 @@
           while  read zeile
           do
-             cycle=$(echo $zeile | cut -f2 -d".")
-             if [[ "$cycle" = "$zeile"  ||  "$cycle" = ${extout[$i]} ]]
+
+                # filename without path (i.e. after the last "/")
+             basefilename=$(basename ${zeile})
+
+                # check if there is an extension
+             extension=${basefilename##*.}
+             if [[ "$extension" = "$extin[$i]" ]]
              then
+                basefilename=${basefilename&.*}
+             fi
+
+                # check for an existing cycle number
+             cycle=${basefilename##*.}
+             if [[ $cycle =~ ^-?[0-9]+$ ]]
+             then
+                (( icycle = $cycle + 1 ))
+             else
                 (( icycle = 1 ))
-             else
-                (( icycle = $cycle + 1 ))
              fi
+
              if (( icycle > maxcycle ))
              then
                 (( maxcycle = icycle ))
              fi
+
+#             cycle=$(echo $zeile | cut -f2 -d".")
+#             if [[ "$cycle" = "$zeile"  ||  "$cycle" = ${extout[$i]} ]]
+#             then
+#                (( icycle = 1 ))
+#             else
+#                (( icycle = $cycle + 1 ))
+#             fi
+#             if (( icycle > maxcycle ))
+#             then
+#                (( maxcycle = icycle ))
+#             fi
           done <filelist
           rm filelist
@@ -1418,11 +1441,11 @@
           if (( maxcycle > 0 ))
           then
-             filename=${filename}.$maxcycle
-             if  cat /dev/null > $filename 
+             filename_tmp=${filename}.$maxcycle
+             if  cat /dev/null > $filename_tmp 
              then
-                rm  $filename
+                rm  $filename_tmp
              else
                 printf "\n  +++ OUTPUT-file:"
-                printf "\n           $filename"
+                printf "\n           $filename_tmp"
                 printf "\n      cannot be created"
                 locat=output  ; exit
@@ -1431,20 +1454,8 @@
        else
           (( maxcycle = maxcycle - 1 ))
-          if (( maxcycle > 0 ))
-          then
-             filename=${filename}.$maxcycle
-          fi
        fi
        
-          # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER,
-          # BECAUSE IT MIGHT BE REQUIRED LATER TO STORE THE FILE ON AN ARCHIVE-SYSTEM
-          # OR TO PUT THIS FILENAME ON FILE OUTPUT_FILE_CONNECTIONS
+       (( cycnum[$i] = maxcycle ))
        pathout[$i]=$filename
-       if (( maxcycle > 0 ))
-       then
-          frelout[$i]=${fname}${endout[$i]}.$maxcycle
-       else
-          frelout[$i]=${fname}${endout[$i]}
-       fi
 
     fi
@@ -1895,7 +1906,4 @@
     then
        tmp_user_catalog=$SCRATCH
-    elif [[ $localhost = nech ]]
-    then
-       tmp_user_catalog=$WRKSHR
     else
        tmp_user_catalog=/tmp
@@ -1908,10 +1916,5 @@
  if [[ "$tmp_data_catalog" = "" ]]
  then
-    if [[ $localhost = nech ]]
-    then
-       tmp_data_catalog=$WRKSHR/mrun_restart_data
-    else
-       tmp_data_catalog=/tmp/mrun_restart_data
-    fi
+    tmp_data_catalog=/tmp/mrun_restart_data
  fi
 
@@ -2311,22 +2314,5 @@
     then
 
-          # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING
-          # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS)
-       if [[ $localhost = nech ]]
-       then
-          TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung
-          if  mkdir -p  $TEMPDIR_COMPILE
-          then
-             printf "\n  *** \"$TEMPDIR_COMPILE\" "
-             printf "\n      is generated as temporary directory for cross compiling\n"
-          else
-             printf "\n  +++ creating directory \"$TEMPDIR_COMPILE\" "
-             printf "\n      needed for cross compilation failed"
-             locat=compile
-             exit
-          fi
-       else
-          TEMPDIR_COMPILE=$TEMPDIR
-       fi
+       TEMPDIR_COMPILE=$TEMPDIR
 
        cp  $make_depository  $TEMPDIR_COMPILE
@@ -2354,21 +2340,4 @@
     cd  $TEMPDIR
     printf "\n  *** changed to temporary directory: $TEMPDIR"
-
-
-       # THE FOLLOWING IS REQUIRED FPR AVS-OUTPUT WITH PALM  ??? REMOVE ???
-       # WRITE INFORMATIONS ABOUT THE OUTPUT-FILE CONNECTIONS TO A TEMPORARY FILE
-       # THIS FILE CAN LATER BE READ FROM USER-DEFINED CODE TO DETERMINE THE
-       # RELATION BETWEEN THE LOCAL TEMPORARY AND PERMANENT FILE NAMES
-    (( i = 0 ))
-    while (( i < iout ))
-    do
-       (( i = i + 1 ))
-       if [[ "${actionout[$i]}" = tr  ||  "${actionout[$i]}" = tra  ||  "${actionout[$i]}" = trpe ]]
-       then
-          printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS
-       else
-          printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS
-       fi
-    done
 
 
@@ -2405,11 +2374,5 @@
           printf "      source code files:        $source_list \n"
 
-          if [[ $localhost = nech ]]
-          then
-             ssh  $SSH_PORTOPT  136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
-             cp  $TEMPDIR_COMPILE/a.out  .
-             [[ $? != 0 ]]  &&  compile_error=true
-             rm -rf  $TEMPDIR_COMPILE
-          elif [[ $localhost = ibmh ]]
+          if [[ $localhost = ibmh ]]
           then
              printf "      compiler is called via ssh on \"plogin1\" \n"
@@ -2482,23 +2445,16 @@
        if [[ "${actionin[$i]}" = pe  &&  -n $numprocs ]]
        then
-          files_for_pes=true; datentyp=directory
+          files_for_pes=true; datentyp=files
           actionin[$i]=""
        elif [[ "${actionin[$i]}" = pe  &&  ! -n $numprocs ]]
        then
           actionin[$i]=""
-       elif [[ "${actionin[$i]}" = arpe  &&  -n $numprocs ]]
-       then
-          files_for_pes=true; datentyp=directory
-          actionin[$i]="ar"
-       elif [[ "${actionin[$i]}" = arpe  &&  ! -n $numprocs ]]
-       then
-          actionin[$i]="ar"
-       elif [[ "${actionin[$i]}" = flpe  &&  -n $numprocs ]]
-       then
-          files_for_pes=true; datentyp=directory
-          actionin[$i]="fl"
-       elif [[ "${actionin[$i]}" = flpe  &&  ! -n $numprocs ]]
-       then
-          actionin[$i]="fl"
+       elif [[ "${actionin[$i]}" = lnpe  &&  -n $numprocs ]]
+       then
+          files_for_pes=true; datentyp=files
+          actionin[$i]="ln"
+       elif [[ "${actionin[$i]}" = lnpe  &&  ! -n $numprocs ]]
+       then
+          actionin[$i]="ln"
        fi
 
@@ -2510,162 +2466,38 @@
        fi
 
-          # INPUT-FILE FOR A RESTART RUN.
-          # CHECK, IF THIS FILE STILL EXISTS ON THE TEMPORARY DATA DIRECTORY.
-          # IF NOT, TRY TO GET IT FROM THE ARCHIVE SYSTEM
-       if [[ "${actionin[$i]}" = fl ]]
-       then
-          printf "\n      $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !"
+          # INPUT-FILES TO BE LINKED
+       if [[ "${actionin[$i]}" = ln ]]
+       then
+
+          printf "\n      $datentyp will be linked"
           if [[ $files_for_pes = false ]]
           then
-             if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]]
+             if [[ -f "${absnamein[$i]}" ]]
              then
-                ln  $tmp_data_catalog/${frelin[$i]}  ${localin[$i]}
+                ln  ${absnamein[$i]}  ${localin[$i]}
                 got_tmp[$i]=true
-             elif [[ -f "$WORK/${frelin[$i]}"  &&  $ignore_archive_error = true ]]
-             then
-                printf "\n  +++ $datentyp not found in \"$tmp_data_catalog\" !"
-                printf "\n  *** trying to use backup copy in \"$WORK\" "
-                cp  $WORK/${frelin[$i]}  ${localin[$i]}
-             else
-                printf "\n  +++ $datentyp not found in \"$tmp_data_catalog\" "
-                printf "\n      or \"$tmp_data_catalog\" does not exist!"
-                printf "\n  *** trying to get copy from archive"
-                actionin[$i]=ar
              fi
           else
-             if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]]
+             if [[ -d "${absnamein[$i]}" ]]
              then
                 mkdir  ${localin[$i]}
-                cd $tmp_data_catalog/${frelin[$i]}
+                cd ${absnamein[$i]}
                 for file in $(ls *)
                 do
                    ln $file $TEMPDIR/${localin[$i]}
-                done
+                done >|/dev/null 2>&1
                 cd $TEMPDIR
-                got_tmp[$i]=true
-             elif [[ -d "$WORK/${frelin[$i]}"  &&  $ignore_archive_error = true ]]
+             fi
+
+                # IF "ln -f" HAS FAILED DO A NORMAL COPY "cp -r"
+             if [[ ! -f "${localin[$i]}/_000000" ]]
              then
-                printf "\n  +++ $datentyp not found in \"$tmp_data_catalog\" !"
-                printf "\n  *** trying to use backup copy in \"$WORK\" "
-                cp -r  $WORK/${frelin[$i]}  ${localin[$i]}
-             else
-                printf "\n  +++ $datentyp not found in \"$tmp_data_catalog\" "
-                printf "\n      or \"$tmp_data_catalog\" does not exist!"
-                printf "\n  *** trying to get copy from archive"
-                actionin[$i]=ar
+                printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
+                cp -r  ${absnamein[$i]}/*  ${localin[$i]}
              fi
-          fi
-       fi
-
-
-          # FILE IS STORED ON THE ARCHIVE SYSTEM
-       if [[ "${actionin[$i]}" = ar ]]
-       then
-
-          if [[ $files_for_pes = false ]]
-          then
-             printf "\n      file will be restored from archive-system ($archive_system)!"
-          else
-             printf "\n      directory will be restored from archive-system ($archive_system)!"
-          fi
-
-          file_restored=false
-
-          if [[ $archive_system = asterix ]]
-          then
-             do_stagein=true
-             (( stagein_anz = 0 ))
-             while [[ $do_stagein = true ]]
-             do
-                if [[ $files_for_pes = false ]]
-                then
-                   stagein  -O  ${frelin[$i]}  >  STAGEIN_OUTPUT
-                else
-                   stagein  -t  -O  ${frelin[$i]}  >  STAGEIN_OUTPUT
-                fi
-                cat  STAGEIN_OUTPUT
-                if [[ $(grep -c "st.msg:i24"  STAGEIN_OUTPUT) != 0 ]]
-                then
-                   file_restored=true
-                   do_stagein=false
-                else
-                   (( stagein_anz = stagein_anz + 1 ))
-                   if (( stagein_anz == 10 ))
-                   then
-                      printf "\n  +++ stagein stoped after 10 tries"
-                      locat=stage
-                      exit
-                   fi
-                   printf "\n  +++ restoring from archive failed, trying again:"
-                   sleep 900
-                fi
-             done
-          elif [[ $archive_system = DMF ]]
-          then
-             if [[ $files_for_pes = false ]]
-             then
-                printf "\n  +++ restoring of single files impossible with $archive_system !\n"
-                locat=DMF
-                exit
-             else
-                find  $ARCHIVE/${frelin[$i]}  -type m  -print  |  dmget
-                cp  -r $ARCHIVE/${frelin[$i]}  $PWD
-                file_restored=true
-             fi
-          elif [[ $archive_system = tivoli ]]
-          then
-             if [[ $files_for_pes = false ]]
-             then
-                ssh  $SSH_PORTOPT  $usern@bicedata.hlrn.de  "cp  $PERM/${frelin[$i]}  $PWD"
-             else
-                (( inode = 0 ))
-                while (( inode < nodes ))
-                do
-                   ssh  $SSH_PORTOPT  $usern@bicedata.hlrn.de  "cd $PWD; tar  xf  $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar"
-                   (( inode = inode + 1 ))
-                done
-             fi
-             file_restored=true
-          elif [[ $archive_system = ut ]]
-          then
-             if [[ $files_for_pes = false ]]
-             then
-                cp  $UT/${frelin[$i]}  .
-             else
-                (( inode = 0 ))
-                while (( inode < nodes ))
-                do
-                   tar  xf  $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar
-                   (( inode = inode + 1 ))
-                done
-             fi
-             file_restored=true
-          else
-             printf "\n  +++ archive_system=\"$archive_system\"   restore impossible!"
-             locat=rearchive
-             exit
-          fi
-
-          if [[ $file_restored = true ]]
-          then
-
-                # PUT FILE ON THE TEMPORARY DATA DIRECTORY TOO.
-                # THIS WILL MAKE FILE ACCESS EASIER FOR LATER RUNS 
-             [[ ! -d $tmp_data_catalog ]]  &&  mkdir -p  $tmp_data_catalog; chmod  g+rx  $tmp_data_catalog
-             if [[ $files_for_pes = false ]]
-             then
-                ln  -f  ${frelin[$i]}  $tmp_data_catalog/${frelin[$i]}
-             else
-                mkdir  $tmp_data_catalog/${frelin[$i]}
-                ln  -f  ${frelin[$i]}/*  $tmp_data_catalog/${frelin[$i]}
-             fi
+
              got_tmp[$i]=true
-
-                # PROVIDE THE FILE UNDER ITS LOCAL NAME
-             mv  ${frelin[$i]}  ${localin[$i]}
-
-          fi
-       fi
-
+          fi
+       fi
 
           # FILE IS STORED IN THE RESPECTIVE DIRECTORY GIVEN IN THE CONFIGURATION FILE
@@ -2709,41 +2541,41 @@
                 printf "\n      providing $numprocs files for the respective processors"
                 mkdir  ${localin[$i]}
-		if [[ $link_local_input = true ]]
-		    then
-		    printf "      using ln -f\n"
-		    cd ${absnamein[$i]}
-		    for file in $(ls *)
-		      do
-		      ln -f $file  ${localin[$i]}
-		    done
-		    cd $TEMPDIR
-		fi
+	              	if [[ $link_local_input = true ]]
+		              then
+		                 printf "      files will be linked\n"
+		                 cd ${absnamein[$i]}
+		                 for file in $(ls *)
+		                 do
+		                    ln -f $file  ${localin[$i]}
+		                 done
+		                 cd $TEMPDIR
+		              fi
 
                    # IF "ln -f" FAILED OR IF "$link_local_input = false" DO A NORMAL "cp -r"
-		if [[ ! -f "${localin[$i]}/_0000" ]]
-		    then
-		    if [[ $link_local_input = true ]]
-			then
-			printf "      ln failed for .../_0000, using cp...\n"
-		    fi
-		    cp -r  ${absnamein[$i]}/*  ${localin[$i]}
-		fi
+		              if [[ ! -f "${localin[$i]}/_000000" ]]
+		              then
+		                 if [[ $link_local_input = true ]]
+		                	then
+	                   		printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
+		                 fi
+		                 cp -r  ${absnamein[$i]}/*  ${localin[$i]}
+		              fi
 
              else
 
                    # PROVIDE FILE FOR RUNS ON A SINGLE CORE
-		if [[ $link_local_input = true ]]
-		then
-		    printf "      using ln -f\n"
-		    ln -f  ${absnamein[$i]}  ${localin[$i]}
-		fi
-		# If "ln -f" fails of if "$link_local_input = false" do a normal "cp"
-		if [[ ! -f "${localin[$i]}" ]]
+              		if [[ $link_local_input = true ]]
+	              	then
+		                 printf "      file will be linked\n"
+		                 ln -f  ${absnamein[$i]}  ${localin[$i]}
+	              	fi
+	                 	# If "ln -f" fails of if "$link_local_input = false" do a normal "cp"
+	              	if [[ ! -f "${localin[$i]}" ]]
                 then
-		    if [[ $link_local_input = true ]]
-	            then
-			printf "      ln failed, using cp...\n"
-		    fi
-		    cp  ${absnamein[$i]}  ${localin[$i]}
+		                 if [[ $link_local_input = true ]]
+	                  then
+                      printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
+		                 fi
+		                 cp  ${absnamein[$i]}  ${localin[$i]}
                 fi
              fi
@@ -2837,5 +2669,5 @@
        # CREATE THE NAMELIST-FILE WITH VALUES OF ENVIRONMENT-VARIABLES REQUIRED BY PALM
        # (FILE ENVPAR WILL BE READ BY PALM)
-    cat  >  ENVPAR  <<  %%END%%
+    cat  >  ENVPAR  <<  EOF
  &envpar  run_identifier = '$fname', host = '$localhost',
           write_binary = '$write_binary', tasks_per_node = $tasks_per_node,
@@ -2846,5 +2678,5 @@
           batch_job = $batch_job /
 
-%%END%%
+EOF
 
 
@@ -3040,59 +2872,4 @@
                 fi
 
-             elif [[ $host = nech ]]  # running on NEC machines
-             then
-
-                (( ii = nodes ))
-                if [[ $ii = 1 ]]
-                then
-                   export F_ERRCNT=0        # acceptable number of errors before program is stopped
-                   export MPIPROGINF=YES
-                   #  export F_TRACE=YES|FMT1|FMT2  # output of ftrace informations to job protocol
-                   echo "*** execution on single node with mpirun"
-                   mpirun  -np $numprocs  ./a.out
-                else
-                   (( i = 0 ))
-                   while (( i < ii ))
-                   do
-                      echo "-h $i  -p $tasks_per_node  -e ./mpi_exec_shell"  >>  multinode_config
-                      (( i = i + 1 ))
-                   done
-
-                   echo "#!/bin/sh"                         >   mpi_exec_shell
-                   echo " "                                 >>  mpi_exec_shell
-                   echo "set -u"                            >>  mpi_exec_shell
-                   echo "F_ERRCNT=0"                        >>  mpi_exec_shell
-                   echo "MPIPROGINV=YES"                    >>  mpi_exec_shell
-                   echo "OMP_NUM_THREADS=$threads_per_task" >>  mpi_exec_shell 
-                   echo "cpurest=$cpurest"                  >>  mpi_exec_shell
-                   echo "fname=$fname"                      >>  mpi_exec_shell
-                   echo "localhost=$localhost"              >>  mpi_exec_shell
-                   echo "return_address=$return_address"    >>  mpi_exec_shell
-                   echo "return_username=$return_username"  >>  mpi_exec_shell
-                   echo "tasks_per_node=$tasks_per_node"    >>  mpi_exec_shell
-                   echo "write_binary=$write_binary"        >>  mpi_exec_shell
-                   echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
-                   echo "  "                                >>  mpi_exec_shell
-                   echo "export F_ERRCNT"                   >>  mpi_exec_shell
-                   echo "export MPIPROGINV"                 >>  mpi_exec_shell
-                   echo "export OMP_NUM_THREADS"            >>  mpi_exec_shell
-                   echo "export cpurest"                    >>  mpi_exec_shell
-                   echo "export fname"                      >>  mpi_exec_shell
-                   echo "export localhost"                  >>  mpi_exec_shell
-                   echo "export return_address"             >>  mpi_exec_shell
-                   echo "export return_username"            >>  mpi_exec_shell
-                   echo "export tasks_per_node"             >>  mpi_exec_shell
-                   echo "export write_binary"               >>  mpi_exec_shell
-                   echo "export use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
-                   echo " "                                 >>  mpi_exec_shell
-                   echo "exec  ./a.out"                     >>  mpi_exec_shell
-
-                   chmod u+x  mpi_exec_shell
-                   export MPIPROGINF=YES
-                   mpirun  -f multinode_config  &
-                   wait
-
-                fi
-
              elif [[ $(echo $host | cut -c1-2) = lc  &&  $host != lckyoto &&  $host != lctit ]]
              then
@@ -3403,6 +3180,5 @@
        ls -al
     fi
-
-
+    
 
        # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS
@@ -3413,9 +3189,47 @@
        if (( i == 1 ))
        then
-          printf "\n\n  *** saving OUTPUT-files:\n$dashes"
-       fi
+          printf "\n\n  *** saving OUTPUT-files:"
+
+             # GET RUN NUMBER ASSIGNED BY PALM
+          if [[ -f RUN_NUMBER ]]
+          then
+              read  run_number  <  RUN_NUMBER
+              printf "\n  *** PALM generated run_number = "$run_number" will be used as unified cycle number for all output files"
+              usecycle_option="-U $run_number"
+          else
+              run_number=0
+              usecycle_option=""
+          fi
+          printf "\n$dashes"
+       fi
+
+          # ADD CYCLE NUMBER TO FILENAME
+       if [[ ! ( $fromhost != $localhost  &&  ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]]
+       then
+
+              # IN APPEND MODE, FILES KEEP THEIR CURRENT CYCLE NUMBER
+          if [[ "${actionout[$i]}" != "a" ]]
+          then
+                # SET RUN NUMBER AS CYCLE NUMBER, IF THERE IS NOT A CONFLICT
+                # WITH AN EXISTING CYCLE NUMBER
+             if (( run_number >= cycnum[$i] ))
+             then
+                (( cycnum[$i] = run_number ))
+             else
+                if (( run_number > 0 ))
+                then
+                   printf "\n  --- INFORMATIVE: The following file cannot get a unified cycle number"
+                fi
+             fi
+          fi
+          if (( cycnum[$i] > 0 ))
+          then
+             pathout[$i]=${pathout[$i]}.${cycnum[$i]}
+          fi
+       fi           
 
           # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION)
        files_for_pes=false; filetyp=file
+       link_local_output=false
        if [[ "${actionout[$i]}" = pe  &&  -n $numprocs ]]
        then
@@ -3425,18 +3239,13 @@
        then
           actionout[$i]=""
-       elif [[ "${actionout[$i]}" = arpe  &&  -n $numprocs ]]
+       elif [[ "${actionout[$i]}" = lnpe  &&  -n $numprocs ]]
        then
           files_for_pes=true; filetyp=directory
-          actionout[$i]="ar"
-       elif [[ "${actionout[$i]}" = arpe  &&  ! -n $numprocs ]]
-       then
-          actionout[$i]="ar"
-       elif [[ "${actionout[$i]}" = flpe  &&  -n $numprocs ]]
-       then
-          files_for_pes=true; filetyp=directory
-          actionout[$i]="fl"
-       elif [[ "${actionout[$i]}" = flpe  &&  ! -n $numprocs ]]
-       then
-          actionout[$i]="fl"
+          link_local_output=true
+          actionout[$i]=""
+       elif [[ "${actionout[$i]}" = lnpe  &&  ! -n $numprocs ]]
+       then
+          link_local_output
+          actionout[$i]=""
        elif [[ "${actionout[$i]}" = trpe  &&  -n $numprocs ]]
        then
@@ -3471,5 +3280,58 @@
                    cst="/"
                 fi
-                if [[ $localhost = nech ]]
+
+                transfer_failed=false
+                printf "\n  >>> OUTPUT: ${localout[$i]}$cst  by SCP to"
+                printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n"
+                if [[ $localhost = lccrayb ]]
+                then
+                   ssh $usern@blogin1 ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m $usecycle_option -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                elif [[ $localhost = lccrayh ]]
+                then
+                   ssh $usern@hlogin1 ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m $usecycle_option -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                elif [[ $localhost = lcbullhh ]]
+                then
+                   ssh $usern@mlogin101 ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m $usecycle_option -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                elif [[ $localhost = lcxe6 ]]
+                then
+                   ssh $usern@hexagon ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m $usecycle_option -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                else
+                   batch_scp $PORTOPT $cps -b -m $usecycle_option -u $return_username $return_address  ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}
+                fi
+                [[ $? != 0 ]]  &&  transfer_failed=true
+
+                   # IF TRANSFER FAILED, CREATE BACKUP COPY ON THIS MACHINE
+                if [[ $transfer_failed = true ]]
+                then
+                   printf "  +++ transfer failed. Trying to save a copy on this host under:\n"
+                   printf "      ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n"
+
+                      # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY
+                   eval  local_catalog=${pathout[$i]}
+                   if [[ ! -d $local_catalog ]]
+                   then
+                      printf "  *** local directory does not exist. Trying to create:\n"
+                      printf "      $local_catalog \n"
+                      mkdir -p  $local_catalog
+                   fi
+                   eval  cp  ${localout[$i]}  ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung
+                   transfer_problems=true
+                fi
+
+             else
+
+                   # UNSET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST BE COPIED ON THIS MACHINE
+                actionout[$i]=""
+             fi
+          fi
+
+
+             # APPEND VIA SCP TO LOCAL HOST (ALWAYS IN BINARY MODE USING batch_scp option -m)
+             # IF TARGET DIRECTORY DOES NOT EXISTS, TRY TO CREATE IT
+          if [[ "${actionout[$i]}" = tra ]]
+          then
+             if [[ $localhost != $fromhost ]]
+             then
+                if [[ $localhost = ibmh ]]
                 then
 
@@ -3478,32 +3340,21 @@
                    [[ ! -d $tmp_data_catalog/TRANSFER ]]  &&  mkdir -p  $tmp_data_catalog/TRANSFER
                    file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung
-                   if [[ $files_for_pes = false ]]
-                   then
-                      ln -f  ${localout[$i]}  $tmp_data_catalog/TRANSFER/$file_to_transfer
-                   else
-                      mkdir  $tmp_data_catalog/TRANSFER/$file_to_transfer
-                      ln  ${localout[$i]}/*  $tmp_data_catalog/TRANSFER/$file_to_transfer
-                   fi
+                   ln -f  ${localout[$i]}  $tmp_data_catalog/TRANSFER/$file_to_transfer
 
                    echo "set -x"                                    >    transfer_${localout[$i]}
                    echo "cd  $tmp_data_catalog/TRANSFER"            >>   transfer_${localout[$i]}
 
-                   printf "\n  >>> OUTPUT: ${localout[$i]}$cst  by SCP in seperate job to"
-                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst"
+                   printf "\n  >>> OUTPUT: ${localout[$i]}  append by SCP in seperate job to"
+                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}"
                    printf "\n              or higher cycle\n"
-                   echo "batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"  >>  transfer_${localout[$i]}
+                   echo "batch_scp $PORTOPT -A -b -m -u $return_username $return_address  $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"  >>  transfer_${localout[$i]}
 
                    echo "[[ \$? = 0 ]]  &&  rm  $file_to_transfer"  >>  transfer_${localout[$i]}
 
-                   if [[ $localhost = nech ]]
+                   if [[ $LOGNAME = b323013 ]]
                    then
-                      subjob  -d  -c /pf/b/$usern/job_queue  -v  -q pp  -X 0  -m 1000  -t 900  $PORTOPT  transfer_${localout[$i]}
+                      subjob  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
                    else
-                      if [[ "$LOGNAME" = b323013 ]]
-                      then
-                         subjob  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
-                      else
-                         subjob  -d  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
-                      fi
+                      subjob  -d  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
                    fi
 
@@ -3512,20 +3363,17 @@
                       # TRANSFER WITHIN THIS JOB
                    transfer_failed=false
-                   printf "\n  >>> OUTPUT: ${localout[$i]}$cst  by SCP to"
-                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n"
+                   printf "\n  >>> OUTPUT: ${localout[$i]}  append by SCP to"
+                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n"
                    if [[ $localhost = lccrayb ]]
                    then
-                      ssh $usern@blogin1 ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                      ssh $usern@blogin1 ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
                    elif [[ $localhost = lccrayh ]]
                    then
-                      ssh $usern@hlogin1 ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
-                   elif [[ $localhost = lcbullhh ]]
-                   then
-                      ssh $usern@mlogin101 ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                      ssh $usern@hlogin1 ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
                    elif [[ $localhost = lcxe6 ]]
                    then
-                      ssh $usern@hexagon ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
+                      ssh $usern@hexagon ". \\$HOME/.bashrc; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
                    else
-                      batch_scp $PORTOPT $cps -b -m -u $return_username $return_address  ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}
+                      batch_scp $PORTOPT -A -b -m -u $return_username  $return_address ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}
                    fi
                    [[ $? != 0 ]]  &&  transfer_failed=true
@@ -3545,4 +3393,5 @@
                          mkdir -p  $local_catalog
                       fi
+
                       eval  cp  ${localout[$i]}  ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung
                       transfer_problems=true
@@ -3551,88 +3400,4 @@
              else
 
-                   # UNSET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST BE COPIED ON THIS MACHINE
-                actionout[$i]=""
-             fi
-          fi
-
-
-             # APPEND VIA SCP TO LOCAL HOST (ALWAYS IN BINARY MODE USING batch_scp option -m)
-             # IF TARGET DIRECTORY DOES NOT EXISTS, TRY TO CREATE IT
-          if [[ "${actionout[$i]}" = tra ]]
-          then
-             if [[ $localhost != $fromhost ]]
-             then
-                if [[ $localhost = ibmh  ||  $localhost = nech ]]
-                then
-
-                      # TRANSFER IN SEPERATE JOB
-                      # FIRST COPY FILE TO TEMPORY DATA DIRECTORY
-                   [[ ! -d $tmp_data_catalog/TRANSFER ]]  &&  mkdir -p  $tmp_data_catalog/TRANSFER
-                   file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung
-                   ln -f  ${localout[$i]}  $tmp_data_catalog/TRANSFER/$file_to_transfer
-
-                   echo "set -x"                                    >    transfer_${localout[$i]}
-                   echo "cd  $tmp_data_catalog/TRANSFER"            >>   transfer_${localout[$i]}
-
-                   printf "\n  >>> OUTPUT: ${localout[$i]}  append by SCP in seperate job to"
-                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}"
-                   printf "\n              or higher cycle\n"
-                   echo "batch_scp $PORTOPT -A -b -m -u $return_username $return_address  $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"  >>  transfer_${localout[$i]}
-
-                   echo "[[ \$? = 0 ]]  &&  rm  $file_to_transfer"  >>  transfer_${localout[$i]}
-
-                   if [[ $localhost = nech ]]
-                   then
-                      subjob  -d  -c /pf/b/$usern/job_queue  -v  -q pp  -X 0  -m 1000  -t 900  $PORTOPT  transfer_${localout[$i]}
-                   else
-                      if [[ $LOGNAME = b323013 ]]
-                      then
-                         subjob  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
-                      else
-                         subjob  -d  -v  -q c1  -X 0  -m 1000  -t 900  -c $job_catalog  $PORTOPT  transfer_${localout[$i]}
-                      fi
-                   fi
-
-                else
-
-                      # TRANSFER WITHIN THIS JOB
-                   transfer_failed=false
-                   printf "\n  >>> OUTPUT: ${localout[$i]}  append by SCP to"
-                   printf "\n              ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n"
-                   if [[ $localhost = lccrayb ]]
-                   then
-                      ssh $usern@blogin1 ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
-                   elif [[ $localhost = lccrayh ]]
-                   then
-                      ssh $usern@hlogin1 ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
-                   elif [[ $localhost = lcxe6 ]]
-                   then
-                      ssh $usern@hexagon ". \\$HOME/.profile; cd $TEMPDIR; batch_scp $PORTOPT -A -b -m -u $return_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}"
-                   else
-                      batch_scp $PORTOPT -A -b -m -u $return_username  $return_address ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]}  ${extout[$i]}
-                   fi
-                   [[ $? != 0 ]]  &&  transfer_failed=true
-
-                      # IF TRANSFER FAILED, CREATE BACKUP COPY ON THIS MACHINE
-                   if [[ $transfer_failed = true ]]
-                   then
-                      printf "  +++ transfer failed. Trying to save a copy on this host under:\n"
-                      printf "      ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n"
-
-                         # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY
-                      eval  local_catalog=${pathout[$i]}
-                      if [[ ! -d $local_catalog ]]
-                      then
-                         printf "  *** local directory does not exist. Trying to create:\n"
-                         printf "      $local_catalog \n"
-                         mkdir -p  $local_catalog
-                      fi
-
-                      eval  cp  ${localout[$i]}  ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung
-                      transfer_problems=true
-                   fi
-                fi
-             else
-
                    # RESET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST BE APPENDED ON THIS MACHINE
                 actionout[$i]=a
@@ -3640,322 +3405,4 @@
           fi
 
-
-             # OUTPUT-FILE FOR A RESTART-RUN.
-             # FILE IS MOVED TO THE TEMPORARY DATA DIRECTORY USING link COMMAND.
-             # OPTION -f IS USED TO OVERWRITE EXISTING FILES.
-             # AS LAST ACTION, ARCHIVING IS INITIATED.
-          if [[ "${actionout[$i]}" = fl ]]
-          then
-             [[ ! -d $tmp_data_catalog ]]  &&  mkdir -p  $tmp_data_catalog
-             chmod  g+rx  $tmp_data_catalog
-             if [[ $files_for_pes = false ]]
-             then
-                printf "\n  >>> OUTPUT: ${localout[$i]}  to"
-                printf "\n              $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n"
-                ln -f  ${localout[$i]}  $tmp_data_catalog/${frelout[$i]}
-             else
-                printf "\n  >>> OUTPUT: ${localout[$i]}/....  to"
-                printf "\n              $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n"
-                mkdir  $tmp_data_catalog/${frelout[$i]}
-                cd ${localout[$i]}
-                for file in $(ls *)
-                do
-                   ln -f $file $tmp_data_catalog/${frelout[$i]}
-                done
-                cd $TEMPDIR
-             fi
-
-
-                # CREATE AND SUBMIT ARCHIVING-JOB
-             if [[ $store_on_archive_system = true ]]
-             then
-
-                if [[ $archive_system = asterix ]]
-                then
-                   echo "cd  $tmp_data_catalog"                      >> archive_${frelout[$i]}
-                   if [[ $files_for_pes = false ]]
-                   then
-                      echo "stageout  ${frelout[$i]}  > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]}
-                   else
-                      echo "stageout -t  ${frelout[$i]}  > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]}
-                   fi
-                   echo "cat  STAGE_OUTPUT${i}_$kennung"               >> archive_${frelout[$i]}
-                   echo "if [[ \$(grep -c \"st.msg:150\"  STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]}
-                   echo "then"                                       >> archive_${frelout[$i]}
-                   echo "   do_stageout=false"                       >> archive_${frelout[$i]}
-                   echo "else"                                       >> archive_${frelout[$i]}
-                   echo "   echo \"  +++ $filetyp ${frelout[$i]}  could not be stored on archive-system\" " >> archive_${frelout[$i]}
-                   echo "   cat  /dev/null  >  ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]}
-                   echo "   cat  STAGE_OUTPUT${i}_$kennung  >  ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]}
-                   echo "   echo \"  *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]}
-                   if [[ $files_for_pes = false ]]
-                   then
-                      echo "   cp   ${frelout[$i]}  \$WORK"                    >> archive_${frelout[$i]}
-                   else
-                      echo "   cp -r  ${frelout[$i]}  \$WORK/${frelout[$i]}"   >> archive_${frelout[$i]}
-                   fi
-                   echo "   echo \"  *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]}
-                   echo "fi"                                         >> archive_${frelout[$i]}
-                   echo "rm  STAGE_OUTPUT${i}_$kennung"              >> archive_${frelout[$i]}
-                elif [[ $archive_system = DMF ]]
-                then
-                   echo "cd  $tmp_data_catalog"                      >> archive_${frelout[$i]}
-                   if [[ $files_for_pes = false ]]
-                   then
-                      printf "\n  +++ archiving of single files impossible with $archive_system !\n"
-                      locat=DMF
-                      exit
-                   else
-                         # ??? nicht benÃ¶tigte Archiv-Systeme entfernen ???
-                         # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH
-                         # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.)
-                      echo "rm -rf  \$ARCHIVE/${frelout[$i]}"     >> archive_${frelout[$i]}
-                      echo "cp -r  ${frelout[$i]}  \$ARCHIVE"     >> archive_${frelout[$i]}
-                   fi
-                elif [[ $archive_system = tivoli ]]
-                then
-                   echo "cd  $tmp_data_catalog"                       >> archive_${frelout[$i]}
-                   if [[ $files_for_pes = false ]]
-                   then
-                         # REMOVE EXISTING OLD FILES FROM THE ARCHIVE
-                      echo "set -x"                                   >> archive_${frelout[$i]}
-                      echo "rm  -rf  \$PERM/${frelout[$i]}"           >> archive_${frelout[$i]}
-                      echo "cp  ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]}
-                   else
-
-                      echo "set -x"                                   >> archive_${frelout[$i]}
-                      echo "rm  -rf  \$PERM/${frelout[$i]}/*"         >> archive_${frelout[$i]}
-                      echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]}
-                      cd  $tmp_data_catalog
-                      all_files=`ls -1 ${frelout[$i]}/*`
-                      cd -  > /dev/null
-                      (( inode = 0 ))
-                      (( tp1   = tasks_per_node + 1 ))
-                      while (( inode < nodes ))
-                      do
-                         files=`echo $all_files | cut -d" " -f1-$tasks_per_node`
-                         all_files=`echo $all_files | cut -d" " -f$tp1-`
-                         echo "tar  cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files"   >> archive_${frelout[$i]}
-                         (( inode = inode + 1 ))
-                      done
-                   fi
-                elif [[ $archive_system = ut ]]
-                then
-                   echo "cd  $tmp_data_catalog"                       >> archive_${frelout[$i]}
-                   if [[ $files_for_pes = false ]]
-                   then
-                         # REMOVE EXISTING OLD FILES FROM THE ARCHIVE
-                      echo "set -x"                                 >> archive_${frelout[$i]}
-                      echo "rm  -rf  \$UT/${frelout[$i]}"           >> archive_${frelout[$i]}
-                      echo "cp  ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]}
-                   else
-
-                      echo "set -x"                                 >> archive_${frelout[$i]}
-                      echo "rm  -rf  \$UT/${frelout[$i]}/*"         >> archive_${frelout[$i]}
-                      echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]}
-                      cd  $tmp_data_catalog
-                      all_files=`ls -1 ${frelout[$i]}/*`
-                      cd -  > /dev/null
-                      (( inode = 0 ))
-                      (( tp1   = tasks_per_node + 1 ))
-                      while (( inode < nodes ))
-                      do
-                         files=`echo $all_files | cut -d" " -f1-$tasks_per_node`
-                         all_files=`echo $all_files | cut -d" " -f$tp1-`
-                         echo "tar  cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files"   >> archive_${frelout[$i]}
-                         (( inode = inode + 1 ))
-                      done
-                   fi
-                elif [[ $archive_system = none ]]
-                then
-                   printf "              +++ archiving on $localhost not available!\n"
-                fi
-
-                if [[ $archive_system != none ]]
-                then
-                   if [[ $localhost = nech ]]
-                   then
-                      subjob  -d  -c /pf/b/$usern/job_queue  -v  -q pp  -X 0  -m 1000  -t 7200  $PORTOPT  archive_${frelout[$i]}
-                   fi
-                   printf "              Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n"
-                fi
-             else
-                printf "              +++ caution: option -A is switched off. No archiving on $archive_system!\n"
-             fi
-
-
-                # CREATE AN EMPTY DIRECTORY IN THE USERS PERMANENT DIRECTORY,
-                # IN ORDER TO NOTE THE RESPECTIVE CYCLE NUMBER ON THE ARCHIVE SYSTEM
-                # RESTART-JOBS ARE USING THESE EMPTY-DIRECTORIES TO GET THE CURRENT HIGHEST
-                # CYCLE NUMBER ON THE ARCHIVE SYSTEM (IN CASE THAT INFORMATIONS ARE DIFFICULT TO
-                # TO ACCESS FROM THE ARCHIVE-SYSTEM DIRECTLY))
-             if [[ $files_for_pes = false ]]
-             then
-                cat  /dev/null  >  ${pathout[$i]}
-             else
-                mkdir -p  ${pathout[$i]}
-             fi
-
-          fi
-
-
-             # COPY FROM THIS HOST TO THE ARCHIVE-SYSTEM
-             # IF ANY ARCHIVING FAILS, AN ERROR-FLAG-FILE IS SET
-             # THIS FILE REMAINS TO BE SET, EVEN IF ARCHIVING OF FURTHER FILES IS SUCCESSFULL
-          if [[ "${actionout[$i]}" = ar ]]
-          then
-             if [[ $files_for_pes = false ]]
-             then
-                printf "\n  >>> OUTPUT: ${localout[$i]}  to"
-                printf "\n              ${pathout[$i]}"
-                printf "\n              File will be copied to archive-system ($archive_system) !\n"
-             else
-                printf "\n  >>> OUTPUT: ${localout[$i]}/_....  to"
-                printf "\n              ${pathout[$i]}"
-                printf "\n              Directory will be copied to archive-system ($archive_system) !\n"
-             fi
-             mv  ${localout[$i]}  ${frelout[$i]}
-
-             file_saved=false
-
-             if [[ $archive_system = asterix ]]
-             then
-                do_stageout=true
-                (( stageout_anz = 0 ))
-                while [[ $do_stageout = true ]]
-                do
-                   if [[ $files_for_pes = false ]]
-                   then
-                      stageout  ${frelout[$i]}  > STAGE_OUTPUT
-                   else
-                      stageout  -t  ${frelout[$i]}  > STAGE_OUTPUT
-                   fi
-                   cat  STAGE_OUTPUT
-                   if [[ $(grep -c "st.msg:150"  STAGE_OUTPUT) != 0 ]]
-                   then
-                      file_saved=true
-                      do_stageout=false
-                   else
-                      if [[ $files_for_pes = false ]]
-                      then
-                         printf "\n  +++ file ${frelout[$i]}  could not be saved on archive-system"
-                      else
-                         printf "\n  +++ directory ${frelout[$i]} could not be saved on archive-system"
-                      fi
-                      (( stageout_anz = stageout_anz + 1 ))
-                      if (( stageout_anz == 10 ))
-                      then
-                         printf "\n  +++ stoped after 10 unsuccessful tries!"
-                         archive_save=false
-                         do_stageout=false
-                      else
-                         printf "\n  *** new try to store on archive after 15 min:"
-                         sleep 900
-                      fi
-                   fi
-                done
-             elif [[ $archive_system = DMF ]]
-             then
-                if [[ $files_for_pes = false ]]
-                then
-                   printf "\n  +++ archiving of single files impossible on $archive_system!\n"
-                   locat=DMF
-                   exit
-                else
-                   rm -rf  $ARCHIVE/${frelout[$i]}
-                   cp -r  ${frelout[$i]}  $ARCHIVE
-                fi
-                file_saved=true
-             elif [[ $archive_system = tivoli ]]
-             then
-                   # ARCHIVING ONLY POSSIBLE VIA BATCH-JOB
-                   # IN THE MEANTIME, FILE IS STORED IN THE TEMPORARY DATA DIRECTORY,
-                   # BECAUSE MRUN'S CURRENT TEMPORARY WORKING DIRECTORY MAY ALREADY BE DELETED
-                   # WHEN THE ARCHIVE-JOB IS EXECUTED
-                [[ ! -d $tmp_data_catalog ]]  &&  mkdir -p  $tmp_data_catalog
-                chmod  g+rx  $tmp_data_catalog
-                if [[ $files_for_pes = false ]]
-                then
-                   ln -f  ${frelout[$i]}  $tmp_data_catalog/${frelout[$i]}
-                else
-                   mkdir  $tmp_data_catalog/${frelout[$i]}
-                   ln -f  ${frelout[$i]}/*  $tmp_data_catalog/${frelout[$i]}
-                fi
-
-                   # GENERATE AND SUBMIT BATCH-JOB
-                   # FILE HAS TO BE DELETED FROM THE TEMPORARY DATA DIRECTORY
-                   # DELETE OLD EXISTING FILES FROM THE ARCHIVE
-                echo "cd  $tmp_data_catalog"                       >  archive_${frelout[$i]}
-                if [[ $files_for_pes = false ]]
-                then
-                   echo "rm  -rf  \$PERM/${frelout[$i]}"           >> archive_${frelout[$i]}
-                   echo "cp  ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]}
-                   echo "rm  -rf  ${frelout[$i]}"                  >> archive_${frelout[$i]}
-                else
-                   echo "rm  -rf  \$PERM/${frelout[$i]}.tar"       >> archive_${frelout[$i]}
-                   echo "tar  cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]}
-                   echo "rm  -rf  ${frelout[$i]}"                  >> archive_${frelout[$i]}
-                fi
-
-                subjob  -v  -d  -q cdata  -X 0  -m 1000  -t 43200  -c $job_catalog  $PORTOPT  archive_${frelout[$i]}
-                printf "              Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n"
-                file_saved=true
-
-             elif [[ $archive_system = ut ]]
-             then
-                   # ARCHIVING ONLY POSSIBLE VIA BATCH-JOB
-                   # IN THE MEANTIME, FILE IS STORED IN THE TEMPORARY DATA DIRECTORY,
-                   # BECAUSE MRUN'S CURRENT TEMPORARY WORKING DIRECTORY MAY ALREADY BE DELETED
-                   # WHEN THE ARCHIVE-JOB IS EXECUTED
-                [[ ! -d $tmp_data_catalog ]]  &&  mkdir -p  $tmp_data_catalog
-                chmod  g+rx  $tmp_data_catalog
-                if [[ $files_for_pes = false ]]
-                then
-                   ln -f  ${frelout[$i]}  $tmp_data_catalog/${frelout[$i]}
-                else
-                   mkdir  $tmp_data_catalog/${frelout[$i]}
-                   ln -f  ${frelout[$i]}/*  $tmp_data_catalog/${frelout[$i]}
-                fi
-
-                   # GENERATE AND SUBMIT BATCH-JOB
-                   # FILE HAS TO BE DELETED FROM THE TEMPORARY DATA DIRECTORY
-                   # DELETE OLD EXISTING FILES FROM THE ARCHIVE
-                echo "cd  $tmp_data_catalog"                       >  archive_${frelout[$i]}
-                if [[ $files_for_pes = false ]]
-                then
-                   echo "rm  -rf  \$UT/${frelout[$i]}"           >> archive_${frelout[$i]}
-                   echo "cp  ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]}
-                   echo "rm  -rf  ${frelout[$i]}"                >> archive_${frelout[$i]}
-                else
-                   echo "rm  -rf  \$UT/${frelout[$i]}.tar"       >> archive_${frelout[$i]}
-                   echo "tar  cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]}
-                   echo "rm  -rf  ${frelout[$i]}"                >> archive_${frelout[$i]}
-                fi
-
-                subjob  -v  -c /pf/b/$usern/job_queue  -d  -q pp  -X 0  -m 1000  -t 7200  $PORTOPT  archive_${frelout[$i]}
-                printf "              Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n"
-                file_saved=true
-
-             else
-                printf "\n  +++ archive_system=\"$archive_system\"  archiving impossible!"
-                archive_save=false
-             fi
-
-                # CREATE EMPTY FLAG-FILE OR -DIRECTORY
-                # IN ORDER TO NOTE THE RESPECTIVE CYCLE NUMBER ON THE ARCHIVE SYSTEM
-                # RESTART-JOBS ARE USING THESE EMPTY-DIRECTORIES TO GET THE CURRENT HIGHEST
-                # CYCLE NUMBER ON THE ARCHIVE SYSTEM (IN CASE THAT INFORMATIONS ARE DIFFICULT TO
-                # TO ACCESS FROM THE ARCHIVE-SYSTEM DIRECTLY))
-             if [[ $file_saved = true ]]
-             then
-                if [[ $files_for_pes = false ]]
-                then
-                   cat  /dev/null  >  ${pathout[$i]}
-                else
-                   mkdir -p  ${pathout[$i]}
-                fi
-             fi
-
-          fi
 
              # APPEND ON THIS MACHINE
@@ -3982,33 +3429,37 @@
              then
                 printf "\n  >>> OUTPUT: ${localout[$i]}  to  ${pathout[$i]}.${extout[$i]}\n"
-		if [[ $link_local_output = true ]]
-		then
-		    printf "      using ln -f\n"
-		    ln -f  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
-		fi
-		# If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
-		if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]]
+		              if [[ $link_local_output = true ]]
+		              then
+		                 printf "      file will be linked\n"
+		                 ln -f  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
+		              fi
+		                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
+		              if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]]
                 then
-		    if [[ $link_local_output = true ]]
-	            then
-			printf "      ln failed, using cp...\n"
-		    fi
-		    cp  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
+		                 if [[ $link_local_output = true ]]
+	                  then
+                      printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
+		                 fi
+		                 cp  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
+		              else
+                   printf "+++ no copy because file ${pathout[$i]}.${extout[$i]} exists\n"
                 fi
              else
                 printf "\n  >>> OUTPUT: ${localout[$i]}  to  ${pathout[$i]}\n"
-		if [[ $link_local_output = true ]]
-		then
-		    printf "      using ln -f\n"
-		    ln -f  ${localout[$i]}  ${pathout[$i]}
-		fi
-		# If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
-		if [[ ! -f "${pathout[$i]}" ]]
+		              if [[ $link_local_output = true ]]
+		              then
+		                 printf "      file will be linked\n"
+		                 ln -f  ${localout[$i]}  ${pathout[$i]}
+		              fi
+		                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
+	              	if [[ ! -f "${pathout[$i]}" ]]
                 then
-		    if [[ $link_local_output = true ]]
-	            then
-			printf "      ln failed, using cp...\n"
-		    fi
-		    cp  ${localout[$i]}  ${pathout[$i]}
+		                 if [[ $link_local_output = true ]]
+	                  then
+                      printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
+		                 fi
+		                 cp  ${localout[$i]}  ${pathout[$i]}
+		              else
+		                 printf "+++ no copy because file ${pathout[$i]} exists\n"
                 fi
              fi
@@ -4020,25 +3471,25 @@
                 # AS A FIRST STEP, THE PERMANENT DIRECTORY IS CREATED
              printf "\n  >>> OUTPUT: ${localout[$i]}/_....  to  ${pathout[$i]}\n"
-	     if [[ $link_local_output = true ]]
-	     then
-		 printf "      using ln -f\n"
-		 mkdir  ${pathout[$i]}
-		 cd ${localout[$i]}
-		 for file in $(ls *)
-		 do
-		   ln -f $file  ${pathout[$i]}
-		 done
-		 cd $TEMPDIR
-	     fi
+	            if [[ $link_local_output = true ]]
+	            then
+		              printf "      files will be linked\n"
+		              mkdir  ${pathout[$i]}
+		              cd ${localout[$i]}
+		              for file in $(ls *)
+		              do
+		                 ln -f $file  ${pathout[$i]}
+		              done >|/dev/null 2>&1
+		              cd $TEMPDIR
+	            fi
 
                 # IF "ln -f" HAS FAILED OR IF "$link_local_output = false" DO A NORMAL COPY "cp -r"
-	     if [[ ! -f "${pathout[$i]}/_0000" ]]
+	            if [[ ! -f "${pathout[$i]}/_000000" ]]
              then
-		 if [[ $link_local_output = true ]]
-		 then
-		     printf "      ln failed for .../_0000, using cp...\n"
-		 fi
-		 cp -r  ${localout[$i]}  ${pathout[$i]}
-	     fi
+		              if [[ $link_local_output = true ]]
+		              then
+                   printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
+		              fi
+		              cp -r  ${localout[$i]}/*  ${pathout[$i]}
+       	     fi
 
           fi
@@ -4062,127 +3513,120 @@
     then
 
-       if [[ $archive_save = true ]]
-       then
-
-             # ADD RESTART-OPTIONS TO THE MRUN-CALL (IF THEY ARE NOT USED ALREADY):
-             # -C TELLS MRUN THAT IT IS A RESTART-RUN
-             # -v SILENT MODE WITHOUT INTERACTIVE QUERIES
-             # -n BATCH-MODE (IMPORTANT ONLY IN CASE OF BATCH JOBS ON THE LOCAL MACHINE)
-          [[ $(echo $mc | grep -c "\-C") = 0 ]]  &&  mc="$mc -C"
-          [[ $(echo $mc | grep -c "\-v") = 0 ]]  &&  mc="$mc -v"
-          [[ $(echo $mc | grep -c "\-b") = 0 ]]  &&  mc="$mc -b"
-          if [[ $(echo $mc | grep -c "#") != 0 ]]
-          then
-             mc=`echo $mc | sed 's/#/f/g'`
-          fi
-
-
-             # START THE RESTART-JOB
-          printf "\n\n  *** initiating restart-run on \"$return_address\" using command:\n"
-          echo "      $mc"
-          printf "\n$dashes\n"
-          if [[ $localhost != $fromhost ]]
-          then
-
-             if [[ $localhost = lcbullhh  ||  $localhost = lccrayb  ||  $localhost = lccrayh  ||  $localhost = nech  ||  $localhost = ibmh  ||  $localhost = ibmkisti  ||  $localhost = ibmku  ||  $localhost = ibms  ||  $localhost = lceddy  ||  $localhost = lckyu*  ||  $localhost = lcxe6 ]]
+          # ADD RESTART-OPTIONS TO THE MRUN-CALL (IF THEY ARE NOT USED ALREADY):
+          # -C TELLS MRUN THAT IT IS A RESTART-RUN
+          # -v SILENT MODE WITHOUT INTERACTIVE QUERIES
+          # -n BATCH-MODE (IMPORTANT ONLY IN CASE OF BATCH JOBS ON THE LOCAL MACHINE)
+       [[ $(echo $mc | grep -c "\-C") = 0 ]]  &&  mc="$mc -C"
+       [[ $(echo $mc | grep -c "\-v") = 0 ]]  &&  mc="$mc -v"
+       [[ $(echo $mc | grep -c "\-b") = 0 ]]  &&  mc="$mc -b"
+       if [[ $(echo $mc | grep -c "#") != 0 ]]
+       then
+          mc=`echo $mc | sed 's/#/f/g'`
+       fi
+
+
+          # START THE RESTART-JOB
+       printf "\n\n  *** initiating restart-run on \"$return_address\" using command:\n"
+       echo "      $mc"
+       printf "\n$dashes\n"
+       if [[ $localhost != $fromhost ]]
+       then
+
+          if [[ $localhost = lcbullhh  ||  $localhost = lccrayb  ||  $localhost = lccrayh  ||  $localhost = ibmh  ||  $localhost = ibmkisti  ||  $localhost = ibmku  ||  $localhost = ibms  ||  $localhost = lceddy  ||  $localhost = lckyu*  ||  $localhost = lcxe6 ]]
+          then
+             echo "*** ssh will be used to initiate restart-runs!"
+             echo "    return_address=\"$return_address\" "
+             echo "    return_username=\"$return_username\" "
+             if [[ $(echo $return_address | grep -c "130.75.105") = 1 ]]
+
+             if [[ $localhost = lcbullhh  ||  $localhost = lccrayb  ||  $localhost = lccrayh  ||  $localhost = ibmh  ||  $localhost = ibmkisti  ||  $localhost = ibmku  ||  $localhost = ibms  ||  $localhost = lceddy  ||  $localhost = lckyu*  ||  $localhost = lcxe6 ]]
              then
-                echo "*** ssh will be used to initiate restart-runs!"
-                echo "    return_address=\"$return_address\" "
-                echo "    return_username=\"$return_username\" "
-                if [[ $(echo $return_address | grep -c "130.75.105") = 1 ]]
+                if [[ $localhost = ibmh ]]
                 then
-                   if [[ $localhost = ibmh ]]
-                   then
-                      ssh $SSH_PORTOPT $usern@136.172.40.15 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lcbullhh ]]
-                   then
-                      ssh $SSH_PORTOPT $usern@mlogin101 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lccrayb ]]
-                   then
-                      ssh $usern@blogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lccrayh ]]
-                   then
-                      ssh $usern@hlogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lcxe6 ]]
-                   then
-                      ssh $usern@hexagon "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   else
-                      ssh $SSH_PORTOPT $return_address -l $return_username ". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
-                   fi
+                   ssh $SSH_PORTOPT $usern@136.172.40.15 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lcbullhh ]]
+                then
+                   ssh $SSH_PORTOPT $usern@mlogin101 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lccrayb ]]
+                then
+                   ssh $usern@blogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lccrayh ]]
+                then
+                   ssh $usern@hlogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lcxe6 ]]
+                then
+                   ssh $usern@hexagon "ssh $SSH_PORTOPT $return_address -l $return_username \". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\\\$PATH:$LOCAL_MRUN_PATH; export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
                 else
-                   if [[ $localhost = ibmkisti ]]
-                   then
-                      ssh $SSH_PORTOPT $usern@gaiad "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lceddy ]]
-                   then
-                      /usr/bin/ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
-                   elif [[ $localhost = lcocean ]]
-                   then
-                      /usr/bin/ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
-                   elif [[ $localhost = lccrayb ]]
-                   then
-                      ssh $usern@blogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   elif [[ $localhost = lccrayh ]]
-                   then
-                      ssh $usern@hlogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
-                   else
-                      ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
-                   fi
+                   ssh $SSH_PORTOPT $return_address -l $return_username ". \\\$HOME/.profile; module load intel-compiler hdf5 netcdf; PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
                 fi
              else
-                printf "\n  +++ no restart mechanism available for host \"$localhost\" "
-                locat=restart; exit
+                if [[ $localhost = ibmkisti ]]
+                then
+                   ssh $SSH_PORTOPT $usern@gaiad "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lceddy ]]
+                then
+                   /usr/bin/ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
+                elif [[ $localhost = lcocean ]]
+                then
+                   /usr/bin/ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
+                elif [[ $localhost = lccrayb ]]
+                then
+                   ssh $usern@blogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                elif [[ $localhost = lccrayh ]]
+                then
+                   ssh $usern@hlogin1 "ssh $SSH_PORTOPT $return_address -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                else
+                   ssh $SSH_PORTOPT $return_address -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
+                fi
              fi
-
-                # WAIT TO ALLOW THE RESTART-JOB TO BE QUEUED, BEFORE THE CURRENT JOB IS FINISHED
-	     if [[ $queue = special1q ]]
-	     then
-                sleep 120
-	     else
-	        sleep 30
-	     fi
-
           else
-
-                # JOBS RUNNING (AND STARTED) ON THE LOCAL MACHINE CAN DIRECTLY CALL MRUN (WITHOUT
-                # USING SSH)
-             cd $LOCAL_PWD
-             if [[ $localhost = lckyuh ]]
-             then
-                printf "\n  +++ WARNING: no restart mechanism available for host \"$localhost\" "
-                printf "\n               please restart job manually using command:\n"
-                printf "\n               \"$mc\" "
-             else
-                eval  $mc                # THE ' MUST BE EVALUATED
-             fi
-             cd -  > /dev/null
-          fi
+             printf "\n  +++ no restart mechanism available for host \"$localhost\" "
+             locat=restart; exit
+          fi
+
+             # WAIT TO ALLOW THE RESTART-JOB TO BE QUEUED, BEFORE THE CURRENT JOB IS FINISHED
+          if [[ $queue = special1q ]]
+          then
+             sleep 120
+          else
+             sleep 30
+          fi
+
+       else
+
+             # JOBS RUNNING (AND STARTED) ON THE LOCAL MACHINE CAN DIRECTLY CALL MRUN (WITHOUT
+             # USING SSH)
+          cd $LOCAL_PWD
           if [[ $localhost = lckyuh ]]
           then
-             printf "\n$dashes\n  *** restart-run to be initiated manually\n"
+             printf "\n  +++ WARNING: no restart mechanism available for host \"$localhost\" "
+             printf "\n               please restart job manually using command:\n"
+             printf "\n               \"$mc\" "
           else
-             printf "\n$dashes\n  *** restart-run initiated \n"
-          fi
-
-
-             # DELETE INPUT-(RESTART)FILES, WHICH HAVE BEEN FETCHED FROM THE TEMPORARY DATA
-             # DIRECTORY, BACAUSE THEY ARE NOT REQUIRED BY THE RESTART-JOB.
-             # THIS IS DONE IN ORDER TO AVOID EXCEEDING DISC QUOTAS OR DISC SPACE (RESTART-FILES
-             # MAY BE VERY HUGE)
-          (( i = 0 ))
-          while (( i < iin ))
-          do
-             (( i = i + 1 ))
-             if [[ "${got_tmp[$i]}" = true   &&  $keep_data_from_previous_run = false ]]
-             then
-                rm -r  $tmp_data_catalog/${frelin[$i]}
-             fi
-          done
-
+             eval  $mc                # THE ' MUST BE EVALUATED
+          fi
+          cd -  > /dev/null
+       fi
+       if [[ $localhost = lckyuh ]]
+       then
+          printf "\n$dashes\n  *** restart-run to be initiated manually\n"
        else
-
-          printf "\n  +++ no restart-run possible, since errors occured"
-          printf "\n      during the archive process"
-       fi
+          printf "\n$dashes\n  *** restart-run initiated \n"
+       fi
+
+
+          # DELETE INPUT-(RESTART)FILES, WHICH HAVE BEEN FETCHED FROM THE TEMPORARY DATA
+          # DIRECTORY, BACAUSE THEY ARE NOT REQUIRED BY THE RESTART-JOB.
+          # THIS IS DONE IN ORDER TO AVOID EXCEEDING DISC QUOTAS OR DISC SPACE (RESTART-FILES
+          # MAY BE VERY HUGE)
+       (( i = 0 ))
+       while (( i < iin ))
+       do
+          (( i = i + 1 ))
+          if [[ "${got_tmp[$i]}" = true   &&  $keep_data_from_previous_run = false ]]
+          then
+             rm -r  ${absnamein[$i]}
+          fi
+       done
 
     fi
@@ -4229,5 +3673,4 @@
     [[ $do_compile = true ]]      &&  mrun_com=${mrun_com}" -s \"$source_list\""
     [[ "$input_list" != "" ]]     &&  mrun_com=${mrun_com}" -i \"$input_list\""
-    [[ $ignore_archive_error = true ]]  &&  mrun_com=${mrun_com}" -I"
     [[ $keep_data_from_previous_run = true ]]  &&  mrun_com=${mrun_com}" -k"
     [[ "$additional_conditions" != "" ]]  &&  mrun_com=${mrun_com}" -K \"$additional_conditions\""
@@ -4241,5 +3684,4 @@
     fi
     [[ "$tasks_per_node" != "" ]]  &&  mrun_com=${mrun_com}" -T $tasks_per_node"
-    [[ $store_on_archive_system = true ]]  &&  mrun_com=${mrun_com}" -A"
     [[ $package_list != "" ]]     &&  mrun_com=${mrun_com}" -p \"$package_list\""
     [[ $return_password != "" ]]  &&  mrun_com=${mrun_com}" -P $return_password"
