Index: python/submit.py
===================================================================
--- python/submit.py	(revision 222aa11adf53657adfc8efd6a35ab83b1efb0688)
+++ python/submit.py	(revision 2fb99de9b96e65c8b5caa85c276ad8e0be540ed0)
@@ -16,4 +16,7 @@
 #        - added documentation
 #        - minor changes in programming style (for consistence)
+#        - changed path names to variables from config file
+#        - added option for writing mars requests to extra file
+#          additionally,as option without submitting the mars jobs
 #
 # @License:
@@ -73,6 +76,4 @@
     '''
 
-    called_from_dir = os.getcwd()
-
     args = get_cmdline_arguments()
 
@@ -80,20 +81,18 @@
         c = ControlFile(args.controlfile)
     except IOError:
-        try:
-            c = ControlFile(_config.PATH_LOCAL_PYTHON + args.controlfile)
-        except IOError:
-            print 'Could not read CONTROL file "' + args.controlfile + '"'
-            print 'Either it does not exist or its syntax is wrong.'
-            print 'Try "' + sys.argv[0].split('/')[-1] + \
-                  ' -h" to print usage information'
-            sys.exit(1)
-
-    env_parameter = read_ecenv(c.ecmwfdatadir + 'python/ECMWF_ENV')
+        print('Could not read CONTROL file "' + args.controlfile + '"')
+        print('Either it does not exist or its syntax is wrong.')
+        print('Try "' + sys.argv[0].split('/')[-1] + \
+              ' -h" to print usage information')
+        sys.exit(1)
+
+    env_parameter = read_ecenv(_config.PATH_ECMWF_ENV)
     c.assign_args_to_control(args)
     c.assign_envs_to_control(env_parameter)
-    c.check_conditions()
+    c.check_conditions(args.queue)
 
     # on local side
-    # on ECMWF server this would be the local side
+    # on ECMWF server this would also be the local side
+    called_from_dir = os.getcwd()
     if args.queue is None:
         if c.inputdir[0] != '/':
@@ -102,7 +101,10 @@
             c.outputdir = os.path.join(called_from_dir, c.outputdir)
         get_mars_data(c)
-        prepare_flexpart(args.ppid, c)
-        normal_exit(c.mailfail, 'Done!')
-    # on ECMWF server
+        if c.request == 0 or c.request == 2:
+            prepare_flexpart(args.ppid, c)
+            normal_exit(c.mailfail, 'FLEX_EXTRACT IS DONE!')
+        else:
+            normal_exit(c.mailfail, 'PRINTING MARS_REQUESTS DONE!')
+    # send files to ECMWF server and install there
     else:
         submit(args.job_template, c, args.queue)
@@ -117,5 +119,6 @@
     @Input:
         jtemplate: string
-            Job template file for submission to ECMWF. It contains all necessary
+            Job template file from sub-directory "_templates" for
+            submission to ECMWF. It contains all necessary
             module and variable settings for the ECMWF environment as well as
             the job call and mail report instructions.
@@ -143,5 +146,5 @@
 
     # read template file and get index for CONTROL input
-    with open(jtemplate) as f:
+    with open(os.path.join(_config.PATH_TEMPLATES, jtemplate)) as f:
         lftext = f.read().split('\n')
     insert_point = lftext.index('EOF')
@@ -150,8 +153,9 @@
     # --------- create on demand job script ------------------------------------
         if c.maxstep > 24:
-            print '---- Pure forecast mode! ----'
+            print('---- Pure forecast mode! ----')
         else:
-            print '---- On-demand mode! ----'
-        job_file = jtemplate[:-4] + 'ksh'
+            print('---- On-demand mode! ----')
+        job_file = os.path.join(_config.PATH_JOBSCRIPTS,
+                                jtemplate[:-4] + 'ksh')
         clist = c.to_list()
 
@@ -161,11 +165,11 @@
             f.write('\n'.join(lftextondemand))
 
-        result_code = submit_job_to_ecserver(queue, job_file)
+        submit_job_to_ecserver(queue, job_file)
 
     else:
     # --------- create operational job script ----------------------------------
-        print '---- Operational mode! ----'
-        job_file = jtemplate[:-5] + 'oper.ksh'
-        #colist = []
+        print('---- Operational mode! ----')
+        job_file = os.path.join(_config.PATH_JOBSCRIPTS,
+                                jtemplate[:-5] + 'oper.ksh')
 
         if c.maxstep:
@@ -187,8 +191,8 @@
             f.write('\n'.join(lftextoper))
 
-        result_code = submit_job_to_ecserver(queue, job_file)
+        submit_job_to_ecserver(queue, job_file)
 
     # --------------------------------------------------------------------------
-    print 'You should get an email with subject flex.hostname.pid'
+    print('You should get an email with subject flex.hostname.pid')
 
     return
