![]() Chapter Contents |
![]() Previous |
![]() Next |
SAS/CONNECT User's Guide |
When you are writing scripts or modifying existing scripts, the WAITFOR and TYPE statements require special attention to detail. To ensure that the script recognizes the expected prompt for each stage of signing on, you must be careful to specify the exact sequence of prompts and responses for the remote host.
The simplest method for determining these is to go to the remote host and manually go through the process that you want to capture in the WAITFOR and TYPE statements. For each display on the remote host, choose a word from that display for the WAITFOR statement. Whatever information you type to respond to a display should be specified in the TYPE statement. Be sure to note all carriage returns or other special keys.
If OS/390 is the remote host and you need to use a TYPE statement that has more than 80 characters in a sign-on script, divide the TYPE statement into two or more TYPE statements. To divide the TYPE statement, insert a hyphen (-) at the division point. The remote OS/390 host interprets the hyphen as the continuation of the TYPE statement from the previous line. For example, to divide the following TYPE statement:
type "sas options ('dmr comamid=pclink')" enter;
change it to:
type "sas options ('dmr comamid=-" enter; type "pclink')" enter;
Note: Do not add any spaces around the hyphen.
Script for EHLLAPI Connections |
/* trace on; */ /* echo on; */ /*********************************************/ /* Copyright (C) 1990 by */ /* SAS Institute Inc., Cary NC */ /* */ /* name: tso.scr */ /* */ /* purpose: SAS/CONNECT SIGNON/SIGNOFF */ /* script for connecting to an */ /* OS/390 (with TSO) host by using */ /* the EHLLAPI access method */ /* */ /* notes: The communication parameters may */ /* need to be changed for your site */ /* */ /* assumes: 1. This script assumes that the */ /* remote session is already */ /* logged on. */ /* */ /* 2. The command to execute SAS in */ /* your remote OS/390 (with TSO) */ /* environment is "sas". If */ /* this is incorrect for your */ /* site, change the contents of */ /* the line that contains: */ /* type "sas ... */ /* */ /* support: SAS Institute staff */ /*********************************************/ [1] log "NOTE: Script file 'tso.scr' entered."; [2] if signoff then goto signoff; /*********************************************/ /* EHLLAPI SIGNON */ /*********************************************/ [3] waitfor 'READY', 0 seconds: noinit; log 'NOTE: 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. */ /******************************************/ type "sas options('dmr,comamid=pclink, noterminal,no$syntaxcheck')" enter; [4] continue: waitfor 'IN PROGRESS', 20 seconds: waitsas; [5] onok: log 'NOTE: SAS/CONNECT conversation established.'; stop; /*********************************************/ /* EHLLAPI SIGNOFF */ /*********************************************/ [6] signoff: log 'NOTE: SAS/CONNECT conversation terminated.'; log 'NOTE: Remote session left logged on.'; stop; /*********************************************/ /* SUBROUTINES */ /*********************************************/ [7] waitsas: log 'NOTE: Waiting for startup screen...'; type EREOF enter; goto continue; /*********************************************/ /* ERROR HANDLING */ /*********************************************/ [8] noinit: snapshot; log 'ERROR: Did not get remote prompt. Remote session not active.'; log 'NOTE: You must log on to the remote session before signing on using this script file.'; abort; [9] nosas: snapshot; log 'ERROR: Did not get SAS software startup messages.'; abort;
![]() | |
![]() | |
![]() | |
![]() IN PROGRESS , which is displayed when a SAS session starts on the remote host. If the message is not found, processing goes to the WAITSAS label in step 7. | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() |
Script for TCP/IP Connections |
/* 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 host via the TCP/IP access*/ /* method */ /* */ /* notes: 1. This script may need */ /* modifications that account */ /* for the local flavor of */ /* your UNIX environment. The */ /* logon procedure should */ /* mimic the events that you */ /* go through when */ /* "telnet"-ing to the same */ /* UNIX host. */ /* */ /* 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 (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 */ /*******************************************/ [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:', 120 seconds: noinit; /*******************************************/ /* UNIX LOGON */ /* LF is required 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: /*******************************************/ /* Common prompt characters are $,>,%,} */ /*******************************************/ [6] waitfor '$', '>', '%', '}', 'Login incorrect' : nouser, 'Enter terminal type' : unx_term, 30 seconds : timeout; log 'NOTE: Logged onto UNIX... Starting remote SAS now.'; /****************************************/ /* Invoke SAS on the remote host. */ /****************************************/ [7] type 'sas -dmr -comamid tcp -device grlink -noterminal -no\$syntaxcheck' LF; [8] waitfor 'SESSION ESTABLISHED', 90 seconds : nosas; [9] log 'NOTE: SAS/CONNECT conversation established.'; stop; /*******************************************/ /* TCP/IP SIGNOFF */ /*******************************************/ signoff: [10] 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 */ /*******************************************/ [11] timeout: 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 remote host logon userid. The TYPE statement sends a line feed to the remote host to enter the userid to the remote
host. | |
![]() | |
![]() | |
![]() | |
![]() SESSION ESTABLISHED is displayed when a SAS session is started on the remote host by using the DMR and COMAMID=TCP options. The WAITFOR statement looks for the words
SESSION ESTABLISHED to be issued by the remote host 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 remote SAS session has not started and processing branches to the statement labeled
NOSAS. | |
![]() | |
[10] This section of code is executed when the script is invoked to terminate
the connection. The first IF statement (see step 2) sends processing to this section of the script when the script is invoked by a SIGNOFF command or statement. Note that this section waits for a
remote host prompt before typing
LOGOUT in order to log off the remote host. The script then issues a
LOG statement to notify the user that the connection is terminated and stops the connection. | |
[11] These statements are processed only if the prompts expected in the previous steps are not received. This section of the script issues messages to the local SAS log and then abnormally ends (from the ABORT statement) the processing of the script as well as the sign on. |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.