<?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 Stored processes and sessions / stpsrv_session -function in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/247998#M4818</link>
    <description>&lt;P&gt;Hi, I'm using SAS 9.4 M2 and I have the following problem. I'm running the below code and I cannot get the stpsrv_session -function to return (set) the variable values for _THISSESSION and _SESSIONID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*stpsrv_session;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; file _webout;* html output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if libref('SAVE') ne 0 then rc = stpsrv_session('create');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %put THISSESSION = &amp;amp;_THISSESSION;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %put SESSIONID = &amp;amp;_SESSIONID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--&amp;gt; The variable values are not set and I get:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference _SESSIONID not resolved. _SESSIONID = "&amp;amp;_SESSIONID."&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference _THISSESSION not resolved. _THISSESSION = "&amp;amp;_THISSESSION."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running the above code as a stored process with the code below. And I am not getting any error messages (except for the mentioned warnings).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc stp program='/example_directory/stpsrv_session';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; outputfile _webout = '/example_directory/webout.html';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2016 15:22:30 GMT</pubDate>
    <dc:creator>PaulC</dc:creator>
    <dc:date>2016-02-04T15:22:30Z</dc:date>
    <item>
      <title>Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/247998#M4818</link>
      <description>&lt;P&gt;Hi, I'm using SAS 9.4 M2 and I have the following problem. I'm running the below code and I cannot get the stpsrv_session -function to return (set) the variable values for _THISSESSION and _SESSIONID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*stpsrv_session;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; file _webout;* html output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if libref('SAVE') ne 0 then rc = stpsrv_session('create');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %put THISSESSION = &amp;amp;_THISSESSION;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %put SESSIONID = &amp;amp;_SESSIONID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--&amp;gt; The variable values are not set and I get:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference _SESSIONID not resolved. _SESSIONID = "&amp;amp;_SESSIONID."&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference _THISSESSION not resolved. _THISSESSION = "&amp;amp;_THISSESSION."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running the above code as a stored process with the code below. And I am not getting any error messages (except for the mentioned warnings).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc stp program='/example_directory/stpsrv_session';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; outputfile _webout = '/example_directory/webout.html';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 15:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/247998#M4818</guid>
      <dc:creator>PaulC</dc:creator>
      <dc:date>2016-02-04T15:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/248024#M4819</link>
      <description>By the way: Can you use this kind of implementation (using sessions, sessionid, stpsrv_sessions -function, etc.) on a workspace server, or does it work only on the stored process server?</description>
      <pubDate>Thu, 04 Feb 2016 16:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/248024#M4819</guid>
      <dc:creator>PaulC</dc:creator>
      <dc:date>2016-02-04T16:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/248416#M4820</link>
      <description>&lt;P&gt;My first thought is try moving your %PUT statements after the RUN; statement that ends your DATA step.&amp;nbsp; As written, the %PUT statement is executed before the data step code to create the session is executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also create a session with just the macro language, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let rc=%sysfunc(stpsrv_session(create));

%put &amp;amp;_ThisSession;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, looks like stored process sessions are only available on the stored process server, not the workspace server.&amp;nbsp; See e.g. : &lt;A href="http://support.sas.com/documentation/cdl/en/stpug/68399/HTML/default/viewer.htm#p1lxbssuprk9vln17qbwtpiz1uwa.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/stpug/68399/HTML/default/viewer.htm#p1lxbssuprk9vln17qbwtpiz1uwa.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 22:20:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/248416#M4820</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-02-05T22:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/364491#M4821</link>
      <description>&lt;P&gt;Good morining,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have the same problem. How can i know if&lt;/SPAN&gt;&amp;nbsp; STP running in stored process server, not the workspace server?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I start my stp whith IHM(URL).&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 08:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/364491#M4821</guid>
      <dc:creator>mansour_ibrahim</dc:creator>
      <dc:date>2017-06-06T08:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/373943#M4822</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Quentin is correct about the placement of the %PUT statements:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
if (libref('SAVE') ne 0) 
  then rc = stpsrv_session('create');
run;

%put &amp;amp;=_THISSESSION;
%put &amp;amp;=_SESSIONID;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;His code should work, too.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;He's also correct about sessions not being supported by the SAS Workspace Server. &amp;nbsp;These messages are written to the SAS log when you run the test code on a workspace server:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ERROR: STP No session scope available.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;NOTE: STP sessions cannot be used with Workspace servers.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Check the value of the&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;SYSPROCESSMODE&lt;/FONT&gt; &lt;/STRONG&gt;macro variable to determine the type of server. &amp;nbsp;The variable has a value of either&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Stored Process Server&lt;/FONT&gt;&lt;/STRONG&gt; or&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;SAS Workspace Server&lt;/FONT&gt;&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 12:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/373943#M4822</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2017-07-07T12:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/376384#M4823</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13635"&gt;@Vince_SAS&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry to hijack this thread but I think this question is relevant enough&amp;nbsp;for the OP. It's also one I've been arguing about with a colleague for a couple of weeks now, but haven't got round to testing yet. The &lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/sessions.html" target="_self"&gt;documentation on this subject&lt;/A&gt;&amp;nbsp;states the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;A session exists in the server process where it was created. All stored processes that access that session must execute in the same server process. &lt;STRONG&gt;Load balancing and other execution dispatching features are typically ignored when using sessions that might have an impact on application performance and scalability.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this mean that when a session is created when a particular client executes a session-using STP, the normal load balancing for subsequent requests is ignored and some kind of session affinity for that multibridge process takes precedence over the LB for connections from that client? Or does the client continue to get redirected to available multibridge processes by the spawner as usual depending on the configured load balancing algorithm, and the session will&amp;nbsp;only be reused&amp;nbsp;if the request lands on the same multibridge process where the session was initially saved?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that makes sense. Maybe it's just me but the way that paragraph is worded could suggest either of those...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Nik&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2017 22:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/376384#M4823</guid>
      <dc:creator>boemskats</dc:creator>
      <dc:date>2017-07-16T22:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/376516#M4824</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Nik-&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Your first interpretation is correct.&amp;nbsp; Because requests must return to the same server to read the stored session data, the request is sent to that server, even if it's busy, and other servers are available.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 12:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/376516#M4824</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2017-07-17T12:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/377247#M4825</link>
      <description>&lt;P&gt;That's great Vince! Never been happier to lose an argument with someone &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;
&lt;P&gt;Nik&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 11:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/377247#M4825</guid>
      <dc:creator>boemskats</dc:creator>
      <dc:date>2017-07-19T11:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/377255#M4826</link>
      <description>**bleep**, should have placed that bet!!</description>
      <pubDate>Wed, 19 Jul 2017 11:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/377255#M4826</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2017-07-19T11:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Stored processes and sessions / stpsrv_session -function</title>
      <link>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/450170#M4827</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/121073"&gt;@mansour_ibrahim&lt;/a&gt;&amp;nbsp;- you can use the `SYSPROCESSMODE` macro variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More info here:&amp;nbsp; &lt;A href="https://stackoverflow.com/questions/48464813/determining-server-context-workspace-server-vs-stored-process-server" target="_blank"&gt;https://stackoverflow.com/questions/48464813/determining-server-context-workspace-server-vs-stored-process-server&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Mar 2018 18:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Stored-processes-and-sessions-stpsrv-session-function/m-p/450170#M4827</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2018-03-31T18:06:34Z</dc:date>
    </item>
  </channel>
</rss>

