<?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>Question Re: xp_write_file return values in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaa-p/13846032#M4876875</link>
    <description>&lt;P&gt;The only non-zero values that are returned from the xp_write_file() function are the values -1 and +1.  The value "1" indicates that the write failed. (Sorry, no additional information at this time is available).&lt;/P&gt;
&lt;P&gt;Just in case the return value ever changes in the future I would suggest that you write your code as:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;declare&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;xp_write_file&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt; &lt;SPAN class="o"&gt;...&lt;/SPAN&gt; &lt;SPAN class="p"&gt;);&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;if&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="o"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;0&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt;
    &lt;SPAN class="o"&gt;--&lt;/SPAN&gt; &lt;SPAN class="n"&gt;handle&lt;/SPAN&gt; &lt;SPAN class="n"&gt;error&lt;/SPAN&gt; &lt;SPAN class="n"&gt;condition&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;else&lt;/SPAN&gt;
    &lt;SPAN class="o"&gt;--&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;write&lt;/SPAN&gt; &lt;SPAN class="n"&gt;succeeded&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;end&lt;/SPAN&gt; &lt;SPAN class="k"&gt;if&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 09 Aug 2011 08:51:05 GMT</pubDate>
    <dc:creator>MarkCulp</dc:creator>
    <dc:date>2011-08-09T08:51:05Z</dc:date>
    <item>
      <title>xp_write_file return values</title>
      <link>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaq-p/13846031</link>
      <description>&lt;P&gt;Hello again,
Can anybody tell me what the return values of system function xp_write_file() are (in SA12)? Documentation only says that "It returns 0 if successful, and non-zero if it fails." So what are those non-zero values and their meanings?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2011 01:25:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaq-p/13846031</guid>
      <dc:creator>former_SQLA_member1694875</dc:creator>
      <dc:date>2011-08-09T01:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: xp_write_file return values</title>
      <link>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaa-p/13846032#M4876875</link>
      <description>&lt;P&gt;The only non-zero values that are returned from the xp_write_file() function are the values -1 and +1.  The value "1" indicates that the write failed. (Sorry, no additional information at this time is available).&lt;/P&gt;
&lt;P&gt;Just in case the return value ever changes in the future I would suggest that you write your code as:&lt;/P&gt;
&lt;DIV class="codehilite"&gt;&lt;PRE&gt;&lt;SPAN class="n"&gt;declare&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;int&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;set&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="o"&gt;=&lt;/SPAN&gt; &lt;SPAN class="n"&gt;xp_write_file&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt; &lt;SPAN class="o"&gt;...&lt;/SPAN&gt; &lt;SPAN class="p"&gt;);&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;if&lt;/SPAN&gt; &lt;SPAN class="nv"&gt;@rv&lt;/SPAN&gt; &lt;SPAN class="o"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="mi"&gt;0&lt;/SPAN&gt; &lt;SPAN class="k"&gt;then&lt;/SPAN&gt;
    &lt;SPAN class="o"&gt;--&lt;/SPAN&gt; &lt;SPAN class="n"&gt;handle&lt;/SPAN&gt; &lt;SPAN class="n"&gt;error&lt;/SPAN&gt; &lt;SPAN class="n"&gt;condition&lt;/SPAN&gt;
&lt;SPAN class="k"&gt;else&lt;/SPAN&gt;
    &lt;SPAN class="o"&gt;--&lt;/SPAN&gt; &lt;SPAN class="nb"&gt;write&lt;/SPAN&gt; &lt;SPAN class="n"&gt;succeeded&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="n"&gt;end&lt;/SPAN&gt; &lt;SPAN class="k"&gt;if&lt;/SPAN&gt;&lt;SPAN class="p"&gt;;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Aug 2011 08:51:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaa-p/13846032#M4876875</guid>
      <dc:creator>MarkCulp</dc:creator>
      <dc:date>2011-08-09T08:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: xp_write_file return values</title>
      <link>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaa-p/13846033#M4876876</link>
      <description>&lt;P&gt;I don't believe the lack of documentation is intentional. Here's a short summary:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;if you do not have permission to execute xp_write_file(), the procedure returns -1 and an SQL error is generated (SQLCODE -121).&lt;/LI&gt;
&lt;LI&gt;If there is a problem opening the file (an error was returned from the OS OPEN() call) then the procedure returns +1.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 09 Aug 2011 09:07:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/xp-write-file-return-values/qaa-p/13846033#M4876876</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-09T09:07:21Z</dc:date>
    </item>
  </channel>
</rss>

