<?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: #job exceution Waiting for a job to finish before launching another job with xml prompts in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/974229#M377843</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;, are you good?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the problem is that you're overwriting the &lt;EM&gt;QUERY_VALUE&lt;/EM&gt; macro variable &lt;STRONG&gt;twice on the same line&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let QUERY_VALUE=FORM(...); %let QUERY_VALUE=FORM(...);&lt;/PRE&gt;
&lt;P&gt;Only the &lt;STRONG&gt;second assignment&lt;/STRONG&gt; actually takes effect. So, if you intended to run the job with both settings (HTML and JSON), only the last one (&lt;EM&gt;_action='json'&lt;/EM&gt;) is being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use &lt;STRONG&gt;only one&lt;/STRONG&gt; &lt;EM&gt;%let QUERY_VALUE=FORM(...)&lt;/EM&gt; statement at a time, depending on the output you want;&lt;/LI&gt;
&lt;LI&gt;If you want to run both jobs (HTML and JSON), separate them into two blocks, each with its own &lt;EM&gt;%let&lt;/EM&gt; and &lt;EM&gt;%jobexec_run&lt;/EM&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You're overwriting the macro variable, so only the last value is used. Split them up, and run each job separately with its own macro assignment.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Sep 2025 11:25:54 GMT</pubDate>
    <dc:creator>arthurdpereira</dc:creator>
    <dc:date>2025-09-05T11:25:54Z</dc:date>
    <item>
      <title>#job exceution Waiting for a job to finish before launching another job with xml prompts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/971210#M377288</link>
      <description>&lt;P&gt;Building on the article&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/jobexeccdc/v_004/jobexecug/n1jj26acxr0ictn1riqgxoxrcehu.htm#p16740onala63yn1b33hclbasl0m" target="_self"&gt;https://documentation.sas.com/doc/en/jobexeccdc/v_004/jobexecug/n1jj26acxr0ictn1riqgxoxrcehu.htm#p16740onala63yn1b33hclbasl0m&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to pre-filter a table and use this resulting table in&amp;nbsp; the XML prompts&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;Metadata&amp;gt;&lt;BR /&gt;&amp;lt;DataSources&amp;gt;&lt;/P&gt;
&lt;P&gt;carried out by the second job.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first job works well, but the second job does not create the form thus fails to do any meaningful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*  Make the utility macros available;

%jesutil()

*  Declare the program variables;

%global make
		type
        J1JOBID
        J2JOBID
        QUERY_VALUE
        SERVICESBASEURL;

*  Initialize the program variables;

%let DSNAME=class;

%let SERVICESBASEURL=%sysfunc(getoption(servicesbaseurl));

*;
*  Specify that the J1 job is executed in the background.  Progress
*  can be monitored using the SAS Job Execution Web Application 
*  Jobs page (/SASJobExecution/jobs).
*;
%let QUERY_VALUE=FORM('_action'='background' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v1' 'make'="&amp;amp;make" 'type'="&amp;amp;type");
/* %let QUERY_VALUE=FORM('_action'='background' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v1' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type"); */
/* %let QUERY_VALUE=FORM('_action'='form,prompts,execute' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2'); */

*;
*  The macro does not wait for the job to finish execution because _action=background is
*  specified.  You use the value of the J1JOBID macro variable with the
*  %JOBEXEC_WAITFOR macro to wait for the job to complete before executing further
*  statements.
*;

%jobexec_run(baseurl=&amp;amp;SERVICESBASEURL,
             in=&amp;amp;QUERY_VALUE,
             jobid_varname=J1JOBID);

%if (&amp;amp;_JOBRUN_RC eq 0) %then %do;
  %put NOTE: You can view the job execution object at /jobExecution/jobs/&amp;amp;J1JOBID;
%end;
%else %do;
  %put ERROR: Problem running the job. &amp;amp;=_JOBRUN_RC  &amp;amp;=_STATUS_MESSAGE;
%end;

*  Wait for the J1 job to finish before executing more statements;

%jobexec_waitfor(baseurl=&amp;amp;SERVICESBASEURL,
                 jobid=&amp;amp;J1JOBID)

%if (&amp;amp;_JOBRUN_RC eq 0) %then %do;
  %put NOTE: Job finished executing. Final job state is "&amp;amp;_JOBRUN_STATE".;
%end;
%else %do;
  %put ERROR: Problem waiting for the job. &amp;amp;=_JOBRUN_RC  &amp;amp;=_STATUS_MESSAGE  &amp;amp;=_JOBRUN_ERRMSG;
%end;

*  Execute the second job;

/* %let QUERY_VALUE=FORM('_program'='/Users/cordear1/My Folder/jobs/test sequential run v2'); */
/* %let QUERY_VALUE=FORM('_action'='json' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type"); */

%let QUERY_VALUE=FORM('_action'='form,prompts,execute' '_OUTPUT_TYPE'='html' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type");%let QUERY_VALUE=FORM('_action'='json' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type");

*;
*  The macro waits for the job to finish execution because _action=background is not
*  specified.  
*;

%jobexec_run(baseurl=&amp;amp;SERVICESBASEURL,
             in=&amp;amp;QUERY_VALUE,
             jobid_varname=J2JOBID);

%if (&amp;amp;_JOBRUN_RC eq 0) %then %do;
  %put NOTE: You can view the job execution object at /jobExecution/jobs/&amp;amp;J2JOBID;
  %put NOTE: You can view the job output at /SASJobExecution/?_jobexec=/jobExecution/jobs/&amp;amp;J2JOBID;
%end;
%else %do;
  %put ERROR: Problem running the job. &amp;amp;=_JOBRUN_RC  &amp;amp;=_STATUS_MESSAGE;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that I'm missing the correct definition of the _action or _output_type parameter in the following line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let QUERY_VALUE=FORM('_action'='form,prompts,execute' '_OUTPUT_TYPE'='html' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type");%let QUERY_VALUE=FORM('_action'='json' '_program'='/Users/cordear1/My Folder/jobs/test sequential run v2' 'sleep'='5' 'make'="&amp;amp;make" 'type'="&amp;amp;type");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic0.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108478i52673C9A5F7F6355/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic0.png" alt="pic0.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108480i6F55B31B0C0D8241/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic1.png" alt="pic1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic2.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108479i6E16E79926D0C274/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic2.png" alt="pic2.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pic3.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108477iBCBD66B489E3F5D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="pic3.png" alt="pic3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 13:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/971210#M377288</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2025-07-21T13:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: #job exceution Waiting for a job to finish before launching another job with xml prompts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/971304#M377291</link>
      <description>&lt;P&gt;One thing I think for the error message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "There is no handler defined for the path /SASJobExecution/jobs..."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the URL should be /jobExecution/jobs instead of /SASJobExecution/&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 12:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/971304#M377291</guid>
      <dc:creator>DeMer</dc:creator>
      <dc:date>2025-07-22T12:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: #job exceution Waiting for a job to finish before launching another job with xml prompts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/974229#M377843</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127222"&gt;@acordes&lt;/a&gt;, are you good?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the problem is that you're overwriting the &lt;EM&gt;QUERY_VALUE&lt;/EM&gt; macro variable &lt;STRONG&gt;twice on the same line&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let QUERY_VALUE=FORM(...); %let QUERY_VALUE=FORM(...);&lt;/PRE&gt;
&lt;P&gt;Only the &lt;STRONG&gt;second assignment&lt;/STRONG&gt; actually takes effect. So, if you intended to run the job with both settings (HTML and JSON), only the last one (&lt;EM&gt;_action='json'&lt;/EM&gt;) is being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use &lt;STRONG&gt;only one&lt;/STRONG&gt; &lt;EM&gt;%let QUERY_VALUE=FORM(...)&lt;/EM&gt; statement at a time, depending on the output you want;&lt;/LI&gt;
&lt;LI&gt;If you want to run both jobs (HTML and JSON), separate them into two blocks, each with its own &lt;EM&gt;%let&lt;/EM&gt; and &lt;EM&gt;%jobexec_run&lt;/EM&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You're overwriting the macro variable, so only the last value is used. Split them up, and run each job separately with its own macro assignment.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 11:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/job-exceution-Waiting-for-a-job-to-finish-before-launching/m-p/974229#M377843</guid>
      <dc:creator>arthurdpereira</dc:creator>
      <dc:date>2025-09-05T11:25:54Z</dc:date>
    </item>
  </channel>
</rss>

