<?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 Asynchronous submit with events via COM interface in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/815401#M321853</link>
    <description>&lt;P&gt;I am asynchronously submitting SAS code via the COM interface. Since it seems to be documented best, let's use Visual Basic to achieve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/itechcdc/9.4/itechwcdg/n158sst2yqr0wan10ntu5qs3dxgl.htm" target="_self"&gt;Programming with Visual Basic&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This documentation is somewhat rudimentary. So if you know a more detailed resource, I'd appreciate it very much to be told about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, here is my attempt to asynchronously submit SAS code from Visual Basic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Option Explicit On

Imports SAS
Imports SASObjectManager

Module Program&lt;BR /&gt;
    Private WithEvents ls As LanguageService
    Private Sub ls_SubmitComplete(ByVal Sasrc As Long)
        System.Console.WriteLine("Completed." + Sasrc)
    End Sub

    Sub Main(args As String())
        Dim factory As New ObjectFactory()
        Dim server As New ServerDef()

        server.Protocol = 2
        server.MachineDNSName = "*** HOSTNAME ***"
        server.Port = 8591

        Dim workspace As Workspace = factory.CreateObjectByServer("Workspace", True, server, "** USER ***", "*** PASSWORD ***")

        ls = workspace.LanguageService
        ls.Async = True
        ls.Submit("%put Test;")

        System.Threading.Thread.Sleep(10000)
    End Sub&lt;BR /&gt;
End Module&lt;/PRE&gt;&lt;P&gt;Here, I tried to adapt the approach described in &lt;A href="https://documentation.sas.com/doc/en/itechcdc/9.4/itechwcdg/n158sst2yqr0wan10ntu5qs3dxgl.htm#n10kkkjhxmqkmcn14hst2gyqouaa" target="_self"&gt;Receiving events&lt;/A&gt; and the more detailed but outdated &lt;A href="https://support.sas.com/rnd/itech/doc/dist-obj/comdoc/ilngca.html" target="_self"&gt;LanguageService Object&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that, even though the submit completes successfully, &lt;EM&gt;ls_SubmitComplete&lt;/EM&gt; is never called, i.e. the message "Completed." won't appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone help me how to properly receive and handle such events?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2022 12:56:54 GMT</pubDate>
    <dc:creator>SAS-Fan</dc:creator>
    <dc:date>2022-05-27T12:56:54Z</dc:date>
    <item>
      <title>Asynchronous submit with events via COM interface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/815401#M321853</link>
      <description>&lt;P&gt;I am asynchronously submitting SAS code via the COM interface. Since it seems to be documented best, let's use Visual Basic to achieve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/itechcdc/9.4/itechwcdg/n158sst2yqr0wan10ntu5qs3dxgl.htm" target="_self"&gt;Programming with Visual Basic&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This documentation is somewhat rudimentary. So if you know a more detailed resource, I'd appreciate it very much to be told about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, here is my attempt to asynchronously submit SAS code from Visual Basic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Option Explicit On

Imports SAS
Imports SASObjectManager

Module Program&lt;BR /&gt;
    Private WithEvents ls As LanguageService
    Private Sub ls_SubmitComplete(ByVal Sasrc As Long)
        System.Console.WriteLine("Completed." + Sasrc)
    End Sub

    Sub Main(args As String())
        Dim factory As New ObjectFactory()
        Dim server As New ServerDef()

        server.Protocol = 2
        server.MachineDNSName = "*** HOSTNAME ***"
        server.Port = 8591

        Dim workspace As Workspace = factory.CreateObjectByServer("Workspace", True, server, "** USER ***", "*** PASSWORD ***")

        ls = workspace.LanguageService
        ls.Async = True
        ls.Submit("%put Test;")

        System.Threading.Thread.Sleep(10000)
    End Sub&lt;BR /&gt;
End Module&lt;/PRE&gt;&lt;P&gt;Here, I tried to adapt the approach described in &lt;A href="https://documentation.sas.com/doc/en/itechcdc/9.4/itechwcdg/n158sst2yqr0wan10ntu5qs3dxgl.htm#n10kkkjhxmqkmcn14hst2gyqouaa" target="_self"&gt;Receiving events&lt;/A&gt; and the more detailed but outdated &lt;A href="https://support.sas.com/rnd/itech/doc/dist-obj/comdoc/ilngca.html" target="_self"&gt;LanguageService Object&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that, even though the submit completes successfully, &lt;EM&gt;ls_SubmitComplete&lt;/EM&gt; is never called, i.e. the message "Completed." won't appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone help me how to properly receive and handle such events?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 12:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/815401#M321853</guid>
      <dc:creator>SAS-Fan</dc:creator>
      <dc:date>2022-05-27T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous submit with events via COM interface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/816754#M322409</link>
      <description>Try reposting under Programming -&amp;gt; Developers</description>
      <pubDate>Mon, 06 Jun 2022 20:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/816754#M322409</guid>
      <dc:creator>JOL</dc:creator>
      <dc:date>2022-06-06T20:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous submit with events via COM interface</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/816767#M322414</link>
      <description>&lt;P&gt;I think it would be safe to assume that you are using a little-used way to interface with SAS given the lack of response on the Community. You could try a Tech Support track or if you explained your business need in more detail perhaps there is a better-supported approach.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 21:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Asynchronous-submit-with-events-via-COM-interface/m-p/816767#M322414</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-06-06T21:08:40Z</dc:date>
    </item>
  </channel>
</rss>

