/* trace on; */ /* echo on; */ /*-------------------------------------------------------------------*/ /*-- Copyright (C) 2007 by SAS Institute Inc., Cary NC --*/ /*-- --*/ /*-- name: tcpunix.scr --*/ /*-- --*/ /*-- purpose:SAS/CONNECT SIGNON/SIGNOFF script for connecting --*/ /*-- to any UNIX host by means of the TCP/IP access --*/ /*-- method --*/ /*-- --*/ /*-- notes: 1. This script might need modifications that account --*/ /*-- for the local flavor of your UNIX environment. --*/ /*-- The logon process should mimic the tasks that --*/ /*-- you perform when "telnet"-ing to the same --*/ /*-- UNIX host. If you are connecting to a spawner --*/ /*-- that is running in your UNIX environment, this --*/ /*-- script should need few or no modifications. --*/ /*-- --*/ /*-- 2. You must have specified OPTIONS COMAMID=TCP --*/ /*-- in the local SAS session before using the SIGNON --*/ /*-- statement. --*/ /*-- --*/ /*-- assumes: 1. The command to execute SAS in your remote (UNIX) --*/ /*-- environment is "sas". If this is incorrect --*/ /*-- for your site, change the contents of the line --*/ /*-- that contains: --*/ /*-- type 'sas ... --*/ /*-- --*/ /*-- support: SAS Institute staff --*/ /*-- --*/ /*-------------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /*-- if you are connecting to DEC ULTRIX, and the remote --*/ /*-- machine does not run the DECnet connection/gateway --*/ /*-- software, logins by means ofSAS/CONNECT will appear to --*/ /*-- hang. This is due to the ULTRIX "/etc/telnetd" server --*/ /*-- treating a DONT ECHO request for both input and output --*/ /*-- streams. --*/ /*-- --*/ /*-- The DEBUG statement causes the SAS TCP/IP access method --*/ /*-- not to reply to the ECHO request, keeping the DEC telnetd --*/ /*-- server happy. --*/ /*-- --*/ /*-- Uncomment the DEBUG statement, if the logon appears to hang--*/ /*----------------------------------------------------------------*/ /* debug '00001000'; */ /*----------------------------------------------------------------*/ /*-- If you are connecting to INTEL ABI, you need to uncomment --*/ /*-- the following DEBUG statement. This DEBUG statement --*/ /*-- allowsSAS/CONNECT to set the terminal type to TTY during --*/ /*-- the Telnet negotiations that take place during SIGNON. --*/ /*----------------------------------------------------------------*/ /* debug '00004000'; */ 1 log "NOTE: Script file 'tcpunix.scr' entered."; if not tcp then goto notcp; 2 if signoff then goto signoff; /* --------------- TCP/IP SIGNON ---------------------------------*/ 3 waitfor 'login:' , 'Username:' , 'Scripted signon not allowed' : noscript , 120 seconds: noinit; /*----------------UNIX LOGON---------------------------------------*/ /*-- for some reason, it needs an LF to turn the line around --*/ /*-- after the login name has been typed. (CR will not do) --*/ /*-----------------------------------------------------------------*/ 4 input 'Userid?'; type LF; 5 waitfor 'Password', 30 seconds : nolog; input nodisplay 'Password?'; type LF; unx_log: 6 waitfor 'Hello>' : unxspawn /*- UNIX spawner prompt-*/ , '$' /*-- a common prompt character --*/ , '>' /*-- another common prompt character --*/ , '%' /*-- another common prompt character --*/ , '}' /*-- another common prompt character --*/ , 'Login incorrect' : nouser , 'Enter terminal type' : unx_term , 'TERM' : unx_term , 30 seconds : timeout ; log 'NOTE: Logged onto UNIX... Starting remote SAS now.'; /* NOTERMINAL suppresses prompts from remote SAS session. */ /* NO\$SYNTAXCHECK prevents remote side from going into */ /* syntax checking mode when a syntax error is encountered. */ 7type 'sas -dmr -comamid tcp -device grlink -noterminal -no\$syntaxcheck' LF; 8waitfor 'SESSION ESTABLISHED', 90 seconds : nosas; 9log 'NOTE:SAS/CONNECT conversation established.'; stop; 10unxspawn: /* The UNIX spawner executes only a single UNIX command */ /* after the client logs on. In the TYPE statement below, */ /* you can specify a SAS command line. You can also specify */ /* a UNIX shell script that issues the SAS command line in */ /* addition to any other commands to be executed prior to */ /* SAS invocation. The following is a sample start-up */ /* file: */ /*#---------------------------------------------------------*/ /*# sas_startup */ /*#---------------------------------------------------------*/ /*#!/bin/ksh */ /*. ~/.profile */ /*sas -dmr -noterminal -no\$syntaxcheck -device grlink */ /*#---------------------------------------------------------*/ /* */ /* If you choose to use a "startup" file, change the TYPE */ /* statement below to something similar to the following: */ /* type '/usr/local/whatever/sas_startup' LF; */ 11type 'sas -dmr -comamid tcp -device grlink -noterminal '; type '-no\$syntaxcheck' LF; waitfor 'SESSION ESTABLISHED', 90 seconds : nosas; stop; /*---------------- TCP/IP SIGNOFF --------------------------------------*/ signoff: /* If you have established your connection to UNIX by using */ /* a UNIX spawner, you should delete or comment the */ /* following WAITFOR and TYPE statements. They are not */ /* necessary for signing off a UNIX spawner and will */ /* result in slower performance of SIGNOFF. */ 12waitfor '$' , '>' /*-- another common prompt character --*/ , '%' /*-- another common prompt character --*/ , '}' /*-- another common prompt character --*/ , 30 seconds ; type 'logout' LF; log 'NOTE:SAS/CONNECT conversation terminated.'; stop; /*--------------- SUBROUTINES -----------------------------------*/ unx_term: /*---------------------------------------------------------------*/ /*-- Some UNIX platforms want the terminal type, --*/ /*-- so tell them this is the most basic of terminals. --*/ /*---------------------------------------------------------------*/ type 'tty' LF; goto unx_log; /*--------------- ERROR ROUTINES --------------------------------*/ 13timeout: log 'ERROR: Timeout waiting for remote session response.'; abort; nouser: log 'ERROR: Unrecognized userid or password.'; abort; notcp: log 'ERROR: Incorrect communications access method.'; log 'NOTE: You must set "OPTIONS COMAMID=TCP;" before using this'; log ' script file.'; abort; noinit: log 'ERROR: Did not understand remote session banner.'; nolog: log 'ERROR: Did not receive userid or password prompt.'; abort; nosas: log 'ERROR: Did not get SAS software start-up messages.'; abort; noscript: /* This is the result of trying to sign on with a script file */ /* to a UNIX spawner that has been invoked with the -NOSCRIPT */ /* option. You need to clear any script file reference and */ /* then re-execute SIGNON. */ log 'ERROR: Scripted signons are not allowed.'; log 'NOTE: Clear any script file reference and retry SIGNON.'; abort;
unxspawn
label in step 10.
Verify that the WAITFOR statement in the script looks for the correct
prompt for your site.
SESSION
ESTABLISHED
is displayed when a SAS session is started
on the server by using the options -DMR and -COMAMID TCP. The WAITFOR
statement awaits the display of the message SESSION ESTABLISHED
to
be issued by the server. If the SESSION ESTABLISHED
response
is received within 90 seconds, processing continues with the next
LOG statement. If the SESSION ESTABLISHED
response
does not occur within 90 seconds, the script assumes that the remote
SAS session has not started, and processing branches to the statement
labeled NOSAS.
LOGOFF
.
Before it stops the link, the script issues a LOG statement to notify
the user that the link is terminated.
/* trace on; */ /* echo on; */ /*-------------------------------------------------------------------*/ /*-- Copyright (C) 2007 by SAS Institute Inc., Cary NC --*/ /*-- --*/ /*-- name: tcpwin.scr --*/ /*-- --*/ /*-- purpose:SAS/CONNECT SIGNON/SIGNOFF script for connecting --*/ /*-- to a Windows host by --*/ /*-- using the TCP/IP access method. --*/ /*-- --*/ /*-- notes: 1. You must have the spawner program executing on --*/ /*-- the remote Windows workstation --*/ /*-- in order for the local session to be able to --*/ /*-- establish the connection. If the spawner is --*/ /*-- running on the remote node, you will receive a --*/ /*-- message that tells you that 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 --*/ /*-- environment is "sas". --*/ /*-- If this is incorrect for your site, change the --*/ /*-- contents of the line that contains: --*/ /*-- type 'sas ... --*/ /*-- --*/ /*-- support: SAS Institute staff --*/ /*-- --*/ /*-------------------------------------------------------------------*/ 1log "NOTE: Script file 'tcpwin.scr' entered."; if not tcp then goto notcp; 2if signoff then goto signoff; /* --------------- TCP/IP SIGNON ---------------------------------*/ 3waitfor 'Username:' , 'Hello>' : ready , 'access denied' : nouser , 120 seconds : noprompt ; 4input 'Userid?'; type LF; 5waitfor 'Password:' , 120 seconds: nolog; input nodisplay 'Password?'; type LF; 6waitfor 'Hello>' , 'access denied' : nouser , 120 seconds : timeout ; ready: log 'NOTE: Logged onto Windows... Starting remote SAS now.'; /* NOTERMINAL suppresses prompts from remote SAS session. */ /* NO$SYNTAXCHECK prevents remote side from going into syntax */ /* checking mode when a syntax error is encountered. */ 7type 'sas -dmr -comamid tcp -device grlink -noterminal -no$syntaxcheck' LF; 8waitfor 'SESSION ESTABLISHED', 120 seconds : nosas; 9log 'NOTE:SAS/CONNECT conversation established.'; stop; /*---------------- TCP/IP SIGNOFF -----------------------------------*/ 10signoff: log 'NOTE:SAS/CONNECT conversation terminated.'; stop; /*--------------- SUBROUTINES -----------------------------------*/ /*--------------- ERROR ROUTINES --------------------------------*/ 11 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;
SESSION
ESTABLISHED
is displayed when a SAS session is started
on the server by using the -DMR and -COMAMID TCP options. The WAITFOR
statement awaits the display of the message SESSION ESTABLISHED
to
be issued by the server. If the SESSION ESTABLISHED
response
is received within 120 seconds, processing continues with the next
LOG statement. If the SESSION ESTABLISHED
response
does not occur within 120 seconds, the script assumes that the remote
SAS session has not started and processing branches to the statement
labeled NOSAS.
/*-------------------------------------------------------------------*/ /*-- Copyright (C) 2007 by SAS Institute Inc., Cary NC --*/ /*-- --*/ /*-- name: tcpmvs.scr --*/ /*-- --*/ /*-- purpose:SAS/CONNECT SIGNON/SIGNOFF script for connecting --*/ /*-- to az/OS host via the TCP/IP access method --*/ /*-- --*/ /*-- notes: 1. This script might need modifications that account --*/ /*-- for the local flavor of yourz/OS environment. --*/ /*-- The logon procedure should mimic the tasks that --*/ /*-- you perform when "telnet"-ing to the same --*/ /*--z/OS host through TSO. --*/ /*-- --*/ /*-- 2. You must have specified OPTIONS COMAMID=TCP --*/ /*-- in the local SAS session before using the SIGNON --*/ /*-- command. --*/ /*-- --*/ /*-- 3. This script supports one flavor of connection: --*/ /*-- through a TSO session whose logon procedure --*/ /*-- invokes SAS directly rather than the TSO TMP. --*/ /*-- --*/ /*-- support: SAS Institute staff --*/ /*-- --*/ /*-------------------------------------------------------------------*/ 1 log "NOTE: Script file 'tcpmvs.scr' entered."; if not tcp then goto notcp; 2 if signoff then goto signoff; /* ------------------------ TCP SIGNON ------------------------------*/ /* make sure you are running the IBM TCP/IP */ 3 waitfor 'ENTER USERID' : tsologon, 120 seconds : noinit; /*-------------------------- TSO LOGON ------------------------------*/ tsologon: 4 input 'Userid?'; type LF; 5 waitfor 'ENTER PASSWORD', 60 seconds : nolog; tsopass: input nodisplay 'Password?'; type LF; tsodone: 6 waitfor 'SESSION ESTABLISHED', 'PASSWORD INVALID' : tsopass, 'ENTER NEW PASSWORD' : tsonewp, 'CURRENTLY LOGGED ON' : dup_log, 'NOT VALID' : nouser, 120 seconds : notso; waitfor 1 second; 7 log 'NOTE:SAS/CONNECT conversation established.'; stop; tsonewp: 8 input nodisplay 'New Password?'; type LF; 9 waitfor 'VERIFY NEW PASSWORD', 120 seconds : notso; input nodisplay 'Verify New Password'; type LF; goto tsodone; /*---------------------------- SIGNOFF ------------------------------*/ 10 signoff: type 'logoff' LF; waitfor 'LOGGED OFF' : logoff, 20 seconds; log 'WARNING: Did not get messages confirming logoff.'; abort; logoff: log 'NOTE:SAS/CONNECT conversation terminated.'; stop; /*----------------------- TSO ERROR ROUTINES ------------------------*/ 11 nouser: log 'ERROR: Unrecognized userid.'; abort; notcp: log 'ERROR: Incorrect communications access method.'; log 'NOTE: You must set "OPTIONS COMAMID=TCP;" before using this'; log ' script file.'; abort; noinit: log 'ERROR: Did not understand remote session banner.'; abort; nolog: log 'ERROR: Did not get userid or password prompt.'; abort; notso: log 'ERROR: Did not get TSO startup messages after logon.'; abort; dup_log: log 'ERROR: User is already logged onto TSO.'; abort;
SESSION
ESTABLISHED
is displayed when a SAS session is started
on the server. The WAITFOR statement awaits the display of the message SESSION
ESTABLISHED
to be issued by the server. If the SESSION
ESTABLISHED
response is received within 120 seconds,
processing continues with the next LOG statement. If the SESSION
ESTABLISHED
response does not occur within 120 seconds,
the script assumes that the remote SAS session has not started and
processing branches to the statement labeled NOTSO.
LOGOFF
,
which logs the user off the server. Before it stops the link, the
script issues a LOG statement to notify the user that the link is
terminated.
/* trace on; */ /* echo on; */ /*-------------------------------------------------------------------*/ /*-- Copyright (C) 2007 by SAS Institute Inc., Cary NC --*/ /*-- --*/ /*-- name: tcptso9.scr --*/ /*-- --*/ /*-- purpose:SAS/CONNECT SIGNON/SIGNOFF script for connecting --*/ /*-- to az/OS host running SAS 9 or later via the --*/ /*-- TCP/IP access method. --*/ /*-- --*/ /*-- notes: 1. This script might need modifications that account --*/ /*-- for the local flavor of yourz/OS environment. --*/ /*-- The logon procedure should mimic the tasks that --*/ /*-- you perform when "telnet"-ing to the same --*/ /*--z/OS host, either to TSO or to thez/OS --*/ /*-- spawner. --*/ /*-- --*/ /*-- 2. You must have specified OPTIONS COMAMID=TCP --*/ /*-- in the local SAS session before using the SIGNON --*/ /*-- command. --*/ /*-- --*/ /*-- 3. This script supports two flavors of connection: --*/ /*-- through a TSO session whose logon procedure --*/ /*-- invokes the TSO TMP or through thez/OS --*/ /*-- spawner. --*/ /*-- --*/ /*-- 4. If you use the spawner to start the SAS session, --*/ /*-- in the signoff portion of the script, comment the --*/ /*-- LOGOFF command, which is only needed to complete --*/ /*-- TSO session termination and is not necessary for --*/ /*-- a spawned session. --*/ /*-- --*/ /*-- assumes: 1. The shell script to execute SAS in your remote --*/ /*--z/OS environment is: --*/ /*-- "/usr/local/bin/spawnsas.sh" --*/ /*-- If you are using a different shell script or have --*/ /*-- your shell script stored in a different location, --*/ /*-- change the contents of the type statement that --*/ /*-- specifies this shell script: --*/ /*-- type "/usr/local/bin/spawnsas.sh ..." LF; --*/ /*-- --*/ /*-- 2. The command to execute SAS in your remote --*/ /*-- (MVS/TSO) environment is "sas". If this is --*/ /*-- incorrect for your site, change the contents of --*/ /*-- the line for connection through TSO that --*/ /*-- contains: --*/ /*-- type "sas ..." lf; --*/ /*-- --*/ /*-- support: SAS Institute staff --*/ /*-- --*/ /*-------------------------------------------------------------------*/ 1 log "NOTE: Script file 'tcptso9.scr' entered."; if not tcp then goto notcp; 2 if signoff then goto signoff; /* ------------------------ TCP SIGNON ------------------------------*/ /* make sure you are running the IBM TCP/IP or thez/OS spawner */ 3 waitfor 'Username:' : spnlogon, 'ENTER USERID' : tsologon, 120 seconds : noinit; /*------------------------- SPAWNER LOGON ---------------------------*/ spnlogon: 4 input 'Userid?'; type LF; 5 waitfor 'Password', 120 seconds : spnfail; input nodisplay 'Password?'; type LF; spndone: 6 waitfor 'Hello>', 'Userid' : spnlogon, 'Password expired' : spnnewp, 120 seconds : spnfail; 7 type "/usr/local/bin/spawnsas.sh nosasuser opt(''dmr comamid=tcp'')" LF; 8 waitfor 'SESSION ESTABLISHED', 120 seconds : spnfail; 9 log 'NOTE:SAS/CONNECT conversation established.'; stop; spnnewp: 10 input nodisplay 'New Password?'; type LF; waitfor 'Verify new password', 120 seconds : spnfail; input nodisplay 'Verify New Password'; type LF; goto spndone; spnfail: log 'ERROR: Invalid SPAWNER prompt message received.'; abort; /*-------------------------- TSO LOGON ------------------------------*/ tsologon: 11 input 'Userid?'; type LF; 12 waitfor 'ENTER PASSWORD', 60 seconds : nolog; input nodisplay 'Password?'; type LF; tsodone: 13 waitfor 'READY', 'CURRENTLY LOGGED ON' : dup_log, 'NOT VALID' : nouser, 'PASSWORD INVALID' : nopass, 'ENTER NEW PASSWORD' : tsonewp, 'RECONNECT SUCCESS' : recon, 120 seconds : notso; waitfor 1 second; strt_sas: log 'NOTE: Logged on to TSO.... Starting remote SAS now.'; /* NOTERMINAL suppresses prompts from */ /* remote SAS session. NOSYNTAXCHECK prevents remote side from */ /* going into syntax checking mode when a syntax error is encountered. */ 14 type "sas o('dmr,comamid=TCP,noterminal,nosyntaxcheck')" LF; 15 waitfor 'SESSION ESTABLISHED', 120 seconds : nosas; 16 log 'NOTE:SAS/CONNECT conversation established.'; stop; tsonewp: 17 input nodisplay 'New Password?'; type LF; waitfor 'VERIFY NEW PASSWORD', 120 seconds : notso; input nodisplay 'Verify New Password'; type LF; goto tsodone; /*---------------------------- SIGNOFF------------------------------*/ 18 signoff: /* --------- for the spawner, comment the following section ---------*/ waitfor 'READY', 20 seconds: noterm; type 'logoff' LF; waitfor 'LOGGED OFF' : logoff, 20 seconds; log 'WARNING: Did not get messages confirming logoff.'; abort; logoff: /*---------- for the spawner, comment the previous section ----------*/ log 'NOTE:SAS/CONNECT conversation terminated.'; stop; /*----- SUBROUTINES-------------------------------------------------*/ 19 recon: log 'NOTE: Reconnected to previous session. Old SAS session lost.'; type LF; waitfor 'READY' : strt_sas, 120 seconds; log 'NOTE: Reconnected to a Running Session, but no READY prompt'; abort; /*--------------- ERROR ROUTINES--------------------------------*/ 20 nouser: log 'ERROR: Unrecognized userid.'; abort; nopass: log 'ERROR: Invalid password.'; abort; notcp: log 'ERROR: Incorrect communications access method.'; log 'NOTE: You must set "OPTIONS COMAMID=TCP;" before using this'; log ' script file.'; abort; noinit: log 'ERROR: Did not understand remote session banner.'; abort; nolog: log 'ERROR: Did not get userid or password prompt.'; abort; notso: log 'ERROR: Did not get TSO startup messages after logon.'; abort; nosas: log 'ERROR: Did not get SAS software startup messages.'; abort; dup_log: log 'ERROR: User is already logged onto TSO.'; abort; noterm: log 'ERROR: Did not get READY prompt; remote session still logged on.'; abort;
SESSION
ESTABLISHED
is displayed when a SAS session is started
on the server by using the DMR and COMAMID=TCP options. The WAITFOR
statement awaits the display of the message SESSION ESTABLISHED
that
is issued by the server. If the SESSION ESTABLISHED
response
is received within 120 seconds, processing continues with the next
LOG statement. If the response is not received in the specified time
period, the script assumes that the remote SAS session has not started
and processing branches to the statement labeled SPNFAIL.
SESSION
ESTABLISHED
is displayed when a SAS session is started
on the server using the DMR and COMAMID=TCP options. The WAITFOR
statement awaits the display of the message SESSION ESTABLISHED
to
be issued by the server. If the SESSION ESTABLISHED
response
is received within 120 seconds, processing continues with the next
LOG statement. If the response is not received within the time limit,
the script assumes that the remote SAS session has not started and
processing branches to the statement labeled NOSAS.