<?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: How To Add Root XML Tags To Large File in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647875#M193930</link>
    <description>#1 - I answered my own question via the code; the output filename is already specified.&lt;BR /&gt;#2 - still TBD</description>
    <pubDate>Thu, 14 May 2020 17:06:33 GMT</pubDate>
    <dc:creator>shl007</dc:creator>
    <dc:date>2020-05-14T17:06:33Z</dc:date>
    <item>
      <title>How To Add Root XML Tags To Large File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647826#M193915</link>
      <description>&lt;P&gt;Hi - I have some starter code below I'm trying to apply to add &amp;lt;root&amp;gt; and end &amp;lt;/root&amp;gt; tags to a large XML file. Two questions:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;is there a way to specify a DIFFERENT output file name?&lt;/P&gt;&lt;P&gt;2) Any ideas on how to get around a workspace “disconnected” error? Is there an alternate approach I can use to put&amp;nbsp; &amp;lt;root&amp;gt; and &amp;lt;/root&amp;gt; tags in the file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data _null_;
     infile 'c:\output\temp.xml' end=eof;
    input;
      file "c:\output\temp1.xml";
         if _n_=1 then do;
        put "&amp;lt;root&amp;gt;";
        end;
            put _infile_;
         if eof then do;
       put "&amp;lt;/root&amp;gt;";
   end;   
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 May 2020 14:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647826#M193915</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-05-14T14:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: How To Add Root XML Tags To Large File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647875#M193930</link>
      <description>#1 - I answered my own question via the code; the output filename is already specified.&lt;BR /&gt;#2 - still TBD</description>
      <pubDate>Thu, 14 May 2020 17:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647875#M193930</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-05-14T17:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: How To Add Root XML Tags To Large File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647918#M193941</link>
      <description>&lt;P&gt;Anything involving "disconnected" is likely not related directly to your code.&lt;/P&gt;
&lt;P&gt;Since the code provided works on a small file there is nothing wrong there. However you may need to consider LRECL for your actual file if it has real long "lines" (&amp;gt; 32767 ). This may happen if your xml has freeform text fields that contain extensive text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach might be to create two very small text files one with the "&amp;lt;root&amp;gt;" and the other&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&amp;lt;/root&amp;gt;". Then use a system tool to concatenate the 3 files.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to assume with your comment about "disconnected" that you are attempting to modify a file on a remote file system somewhere. It may be that you need to copy the file to a local location, run your code creating a local updated version and then upload the modified version back to the problematic location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that approach is not feasible then you have to diagnose conditions causing the disconnect which may be well out of the scope of many of us on this forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 20:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647918#M193941</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-14T20:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: How To Add Root XML Tags To Large File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647922#M193943</link>
      <description>&lt;P&gt;I'm thinking some of the issue is the unstructured nature of my XML file, as far as using a data step to insert &amp;lt;root&amp;gt; and &amp;lt;/root&amp;gt;. Instead of a system tool, I'm hopeful I can just import the separate files into separate datasets and concatenate them thru data step to get the &amp;lt;root&amp;gt; and &amp;lt;/root&amp;gt; inserted at beginning and end of the file, respectively. Let me know if you can think of any pitfalls with this approach other than its lack of elegance ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The wrinkle here is, I've modified the code to use a PIPE command. So I may be importing multiple files at once. This may be tricky (i.e., the &amp;lt;root&amp;gt; and &amp;lt;/root&amp;gt; would need to be inserted for EACH file).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 21:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647922#M193943</guid>
      <dc:creator>shl007</dc:creator>
      <dc:date>2020-05-14T21:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: How To Add Root XML Tags To Large File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647937#M193952</link>
      <description>&lt;P&gt;Have you been to successfully just read in ONE of these files?&lt;/P&gt;
&lt;P&gt;You say the issue is disconnecting. If you get disconnected from your data source I don't see how using an approach to read multiple of these files is going to make anything better?&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 22:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647937#M193952</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-14T22:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: How To Add Root XML Tags To Large File  c:\output\temp.xml</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647939#M193954</link>
      <description>&lt;P&gt;To go around the timeout issue, you could run an OS command. Save the two extra lines and run:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;copy header.txt+c:\output\temp.xml+footer.txt&amp;nbsp; c:\output\temp1.xml&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 23:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Add-Root-XML-Tags-To-Large-File/m-p/647939#M193954</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-14T23:26:04Z</dc:date>
    </item>
  </channel>
</rss>

