BookmarkSubscribeRSS Feed
MC1985
Obsidian | Level 7

Hi All,

 

i need to create a sas script that use SAS CONNECT to my sas server (widows), i understand that using RLINK is the solution.

I have a problem in costumization of TCPwin.scr.

 

NEED: launch a parameters bat before SAS with environement variable that i'll use in future for libaname definition

 

MY SOLUTION:

i created a *.bat that call a parms.bat and after that sas

 

trace on
echo on

cd E:

call E:\Dati\CDB\sourceroot\parms\parms_connect

cd %PROJDR%

set thisscr=interact

echo %bindr%\connect.bat %thisscr%

rem CHIAMO BAT per utilizzo SAS CONNECT;
call %bindr%\connect.bat %thisscr%

connect .bat

trace on;
echo on;

set c=0

set thispgm=%thsspgm:.sas=%

:iniziolup
if "%2"=="" goto end

 set/a c = %c% +1
 set %SUFFPAR%%c%=%2

shift
goto iniziolup

:end

set %SUFFPAR%0=%c%

echo %stato% > %LGDR%\%thisscr%.active

cd D: 

%SASEXEC% -autoexec %PARMDR%\autoexec.sas -dmr -comamid tcp -noterminal -device grlink -nosyntaxcheck

but i have an ERROR:

 

33   signon dwhost;
NOTE: Remote signon to DWHOST commencing (SAS Release 9.04.01M3P062415).
NOTE: Start of script file trace.
TRACE:    Echo on;
TRACE:    Log 'NOTE: Script file 'tcpwin.scr' entered.';
NOTE: Script file 'tcpwin.scr' entered.
TRACE:    If not TCP then goto notcp;
TRACE:    If signoff then goto signoff;
TRACE:    Waitfor    'Username:',
TRACE:               'Hello>': ready,
TRACE:               120.0 seconds: noprompt;
Username:
TRACE:    Type 'sasadm' lf;
TRACE:    Waitfor    'Password:',
TRACE:               120.0 seconds: nolog;
Password:
TRACE:    Type '{SAS002}1D3211221C1104E218FEC4002945FBA308AB65D4' lf;
TRACE:    Waitfor    'Hello>',
TRACE:               'access denied': nouser,
TRACE:               120.0 seconds: timeout;
Hello>
TRACE: ready:
TRACE:    Log 'NOTE: Logged onto Windows... Starting remote SAS now.';
NOTE: Logged onto Windows... Starting remote SAS now.
TRACE:    Type 'C:\Dati\CDB\sourceroot\coninteract.bat' lf;
TRACE:    Waitfor    'SESSION ESTABLISHED',
TRACE:               120.0 seconds: nosas;
ERROR:  Unable to start SAS session (error: 0x80bfd009).
Goodbye
ERROR: Script file interpretation terminated due to error.
NOTE: End of script file trace.
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: Read error.
ERROR: Remote signon to DWHOST canceled.

from my sas base i havn't problem, if i call a simple workspace session using tcpwin.scr i havn't problem.. but i want to call sas with a *.bat that launch a parameters file before SAS i had the ERROR

 

anyone can help me

 

thanks

MC

 

Martino Crippa
17 REPLIES 17
LinusH
Tourmaline | Level 20

Why do you need to be scripted signon? Usually a connection using a connect spawner is more secure and "modern". If your SAS server uses metadata, you should definitely consider spawned connections.

The I don't understand the topology of your SAS environment.

You have a local Base SAS installation, and a Windows Server. The workspace server, is that executing on the Windows server?

And to what server are you trying to signon?

Data never sleeps
MC1985
Obsidian | Level 7

My customer have a SAS 9.3 Platform. The Employers have SAS Guide 5.1 and Consultants SAS Base 9.3 client.

The IT Department have stricted policy and the only solution to my need is using SAS/CONNECT with TCPwin.scr to customize sas call for workspace session.

 

The Environment by default and for costruction have some scripts that set environment variable with for example the root of the project. The ETL fluxes are made with sas base scripts and use the environment variable in libname statement.

 

Now we want to develop with SAS Base Client from lapton in signon, so we need to call the parameters file before the launche of workspace session.

 

TCPWIN.src answer to my need because i can call a parameters before launch SAS.

 

trace on;
echo  on;
/*-------------------------------------------------------------------*/
/*--            Copyright (C) 1993 by SAS Institute Inc., Cary NC  --*/
/*--                                                               --*/
/*-- name:      tcpwin.scr                                         --*/
/*--                                                               --*/
/*-- purpose:   SAS/CONNECT SIGNON/SIGNOFF script for connecting   --*/
/*--            to a Windows (either 95 or NT) host via the TCP    --*/
/*--            access method.                                     --*/
/*--                                                               --*/
/*-- notes:   1. You must have the spawner program executing on    --*/
/*--             the remote 95 or NT workstation in order for the  --*/
/*--             local session to be able to establish the         --*/
/*--             connection.  If the spawner is not running on the --*/
/*--             remote node, you will receive a message telling   --*/
/*--             you the connection has been refused.              --*/
/*--                                                               --*/
/*--          2. You must have specified OPTIONS COMAMID=TCP       --*/
/*--             in the local SAS session before using the signon  --*/
/*--             command.                                          --*/
/*--                                                               --*/
/*-- assumes: 1. The command to execute SAS in your remote (W95 or --*/
/*--             WNT) environment is "sas". If this is incorrect   --*/
/*--             for your site, change the contents of the line    --*/
/*--             that contains:                                    --*/
/*--             type 'sas ...                                     --*/
/*--                                                               --*/
/*-- support:   SAS Institute staff                                --*/
/*--                                                               --*/
/*-------------------------------------------------------------------*/

   log "NOTE: Script file 'tcpwin.scr' entered.";

   if not tcp then goto notcp;
   if signoff then goto signoff;
		 
	%PUT *********************************************;
	%PUT CONNESSIONE A SAS UTENTE: &USERWNS24.        ;
	%PUT *********************************************;

   /* --------------- TCP SIGNON ------------------------------------*/

   waitfor 'Username:' 
         , 'Hello>'                :  ready
         ,  120 seconds            :  noprompt
         ;
   type "&USERWNS24" LF;
   waitfor 'Password:' , 120 seconds: nolog;
   type "&PSWWNS24" LF;
   waitfor 'Hello>'
         , 'access denied'         :  nouser
         , 120 seconds             :  timeout
         ;
	
ready:
   log 'NOTE: Logged onto Windows... Starting remote SAS now.';
   /* noterminal suppressses prompts from remote SAS session.    */
   /* nosyntaxcheck prevents remote side from going into syntax  */
   /* checking mode when a syntax error is encountered.          */
   /* The Win spawner supplies the following options by default: */
   /*   -DMR -COMAMID TCP $SASDMR MSGQUEUE -NOLOGO -NOTERMINAL  */
   type 'E:\Dati\CDB\sourceroot\bin_win32\connect_test.bat' LF;
   waitfor 'SESSION ESTABLISHED', 120 seconds : nosas;

   log 'NOTE: SAS/CONNECT conversation established.';
   stop;


/*---------------- TCP SIGNOFF --------------------------------------*/
signoff:
   log 'NOTE: SAS/CONNECT conversation terminated.';
   stop;



/*--------------- SUBROUTINES -----------------------------------*/


/*--------------- ERROR ROUTINES --------------------------------*/

notcp:
   log 'ERROR: Incorrect communications access method.';
   log 'NOTE: You must set "OPTIONS COMAMID=TCP;" before using this';
   log '      script file.';
   abort;

noprompt:
   log 'ERROR: Did not receive userid prompt.';
   log 'NOTE:  Ensure spawner process is running on remote node.';
   abort;

nolog:
   log 'ERROR: Did not receive password prompt.';
   abort;

nouser:
   log 'ERROR: Unrecognized userid or password.';
   abort;

nosas:
   log 'ERROR: Did not get SAS software startup messages.';
   abort;

timeout:
   log 'ERROR: Timeout waiting for remote session response.';
   abort;

and my bat is something like this:

call E:\dati\CDB\parms\parms

"D:\SAS9.3\Software\SASFoundation\9.3\sas.exe" -dmr -comamid tcp -device grlink -noterminal

the error now:

ERROR: Conversation termination; status=1.
ERROR: Remote signon to DWHOST canceled.

but i can find any information about that.

Martino Crippa
SASKiwi
PROC Star

I suggest you check out the SASCMD = option for the SIGNON statement. That allows you to run a batch file without using an RLINK script. Look at example 3 in this link:

 

http://support.sas.com/documentation/cdl/en/connref/67933/HTML/default/viewer.htm#p0brzkmxqg483hn163...

 

LinusH
Tourmaline | Level 20
Still confused of what you are trying to achieve.
You can't start a workspace server session from a Base SAS client, you will start a remote SAS/CONNECT server session.
Apart from terminology, can you establish a connection using the standard script without calling your bat file?
Is there any other messages in the log? The login step works?
Data never sleeps
MC1985
Obsidian | Level 7

the log:

26   options comamid=tcp remote=dwhost;
27   *SIGNON;
28   filename rlink "D:\\SAS9.3\Software\SASFoundation\9.3\connect\saslink\tcpwin_mc_test.scr";
29
30   signon dwhost;
NOTE: Remote signon to DWHOST commencing (SAS Release 9.03.01M2P081512).
*********************************************
CONNESSIONE A SAS UTENTE: sasadm
*********************************************
NOTE: Start of script file trace.
TRACE:    Echo on;
TRACE:    Log 'NOTE: Script file 'tcpwin.scr' entered.';
NOTE: Script file 'tcpwin.scr' entered.
TRACE:    If not TCP then goto notcp;
TRACE:    If signoff then goto signoff;
TRACE:    Waitfor    'Username:',
TRACE:               'Hello>': ready,
TRACE:               120.0 seconds: noprompt;
Username:
TRACE:    Type 'sasadm' lf;
TRACE:    Waitfor    'Password:',
TRACE:               120.0 seconds: nolog;
Password:
TRACE:    Type '{SAS002}1D3211221C1104E218FEC4002945FBA308AB65D4' lf;
TRACE:    Waitfor    'Hello>',
TRACE:               'access denied': nouser,
TRACE:               120.0 seconds: timeout;
Hello>
TRACE: ready:
TRACE:    Log 'NOTE: Logged onto Windows... Starting remote SAS now.';
NOTE: Logged onto Windows... Starting remote SAS now.
TRACE:    Type 'E:\Dati\CDB\sourceroot\connect.bat' lf;
TRACE:    Waitfor    'SESSION ESTABLISHED',
TRACE:               120.0 seconds: nosas;
SESSION ESTABLISHED
TRACE:    Log 'NOTE: SAS/CONNECT conversation established.';
NOTE: SAS/CONNECT conversation established.
TRACE:    Stop;
NOTE: End of script file trace.
ERROR: Conversation termination; status=1.
ERROR: Remote signon to DWHOST canceled.

here the sas script for signon with SAS/CONNNECT

*OPZIONI DI CONNESSIONE;
options comamid=tcp remote=dwhost;
*SIGNON;
filename rlink "D:\\SAS9.3\Software\SASFoundation\9.3\connect\saslink\tcpwin_mc_test.scr";

signon dwhost;

regards

MC

Martino Crippa
LinusH
Tourmaline | Level 20

So this is the log when you are still using the bat file, could you try without it, this is standard trouble shooting procedures.

Why do you need a seperate bat file, still, why can't you use the "type" command in the scr file for those things?

If this log doen't show more, try to open a telnet connection to the host, and then manually call your bat file and see what happens.

Also, check if there's any message in the Windows Event logs.

 

And about the requirement: "The IT Department have stricted policy" doesn't explain what those policies are. if you could put some effort in describing the full picture, we might could come up with a alternative (perhaps better) solution.

Data never sleeps
MC1985
Obsidian | Level 7

* yes if i didn't use the bat, i hadn't problem to open connection with for example <<type "sas -nosytaxcheck">>.

 

* i need a *.bat because people that made the environment for the project use a *.bat that set some environment variable, for example the root for libraries. I want to open this file with environment variable before sas connection to use the libraries and other comand.

 

* under windows os the *.src file it seems that i can't utilized more than one <<type>> comand (i made the same things calling *.sh in unix environment:

- enter in a folder

- execute a shell with environement variable

- execute sas

without problems)

 

* i tried before write on communities the tellnet and to execute from cmd the *.bat and it works.

 

* IT Department give only one admin or business user to consultants. Windows permits only 2 remote access for one usr but  sometimes we need more connection, and using the SAS CONNECT can be the solution. i thought about calling with xcommand and call system the *.bat with environment variables but i can't because xcommand was disabled and fot it policy i cant' use: "sas can't speak directly with OS".

 

<<Also, check if there's any message in the Windows Event logs>> in what windows log i can find some error message?

 

thanks

MC

Martino Crippa
LinusH
Tourmaline | Level 20
Your IT department tells you to use CONNECT, but where is the requirement to use a scripted signon?
Data never sleeps
MC1985
Obsidian | Level 7

i retry to explain the scenario:

  • I'm a consultant
  • My customer have a SAS 9.3 Platform on a virtual machine in windows environment. Users have SAS Enterprised Guide 5.1 to access to datas for analysis.
  • My team have "one admin user" for the windows remote machine, that permit only two parallel access. Customer IT Department don't give other users for restricted policies.
  • Usually we access to remote server to develop ETL process with SAS Base 9.3. During night there are many scheduled batch process(*.bat that call *.sas programs) that update the database for the business users for the day.
  • This bat at the beginning of execution prepare the environment. what's mean? to execute etl process we need to call a file with some environment variables that are used for example by the autoexec to call libraries.
  • Customer IT Departmente don't permits to lanch from SAS to OS command for example using XCOMMAND o CALL SYSTEM cause their restricted policy.
  • Team can use SAS EG to analyse data or sas base (and the other client to admin the platform) on server or sas base with SAS/CONNECT (sas connect works without problems).

the issue:

  • we need to work in parallel more than two people (the admin users permits only two parallel access)
  • develop an etl process with SAS Guide is no so confortable

Possible solution:

  • develop by SAS Base with remote connection by SAS/CONNECT from local laptop to remote server can be a solution. I utilised this solution in other customer under windows and unix environment.

NOTE: CUSTOMER IT DEPARTMENT give to me only the admin user with two parallel access to virtual machine.

 

PROBLEM to apply the "possible solution":

  • the signon from LOCAL CLIENT SAS BASE to REMOTE SERVER works
  • we want to utilized the option of RLINK that permits from sas script to give user and password and also launch some comand from sas to os .
  • if i didn't customize the script of RLINK (tcpwin.scr file) it works
  • if i change the script to pass by sas macrovars users and password it works
  • if i try to call some comand from sas to os: it doesn't work, utilised <<type>> comand (i utilised this option under unix and it works). the command that i want to submit is a *.bat on remote server that set enviroment variable like overwritten and explain before).
  • i verify and *.bat from cmd on remote server works
  • i verify that my laptop communique with remote server and also all the ports that are used by SAS/CONNECT

now it seems that

  • a remote connection was established
  • sas session was stablished

BUT AFTER THAT SAS SESSION fall down but i don't understand why and i don't understand what log i can examine to resolve the issue

 

ERROR is

TRACE:    Type 'E:\Dati\CDB\sourceroot\connect.bat' lf;
TRACE:    Waitfor    'SESSION ESTABLISHED',
TRACE:               120.0 seconds: nosas;
SESSION ESTABLISHED
TRACE:    Log 'NOTE: SAS/CONNECT conversation established.';
NOTE: SAS/CONNECT conversation established.
TRACE:    Stop;
NOTE: End of script file trace.
ERROR: Conversation termination; status=1.
ERROR: Remote signon to DWHOST canceled.

now dear linush i hope to be more clear

regards

MC

Martino Crippa
Kurt_Bremser
Super User

Could it be that the restriction is not enforced by limiting logins, but by limiting concurrent processes? In that case, your additional .bat could cause an additional shell to be invoked, and you then run out of processes?

MC1985
Obsidian | Level 7

thanks Kurt.

 

if i understand yor question i verify but on remote server there are many sas concurrent process, i think there aren't limit for those:

- the user can open more than one sas process through SAS EG

- i can open more than one sas process through SAS Base under server and more than one connection through the SAS/CONNECT

 

let me know

 

have nice day

regards

MC

Martino Crippa
Kurt_Bremser
Super User

Since you use a basic tcpwin.scr with logging in, I guess you use a standard TCP/telnet connection.

In that case, I'd try to play the whole connection sequence manually

- log on

- run the connect.bat

- look if the SESSION ESTABLISHED appears

 

Usually, when something odd happens, you best see it when you run the command from a commandline, as you also get stderr output (which might not be caught otherwise)

 

If that is not sufficent, add echo commands to your .bat files so you can follow the progress within them.

MC1985
Obsidian | Level 7

If i try to replicated the process in manuale way:

  • logon works
  • *.bat was submitted and works
  • the connection was established

the only ERROR come after "SESSION ESTABLISHED"  from tcpwin.scr

it seems the connection fall down, but i don't understand why, because if i lanch sas by the bat file from cmd the process works and don't fall down

i will try to put some echo in *.bat.

 

thank you very much

MC

Martino Crippa
Kurt_Bremser
Super User

SESSION ESTABLISHED means that SAS on the server side comes up alright.

Next, I'd add a -log option that creates an explicit log for your test session (also add logparm="write=immediate") and inspect that after the crash/termination.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 17 replies
  • 3636 views
  • 4 likes
  • 4 in conversation