type "sas options ('dmr comamid=tcp')" enter;
/* trace on; */ /* echo on; */ /*******************************************/ /* Copyright (C) 1990 */ /* by SAS Institute Inc., Cary NC */ /* */ /* name: tcpunix.scr */ /* */ /* purpose: SAS/CONNECT SIGNON/SIGNOFF */ /* script for connecting to any */ /* UNIX operating environment */ /* via the TCP/IP access method */ /* */ /* notes: 1. This script might need */ /* modifications that account */ /* for the local flavor of */ /* your UNIX environment. The */ /* logon procedure should */ /* mimic the tasks that you */ /* execute when */ /* connecting to the same */ /* UNIX operating environment. */ /* */ /* 2. You must have specified */ /* OPTIONS COMAMID=TCP in the */ /* client session before */ /* using the SIGNON command. */ /* */ /* 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 */ /*******************************************/ 1log "NOTE: Script file 'tcpunix.scr' entered."; if not tcp then goto notcp; 2if signoff then goto signoff; /*******************************************/ /* TCP/IP SIGNON */ /*******************************************/ 3waitfor 'login:', 120 seconds: noinit; /*******************************************/ /* UNIX LOGON */ /* LF is required to turn the line */ /* around after the login name has */ /* been typed. (CR will not do) */ /*******************************************/ 4input 'Userid?'; type LF; 5waitfor 'Password', 30 seconds : nolog; input nodisplay 'Password?'; type LF; unx_log: /*******************************************/ /* Common prompt characters are $,>,%,} */ /*******************************************/ 6waitfor '$', '>', '%', '}', 'Login incorrect' : nouser, 'Enter terminal type' : unx_term, 30 seconds : timeout; log 'NOTE: Logged onto UNIX... Starting remote SAS now.'; /****************************************/ /* Invoke SAS on the server. */ /****************************************/ type 'sas -dmr -comamid tcp -device -noterminal -nosyntaxcheck' LF; waitfor 'SESSION ESTABLISHED', 90 seconds : nosas; log 'NOTE: SAS/CONNECT conversation established.'; stop; /*******************************************/ /* TCP/IP SIGNOFF */ /*******************************************/ 10 signoff: waitfor '$', '>', '%', '}', 30 seconds; type 'logout' LF; log 'NOTE: SAS/CONNECT conversation terminated.'; stop; /*******************************************/ /* SUBROUTINES */ /*******************************************/ unx_term: /****************************************/ /* Some UNIX systems want the */ /* terminal-type. Indicate a basic */ /* tele-type. */ /****************************************/ type 'tty' LF; goto unx_log; /*******************************************/ /* ERROR ROUTINES */ /*******************************************/ 11timeout: 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 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 startup messages.'; abort;
Userid?
to allow the user to enter a server log-on user
ID. The TYPE statement sends a line feed to the server to enter the
user ID to the server.
SESSION ESTABLISHED
is displayed
when a SAS session is started on the server by using the options -DMR
and -COMAMID TCP. The WAITFOR statement looks for the words SESSION ESTABLISHED
to be issued by the server session
to know that the connection has been established. 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 server session has not started
and processing branches to the statement labeled NOSAS.
LOGOUT
in order to log off
the server. The script then issues a LOG statement to notify the user
that the connection is terminated and stops script processing.