<?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: Logging job status to an ODBC table in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576049#M17666</link>
    <description>&lt;P&gt;"&lt;SPAN&gt;the start and end times, the job name, and the status of the job on completion"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;All this is recorded by the scheduler. Is there a reason for not using the scheduler's data?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 07:09:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-07-24T07:09:06Z</dc:date>
    <item>
      <title>Logging job status to an ODBC table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576032#M17665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to SAS DI and I'm trying to build a simple ETL framework. I would like be able write audit information whenever a job is executed to an ODBC table. for example, the start and end times, the job name, and the status of the job on completion e.g. SUCCESS or FAILURE. I have done this in other ETL tools by creating a stored procedure at database level and calling them from the ETL tool.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With DI this works perfectly to create the job audit record, but the problem I have is that if a transformation fails, then the NOEXEC option is set which is preventing the proc sql command to update the audit record with end timestamp and job status from running. Hopefully the attached screenshot explains what I'm trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="di 001.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31249iB57B1FF6DCB6DEB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="di 001.png" alt="di 001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The logfile for the log job end transformation shows my ODBC stored procedure call not being executed because the error in the SCD 2 transformation has set the NOEXEC option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;6125       proc sql;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
6126       
6127          connect to odbc (datasrc='fluxliner_repo');
NOTE: Statement not executed due to NOEXEC option.
6130       
6131          execute(dbo.sp_package_end
6132                    @batch_id     = "&amp;amp;batch_id",
6133                    @package_name = "&amp;amp;etls_JobName",
6134                    @status       = "&amp;amp;JOB_RC") by odbc;
NOTE: Statement not executed due to NOEXEC option.
6135       
6136          disconnect from odbc;
NOTE: Statement not executed due to NOEXEC option.
6137       
6138       quit;
NOTE: The SAS System stopped processing this step because of errors.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried things like adding the EXEC option to the proc sql call, and also RESET NOEXEC, but they don't seem to make any difference. I've also tried adding an erorr status handler to the SCD2 transformation which has an action of None in the hope that this would allow to SQL exec transformation to run but that doesn't help either.I'm not sure if I'm going about using the status handler in the correct way though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS DI 4.9.04.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 03:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576032#M17665</guid>
      <dc:creator>Scoindy</dc:creator>
      <dc:date>2019-07-24T03:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Logging job status to an ODBC table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576049#M17666</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;the start and end times, the job name, and the status of the job on completion"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;All this is recorded by the scheduler. Is there a reason for not using the scheduler's data?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 07:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576049#M17666</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-24T07:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Logging job status to an ODBC table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576075#M17667</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282638"&gt;@Scoindy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you inspect DIS generated code for status handling in case of error you'll see that besides of setting NOSYNTAXCHECK you also need to set OBS=MAX.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 589px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31254i243329FD4721B610/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on DIS generated code here how I'd implement if using a user written transformation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro demo();
  %if (&amp;amp;job_rc ge 5) %then
    %do;
      %local etls_syntaxcheck;
      %let etls_syntaxcheck = %sysfunc(getoption(syntaxcheck));

      /* Turn off syntaxcheck option to perform following steps  */
      options nosyntaxcheck;
      %local etls_obs;
      %let etls_obs = %sysfunc(getoption(obs));

      /* Set obs option to max to perform following steps  */
      options obs = max;
    %end;

/** here your custom logic to update the table **/

  %if (&amp;amp;job_rc ge 5) %then
    %do;
      /* Reset obs option to previous setting  */
      options obs = &amp;amp;etls_obs;

      /* Reset syntaxcheck option to previous setting  */
      options &amp;amp;etls_syntaxcheck;
    %end;
%mend demo;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even though implementing the process to write status information within a job itself is quite common&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;'s question is very valid especially if you don't need any information the scheduler doesn't have (like pre- and post rowcounts).&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 09:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576075#M17667</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-07-24T09:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Logging job status to an ODBC table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576388#M17669</link>
      <description>&lt;P&gt;Thanks both. I will look into what the scheduler can offer, but in the meantime Patrick's answer has allowed me to do what I wanted to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 21:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Logging-job-status-to-an-ODBC-table/m-p/576388#M17669</guid>
      <dc:creator>Scoindy</dc:creator>
      <dc:date>2019-07-24T21:41:03Z</dc:date>
    </item>
  </channel>
</rss>

