<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script to run sas job on autosys - Unix environment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322865#M271104</link>
    <description>&lt;P&gt;&lt;EM&gt;Do I need to modify any lines in sas.sh ?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I wouldn't change sas.sh at all but you can always create and use a copy of the file and then add whatever modifications you like. The one thing I'm normally adding is a cd command pointing to the log directory so that any unspecified output goes there.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;2.What&amp;nbsp;command line should I&amp;nbsp;use in the autosys.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use pretty much the same than what you've posted for Windows - just with different paths. As for the command posted for Windows: I would have used the sas.bat file there as well instead of the sas.exe (same reason: gives you the server context specific environment under which you've likely developed and unit tested your code).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;wrote:&amp;nbsp;&lt;EM&gt;If you are using data integration the deployed job contains the full command line.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've used such a command line from my Windows environment and below how this looks like (with some amendments):&lt;/P&gt;
&lt;PRE&gt;/&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/sasbatch.sh 
-sysin /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/SASEnvironment/SASCode/Jobs/my_prog.sas
-log /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/Logs/my_prog_#Y.#m.#d_#H.#M.#s.log  
-logparm "rollover=session"  
-batch 
-noterminal 
-print /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/Logs/my_prog.lst&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can see that it uses /BatchServer/sasbatch.sh. You can use this one as well if a batch server exists in your environment and there if you need to add any amendments to the script then add them to&amp;nbsp;sasbatch_usermods.sh (it's already all there prepared and waiting for you - too easy).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Other possible amendments:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;You could write a wrapper script which then includes sasbatch.sh or add changes directly to the sasbatch_usermods.shfile. You could for example add some parameter processing like: I&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;nstead of having to pass in fully qualified paths to -sysin, -log and -print add these paths as part of your script. You could for example on the outermost level only require to pass in the SAS program name without a path and then you add all the rest within your custom wrapper script (or within sasbatch_usermods.sh). This would make the command line you have to pass to Autosys much shorter.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Same is true for any additional parameters like -noterminal which you always want set for batch processing.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2017 01:11:27 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-01-06T01:11:27Z</dc:date>
    <item>
      <title>Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322523#M271098</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the script to run a sas job on autosys in Unix environement. For windows we use .ps (powershell scripts) or .cmd (command line scripts). Can someone provide a template of the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aj&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 22:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322523#M271098</guid>
      <dc:creator>AjayPrasad</dc:creator>
      <dc:date>2017-01-04T22:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322541#M271099</link>
      <description>&lt;P&gt;Could you post the template for the .cmd Windows batch file?&lt;/P&gt;
&lt;P&gt;From this, one could deduce the requirements for a UNIX shell script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is also most important to know how autosys passes control parameters to jobs.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 23:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322541#M271099</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-04T23:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322579#M271100</link>
      <description>&lt;P&gt;In the root folder of your SAS Server context - i.e..../Lev/SASApp - you'll find a script &lt;STRONG&gt;sas.sh&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use this script in autosys and then just pass in the parameters you need. You can test the correctness of the command line by executing it out of a command prompt (i.e. via Putty).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.../sas.sh -sysin &amp;lt;your SAS program&amp;gt; -log &amp;lt;same name as SAS program, add a timestamp to the name&amp;gt; .....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using sas.sh has the advantage that all your .cfg adn autoexec's will get executed for the server context and though your batch jobs will get the same environment than what you've used during development via SAS EG or the like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 03:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322579#M271100</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-01-05T03:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322613#M271101</link>
      <description>If you are using data integration the deployed job contains the full command line.</description>
      <pubDate>Thu, 05 Jan 2017 09:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322613#M271101</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-01-05T09:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322712#M271102</link>
      <description>&lt;P&gt;Few questions running in my mind&lt;/P&gt;&lt;P&gt;1.Do I need to modify any lines in sas.sh ?&lt;/P&gt;&lt;P&gt;2.What&amp;nbsp;command line should I&amp;nbsp;use in the autosys. For example if I have a program.sas, I would create a command script at a location and give that path in the command on autosys. It may look like this \\servername\filepath\program.cmd or \\servername\filepath\program.ps1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please clarify!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322712#M271102</guid>
      <dc:creator>AjayPrasad</dc:creator>
      <dc:date>2017-01-05T16:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322718#M271103</link>
      <description>&lt;P&gt;Below is the script for .cmd Windows batch file to run on autosys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;"C:\sas94\sashome\SASFoundation\9.4\sas.exe"&amp;nbsp; -config "C:\sas94\sashome\SASFoundation\9.4\nls\en\SASV9.CFG" -sysin "G:\ANALYTICS\SAS_CODE\Program\Program.sas" -LOG "G:\ANALYTICS\SAS_LOGS\Program\Program.log" -PRINT "G:\ANALYTICS\Reports\Program\Program.lst" -xcmd -noxwait -xsync -nosplash -icon -rsasuser&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do we have a similar template&amp;nbsp;for Unix?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 17:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322718#M271103</guid>
      <dc:creator>AjayPrasad</dc:creator>
      <dc:date>2017-01-05T17:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322865#M271104</link>
      <description>&lt;P&gt;&lt;EM&gt;Do I need to modify any lines in sas.sh ?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I wouldn't change sas.sh at all but you can always create and use a copy of the file and then add whatever modifications you like. The one thing I'm normally adding is a cd command pointing to the log directory so that any unspecified output goes there.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;2.What&amp;nbsp;command line should I&amp;nbsp;use in the autosys.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use pretty much the same than what you've posted for Windows - just with different paths. As for the command posted for Windows: I would have used the sas.bat file there as well instead of the sas.exe (same reason: gives you the server context specific environment under which you've likely developed and unit tested your code).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;wrote:&amp;nbsp;&lt;EM&gt;If you are using data integration the deployed job contains the full command line.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've used such a command line from my Windows environment and below how this looks like (with some amendments):&lt;/P&gt;
&lt;PRE&gt;/&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/sasbatch.sh 
-sysin /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/SASEnvironment/SASCode/Jobs/my_prog.sas
-log /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/Logs/my_prog_#Y.#m.#d_#H.#M.#s.log  
-logparm "rollover=session"  
-batch 
-noterminal 
-print /&amp;lt;root path&amp;gt;/SAS/Config/Lev1/SASApp/BatchServer/Logs/my_prog.lst&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can see that it uses /BatchServer/sasbatch.sh. You can use this one as well if a batch server exists in your environment and there if you need to add any amendments to the script then add them to&amp;nbsp;sasbatch_usermods.sh (it's already all there prepared and waiting for you - too easy).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Other possible amendments:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;You could write a wrapper script which then includes sasbatch.sh or add changes directly to the sasbatch_usermods.shfile. You could for example add some parameter processing like: I&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;nstead of having to pass in fully qualified paths to -sysin, -log and -print add these paths as part of your script. You could for example on the outermost level only require to pass in the SAS program name without a path and then you add all the rest within your custom wrapper script (or within sasbatch_usermods.sh). This would make the command line you have to pass to Autosys much shorter.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Same is true for any additional parameters like -noterminal which you always want set for batch processing.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2017 01:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322865#M271104</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-01-06T01:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script to run sas job on autosys - Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322866#M271105</link>
      <description>&lt;P&gt;Thanks for a great and best explanation. This completely helped me fix my script.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2017 00:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Script-to-run-sas-job-on-autosys-Unix-environment/m-p/322866#M271105</guid>
      <dc:creator>AjayPrasad</dc:creator>
      <dc:date>2017-01-06T00:55:27Z</dc:date>
    </item>
  </channel>
</rss>

