<?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 capture status code from subjob in main job in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/capture-status-code-from-subjob-in-main-job/m-p/2269918#M47985</link>
    <description>Hi, 
&lt;BR /&gt;I am developing a job which calls numerous subjobs. 
&lt;BR /&gt;I have added the tLogCatcher component in each of the subjob and main job. 
&lt;BR /&gt;The basic purpose behind adding the component in all jobs is to catch any error/exception at its origin and propagate it through the hierarchy correctly. 
&lt;BR /&gt;Now the catch is that every time an exception occurs, the main job should not terminate. 
&lt;BR /&gt;The main job should terminate only in case the exception in the subjob is of severe category such as database not available or network connectivity lost. 
&lt;BR /&gt;If there are other exceptions such as error while reading a file or writing to a file, the subjob performing the said action should fail but the main job should continue with the execution. 
&lt;BR /&gt;For this I disabled the "Die on child error" checkbox in the tRunJob component that invokes the subjob. 
&lt;BR /&gt;But now I want to check why the subjob failed and accordingly take appropriate actions in the main job. 
&lt;BR /&gt;For this I am thinking of creating a context variable called job_status_code that is initially set to 0 at the start of the subjob execution. 
&lt;BR /&gt;This variable will be set to another numeric value in case the job fails after the execution of the tLogCatcher component. 
&lt;BR /&gt;I created a test job to check if this logic works, unfortunately it does not. 
&lt;BR /&gt;Here is the screenshot of the main job: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDV4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133504i61B4DBFF2B762C18/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDV4.png" alt="0683p000009MDV4.png" /&gt;&lt;/span&gt;And this is the subjob 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDQO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140002i2730087AE98F029F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDQO.png" alt="0683p000009MDQO.png" /&gt;&lt;/span&gt;When I execute the main job, I see that the context variable job_status_code is updated through the tLogCatcher component. 
&lt;BR /&gt;But when I check for the value of the context variable in the main job I see it as null. 
&lt;BR /&gt;Can anyone tell me why this is happening? And what I can do to pass the job status value to the main job when an error occurs?</description>
    <pubDate>Fri, 03 Mar 2017 10:16:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-03T10:16:27Z</dc:date>
    <item>
      <title>capture status code from subjob in main job</title>
      <link>https://community.qlik.com/t5/Talend-Studio/capture-status-code-from-subjob-in-main-job/m-p/2269918#M47985</link>
      <description>Hi, 
&lt;BR /&gt;I am developing a job which calls numerous subjobs. 
&lt;BR /&gt;I have added the tLogCatcher component in each of the subjob and main job. 
&lt;BR /&gt;The basic purpose behind adding the component in all jobs is to catch any error/exception at its origin and propagate it through the hierarchy correctly. 
&lt;BR /&gt;Now the catch is that every time an exception occurs, the main job should not terminate. 
&lt;BR /&gt;The main job should terminate only in case the exception in the subjob is of severe category such as database not available or network connectivity lost. 
&lt;BR /&gt;If there are other exceptions such as error while reading a file or writing to a file, the subjob performing the said action should fail but the main job should continue with the execution. 
&lt;BR /&gt;For this I disabled the "Die on child error" checkbox in the tRunJob component that invokes the subjob. 
&lt;BR /&gt;But now I want to check why the subjob failed and accordingly take appropriate actions in the main job. 
&lt;BR /&gt;For this I am thinking of creating a context variable called job_status_code that is initially set to 0 at the start of the subjob execution. 
&lt;BR /&gt;This variable will be set to another numeric value in case the job fails after the execution of the tLogCatcher component. 
&lt;BR /&gt;I created a test job to check if this logic works, unfortunately it does not. 
&lt;BR /&gt;Here is the screenshot of the main job: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDV4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133504i61B4DBFF2B762C18/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDV4.png" alt="0683p000009MDV4.png" /&gt;&lt;/span&gt;And this is the subjob 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDQO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140002i2730087AE98F029F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDQO.png" alt="0683p000009MDQO.png" /&gt;&lt;/span&gt;When I execute the main job, I see that the context variable job_status_code is updated through the tLogCatcher component. 
&lt;BR /&gt;But when I check for the value of the context variable in the main job I see it as null. 
&lt;BR /&gt;Can anyone tell me why this is happening? And what I can do to pass the job status value to the main job when an error occurs?</description>
      <pubDate>Fri, 03 Mar 2017 10:16:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/capture-status-code-from-subjob-in-main-job/m-p/2269918#M47985</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-03T10:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: capture status code from subjob in main job</title>
      <link>https://community.qlik.com/t5/Talend-Studio/capture-status-code-from-subjob-in-main-job/m-p/2269919#M47986</link>
      <description>Hi &amp;nbsp;
&lt;BR /&gt;You are able to pass the status code of child job to main job. Make sure you have defined the same schema on tRunJob as tBufferOutput component.
&lt;BR /&gt;Regards
&lt;BR /&gt;Shong</description>
      <pubDate>Fri, 10 Mar 2017 09:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/capture-status-code-from-subjob-in-main-job/m-p/2269919#M47986</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-10T09:45:42Z</dc:date>
    </item>
  </channel>
</rss>

