Date: Fri, 16 Oct 1998 08:15:44 +1000
Reply-To: David Johnson <david_johnson@TAC.VIC.GOV.AU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: David Johnson <david_johnson@TAC.VIC.GOV.AU>
Subject: Re: Is there a connect session? - Solutions
Content-Type: text/plain; charset="us-ascii"
Many thanks to Steffen Schwember, Cristoph Edel and Peter Crawford who all offered suggestions and encouragement.
Unfortunately, %SYSFUNC does not resolve RLINK. In any case, I have gone through a connection/reconnection process frequently in the last few days as I have exhausted memory and crashed Connect sessions. I note that although the log will tell you if the session ends, or times out with an abend, then reissuing the CONNECT macro again earns you an error message as SAS tells you there is a session and then decides there isn't. Issuing a logoff first also suggests SAS is not terribly sure whether the session is available. So, there is every likelihood that RLINK would not have been reliable.
Another solution came from Ray Pass who referred material received from the SAS Institute. I'll copy the text in full since his explanation was very clear and helpful to me. I have tried it on sessions that have timed out and sessions that have been abended. In all cases so far it has been reliable.
Thanks again Ray, Steffen, Cristoph and Peter.
David
The contents of this document represent the views of the author and are not necessarily representative of the views, policy or decisions of the TAC.
David Johnson
SAS Site Consultant
Research Branch
TAC
GPO Box 2751Y
Melbourne Victoria Australia 3001
+613 9664 6492
+613 9664 6464 (fax)
-----Original Message-----
From: Ray Pass [SMTP:raypass@WORLDNET.ATT.NET]
Sent: Thursday, October 15, 1998 2:21 AM
To: SAS-L@AKH-WIEN.AC.AT
Subject: Re: Is there a connect session?
In article <01BDF5C5.A1A8D240@T00110176.TACNET>, David Johnson
<david_johnson@TAC.VIC.GOV.AU> writes:
>Any suggestions on testing for the connection existing? Yes I know
>about
>
> rc= RLINK('HOST');
> if rc then _msg_= 'A link exists.';
> else _msg_= 'No link exists.';
>
>as documented in SAS Connect Usage and reference version 2, pp 202-203
>but this is an SCL function and I need it in base SAS.
Try this code that was given to me by SI a year or so ago. Works for me.
%global signonrc;
*-----------------------------------------------------------;
* macro to check if a signon link exists to a remote server ;
*-----------------------------------------------------------;
%macro checkit1;
%let signonrc=0;
%let rsub=%nrstr(rsubmit;
%sysrput signonrc=1;
endrsubmit;);
&rsub;
%mend checkit1;
*----------------------------------------------------------;
The macro works by creating a local macro variable called 'signonrc' with
an initial value of '0'. Another local macro variable called 'rsub' is
also created which contains a few SAS statements. These statements are
then run via the '&rsub' statement. The statements attempt to send an
instruction to the remote site via 'rsubmit'. If a connection does exist,
then the '%sysrput' macro is run remotely. This macro copies the value of
a remote macro variable to a local macro variable (check it out in the new
SAS Macro manual - the lavender one - there is also a corresponding
%syslput macro to go the other way.) Instead of naming the remote macro
variable to be copied (the syntax is
local-macro-variable=remote-macro-variable) a value '1' is assigned to the
local macro variable. If a connection does exist to the remote machine,
the value of local 'signonrc' is changed to 1; if not, it remains as 0;
The value of local 'signonrc' can then be checked. If it is '1', a
connection does exist; if it is '0' a connection does not exist.
Hope this helps.
RAy
*------------------------------------------------*
| Ray Pass voice: (914) 693-5553 |
| Ray Pass Consulting fax: on request |
| 5 Sinclair Place |
| Hartsdale, NY 10530 e-mail: raypass@att.net |
*------------------------------------------------*