Index: palm/trunk/SCRIPTS/batch_scp
===================================================================
--- palm/trunk/SCRIPTS/batch_scp	(revision 4439)
+++ palm/trunk/SCRIPTS/batch_scp	(revision 4443)
@@ -27,4 +27,8 @@
 # -----------------
 # $Id$
+# add cycle number to initial files too (000),
+# remove compatibility for cycle numbers which are less than three digits wide
+# 
+# 3549 2018-11-21 15:44:44Z raasch
 # english translation of german comments / variable names
 # 
@@ -427,13 +431,4 @@
           then
              (( maxcycle = icycle ))
-
-                 # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
-                 # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
-              if [[ $(echo $cycle | cut -c1) = 0 ]]
-              then
-                 leading_zero=true
-              else
-                 leading_zero=false
-              fi
           fi
 
@@ -464,16 +459,9 @@
                    (( maxcycle = usecycle ))
                 else
-                    printf "  >>> Unfied cycle number cannot be used\n"
+                    printf "  >>> Unified cycle number cannot be used\n"
                 fi
              fi
-             cyclestring=`printf ".%03d" $maxcycle`
-          else
-             if (( maxcycle == 0 ))
-             then
-                cyclestring=""
-             else
-                cyclestring=`printf ".%03d" $maxcycle`
-             fi
-          fi
+          fi
+          cyclestring=`printf ".%03d" $maxcycle`
        else
           if [[ $overwrite = false ]]
@@ -487,18 +475,6 @@
        if [[ $absolut = false ]]
        then
-          if (( maxcycle == 0 ))
-          then
-             cyclestring=""
-          else
-
-                # MAKE CYCLE NUMBER THREE DIGITS WIDE
-             if [[ $leading_zero = true ]]
-             then
-                cyclestring=`printf ".%03d" $maxcycle`
-             else
-                cyclestring=.$maxcycle
-             fi
-             (( maxcycle = 0 ))
-          fi
+             # MAKE CYCLE NUMBER THREE DIGITS WIDE
+          cyclestring=`printf ".%03d" $maxcycle`
        else
           cyclestring=""
@@ -511,8 +487,6 @@
     then
        (( maxcycle = usecycle ))
-       cyclestring=`printf ".%03d" $usecycle`
-    else
-       cyclestring=""
-    fi
+    fi
+    cyclestring=`printf ".%03d" $maxcycle`
 
        # EXIT, IF FILE SHALL BE GET FROM THE TARGET HOST, BUT DOESN'T EXIST
@@ -526,13 +500,4 @@
 
 
-    # IF A FOLDER IS CREATED, THE FILENAME MUST NOT CONTAIN A CYCLE NUMBER IN
-    # ANY CASE, SINCE IT CANNOT HAVE ONE
- if [[ $make_catalog = force ]]
- then
-    cyclestring=""
-    (( maxcycle = 0 ))
- fi
-
- 
     # IF NAME-OPTION (-n) IS CHOSEN, ONLY DETERMINE THE LOCAL FILENAME ON THE
     # TARGET HOST AND EXIT THE SCRIPT
@@ -630,5 +595,5 @@
           if [[ $? != 0 ]]
           then
-                # CHECK, OB IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
+                # CHECK, IF FILE SIZES ON LOCAL HOST AND TARGET HOST MATCH
              local_size=`ls -al  $2`
              local_size=`echo $local_size | cut -d" " -f5`
Index: palm/trunk/SCRIPTS/palmrun
===================================================================
--- palm/trunk/SCRIPTS/palmrun	(revision 4439)
+++ palm/trunk/SCRIPTS/palmrun	(revision 4443)
@@ -27,4 +27,8 @@
 # -----------------
 # $Id$
+# add cycle number to initial files too (000),
+# remove compatibility for cycle numbers which are less than three digits wide
+# 
+# 4425 2020-02-26 15:35:00Z raasch
 # hard coded path to the fileconnection file replaced by a path that is based on
 # the source path which has been given in the configuration file
@@ -1355,52 +1359,42 @@
           while  read line
           do
-                 # filename without path (i.e. after the last "/")
-              basefilename=$(basename ${line})
+                # filename without path (i.e. after the last "/")
+             basefilename=$(basename ${line})
    
-                 # check if there is an extension
-              extension=${basefilename##*.}
-              if [[ "$extension" = "${extin[$nr_of_input_files]}" ]]
-              then
-                 basefilename=${basefilename%.*}
-              fi
+                # check if there is an extension
+             extension=${basefilename##*.}
+             if [[ "$extension" = "${extin[$nr_of_input_files]}" ]]
+             then
+                basefilename=${basefilename%.*}
+             fi
    
-                 # check for an existing cycle number
-              cycle=${basefilename##*.}
-              if [[ $cycle =~ ^-?[0-9]+$ ]]
-              then
-                    # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
-                    # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
-                 (( icycle = $((10#$cycle)) ))
-              else
-                 (( icycle = 0 ))
-              fi
+                # check for an existing cycle number
+             cycle=${basefilename##*.}
+             if [[ $cycle =~ ^-?[0-9]+$ ]]
+             then
+                   # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
+                   # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
+                (( icycle = $((10#$cycle)) ))
+                explicit_cycle_number=true
+             else
+                (( icycle = 0 ))
+                explicit_cycle_number=false
+             fi
    
-              if (( icycle > maxcycle ))
-              then
-                 (( maxcycle = icycle ))
-   
-                    # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
-                    # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
-                 if [[ $(echo $cycle | cut -c1) = 0 ]]
-                 then
-                    leading_zero=true
-                 else
-                    leading_zero=false
-                 fi
-              fi
+             if (( icycle > maxcycle ))
+             then
+                (( maxcycle = icycle ))
+             fi
    
           done <filelist
           rm filelist
+
    
              # MAKE CYCLE NUMBER THREE DIGITS WIDE
-          if [[ $leading_zero = true ]]
-          then
-             cyclestring=`printf "%03d" $maxcycle`
-          else
-             cyclestring=$maxcycle
-          fi
+          cyclestring=`printf "%03d" $maxcycle`
+
    
              # APPEND CYCLE NUMBER TO FILENAME
-          if (( maxcycle > 0 ))
+          if [[ $explicit_cycle_number = true ]]
           then
              if [[ "${extin[$nr_of_input_files]}" != " "  &&   "${extin[$nr_of_input_files]}" != "" ]]
@@ -1420,5 +1414,5 @@
              # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE)
           absnamein[$nr_of_input_files]=$filename
-          if (( maxcycle > 0 ))
+          if [[ $explicit_cycle_number = true ]]
           then
              if [[ "${actionin[$nr_of_input_files]}" = di ]]
@@ -1996,4 +1990,5 @@
     if [[ $running_in_batch_mode = false ]]
     then
+
           # CREATE THE DIRECTORY
        mkdir -p  $tempdir
@@ -2166,5 +2161,5 @@
 		                 ln -f  ${absnamein[$i]}  ${localin[$i]}
 	              	fi
-	                 	# If "ln -f" fails or if "$link_local_input = false" do a normal "cp"
+	                 	# IF "ln -f" FAILS OR IF "$link_local_input = false" DO A NORMAL "cp"
 	              	if [[ ! -f "${localin[$i]}" ]]
                 then
@@ -2494,4 +2489,5 @@
           ls -1 -d $filename    >   filelist  2>/dev/null
           ls -1 -d $filename.*  >>  filelist  2>/dev/null
+          (( maxcycle = 0 ))
           while  read line
           do
@@ -2531,5 +2527,8 @@
           if [[ "${actionout[$i]}" = a ]]
           then
-             (( maxcycle = maxcycle - 1 ))
+             if (( maxcycle > 0 ))
+             then
+                (( maxcycle = maxcycle - 1 ))
+             fi
           fi
           
@@ -2554,10 +2553,7 @@
              fi
           fi
-          if (( cycnum[$i] > 0 ))
-          then
-             cyclestring=`printf "%03d" ${cycnum[$i]}`
-             pathout[$i]=${pathout[$i]}.$cyclestring
-          fi
-       fi           
+          cyclestring=`printf "%03d" ${cycnum[$i]}`
+          pathout[$i]=${pathout[$i]}.$cyclestring
+       fi
 
           # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION)
