<?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: Exist function not detecting the dataset in SAS Batch run in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336549#M76303</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118943"&gt;@bmsampath&lt;/a&gt; wrote:&lt;BR /&gt;If I check the dataset in first program, exist returns TRUE. But in second program, exist function returns FALSE. This happens only in batch mode. that too during the first run of the job in all dev, si and prod environment. THIS IS PERMANENT DATASET STORED IN A LIBRARY. Still if you want some more details , I am ready to give .&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are not consistent. From your post:&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;In the first program, I am creating a dataset(DOC_TAB) in SASTAB library.(SASTAB.DOC_TAB).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the second program, when I am checking whether dataset is exist or not using EXIST fn( tried both&amp;nbsp;EXIST or OPEN function), it always returns FALSE during very first run of the job.&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you were NOT checking for the dataset in your first program, you were CREATING it. Since both programs run in parallel, the second program can't detect the dataset until the script has run at least once.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2017 13:33:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-02-28T13:33:03Z</dc:date>
    <item>
      <title>Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336534#M76293</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following shell script to run the job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cd ${PROJ_ENV}/data/batchout&lt;/P&gt;&lt;P&gt;. ${PROJ_ENV}/data/batchout/exec_sas_di.sh STP_Report_TEST1 &amp;amp;&lt;/P&gt;&lt;P&gt;. ${PROJ_ENV}/data/batchout/exec_sas_di.sh STP_Report_TEST2 &amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first program, I am creating a dataset(DOC_TAB) in SASTAB library.(SASTAB.DOC_TAB).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second program, when I am checking whether dataset is exist or not using EXIST fn( tried both&amp;nbsp;EXIST or OPEN function), it always returns FALSE during very first run of the job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the second run onwards, this checking of dataset returns TRUE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know why the second program is not detecting the dataset(Permanent dataset)&amp;nbsp;created in first program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Sampath&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336534#M76293</guid>
      <dc:creator>bmsampath</dc:creator>
      <dc:date>2017-02-28T13:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336539#M76296</link>
      <description>&lt;P&gt;You need to post some code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To debug try accessing data in first program and see the error message. It may give you more clues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336539#M76296</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-28T13:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336542#M76297</link>
      <description>&lt;P&gt;Very simple. By using the ampersand at the end of a command, you let that run in the background, and control is immediately handed back to the script, which starts the second command; so both SAS programs run concurrently, and the second program starts before the first program had a chance to write the dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336542#M76297</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-28T13:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336543#M76298</link>
      <description>If I check the dataset in first program, exist returns TRUE. But in second program, exist function returns FALSE. This happens only in batch mode. that too during the first run of the job in all dev, si and prod environment. THIS IS PERMANENT DATASET STORED IN A LIBRARY. Still if you want some more details , I am ready to give .</description>
      <pubDate>Tue, 28 Feb 2017 13:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336543#M76298</guid>
      <dc:creator>bmsampath</dc:creator>
      <dc:date>2017-02-28T13:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336548#M76302</link>
      <description>&lt;P&gt;I dont have much knowledge in UNIX. I accept whatever you are saying is correct. Could you please tell me how to run the code one by one to avoid this issue&amp;nbsp;..First TEST1 then TEST2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you give some details abt how to change the unix shell script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,Sampath&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336548#M76302</guid>
      <dc:creator>bmsampath</dc:creator>
      <dc:date>2017-02-28T13:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336549#M76303</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118943"&gt;@bmsampath&lt;/a&gt; wrote:&lt;BR /&gt;If I check the dataset in first program, exist returns TRUE. But in second program, exist function returns FALSE. This happens only in batch mode. that too during the first run of the job in all dev, si and prod environment. THIS IS PERMANENT DATASET STORED IN A LIBRARY. Still if you want some more details , I am ready to give .&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are not consistent. From your post:&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;In the first program, I am creating a dataset(DOC_TAB) in SASTAB library.(SASTAB.DOC_TAB).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the second program, when I am checking whether dataset is exist or not using EXIST fn( tried both&amp;nbsp;EXIST or OPEN function), it always returns FALSE during very first run of the job.&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you were NOT checking for the dataset in your first program, you were CREATING it. Since both programs run in parallel, the second program can't detect the dataset until the script has run at least once.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336549#M76303</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-28T13:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336551#M76304</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/118943"&gt;@bmsampath&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I dont have much knowledge in UNIX. I accept whatever you are saying is correct. Could you please tell me how to run the code one by one to avoid this issue&amp;nbsp;..First TEST1 then TEST2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you give some details abt how to change the unix shell script?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,Sampath&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just remove the ampersands. Then the script has to wait for the first program to finish before it can start the second.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336551#M76304</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-28T13:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336552#M76305</link>
      <description>&lt;P&gt;I tried to check the dataset in first program just for debugging purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually I am doing the checking in the second program only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First program creates dataset. Second program is checking the dataset and doing something if it is true.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336552#M76305</guid>
      <dc:creator>bmsampath</dc:creator>
      <dc:date>2017-02-28T13:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Exist function not detecting the dataset in SAS Batch run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336557#M76306</link>
      <description>&lt;P&gt;Big Thanks. Now it is working after removing amphersand. Thanks,Sampath&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 13:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exist-function-not-detecting-the-dataset-in-SAS-Batch-run/m-p/336557#M76306</guid>
      <dc:creator>bmsampath</dc:creator>
      <dc:date>2017-02-28T13:44:51Z</dc:date>
    </item>
  </channel>
</rss>

