Chapter Contents

Previous

Next
Communications Access Methods for SAS/CONNECT and SAS/SHARE Software

LOGCMS.SCR Script

The following script signs on and signs off a CMS remote host with the EHLLAPI access method.

/* trace on;  */
/* echo on;   */
/*---------------------------------------------------------------------
   Copyright (C) 1996 by SAS Institute Inc., Cary NC
   name:      logcms.scr
   purpose:   SAS/CONNECT SIGNON/SIGNOFF script for automatically
              connecting to a CMS host using the EHLLAPI access method 
              from a local WINDOWS or an OS/2 operating system.
   notes:     1. This script may need modifications that account for
                 the local flavor of your VM/CMS environment.  The
                 SIGNON sequence should mimic the events that you go
                 through when logging on to the same VM/CMS host.
   assumes:   1. The command to execute SAS in your remote (CMS)
                 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 'logcms.scr' entered.";
[2] if signoff then goto signoff;

/*----- EHLLAPI SIGNON ----------------------------------------------*/

[3] waitfor 'SAS Institute Inc.', 0 seconds: noinit;
     type 'vm ' enter;
[4] waitfor 'USERID' , 20 seconds: nolog;
     input 'Enter userid: ';
     type enter;
[5] waitfor 'ENTER PASSWORD',
             'Enter logon password',
             'SESSION NOT BOUND'    : novtam,
             'NOT IN CP DIR'        : nouser,
             20 seconds             : nolog;
     input nodisplay 'Enter password: ';
     type enter;

[6] waitrdy:
   waitfor 'R;',
             'Ready;',
             'READY',
             'INCORRECT PASSWORD'   : nopass,
             'RECONNECT'            : recon32,
             'UNSUCCESSFUL'         : nostrt,
             'MORE...'              : more,
             30 seconds             : nostrt;
  ready32:
     type clear;
     waitfor 'VM READ', 'RUNNING', 20 seconds: timeout;

     log 'NOTE: Logged on to CMS ... 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.          */
[7] type 'sas (dmr comamid=pclink noterminal no$syntaxcheck)' enter;
     goto continue;
  continue:
[8] waitfor 'IN PROGRESS', 60 seconds: nosas;
[9] log 'NOTE: SAS/CONNECT conversation established.';
   stop;

/*----- EHLLAPI SIGNOFF ---------------------------------------------*/

signoff:
[10] type 'logoff' enter;
     waitfor 'Press enter key', 10 seconds: noterm;
     type enter;
     waitfor 'SAS Institute Inc.' , 10 seconds: noterm;
     type tab;
     type tab;
     type 'vmexit' enter;
     waitfor 'SAS Institute Inc.', 10 seconds: noterm;
[11]   log 'NOTE: SAS/CONNECT conversation terminated.';
     stop;

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

[12] recon:
     type 'begin' enter;
     waitfor 'RUNNING', 'VM READ', 20 seconds: timeout;
     type 'hx' enter;
     goto ready32;

  more:
     snapshot;
     type clear;
     goto waitrdy;

 /*----- ERROR HANDLING ----------------------------------------------*/

[13] noinit:
    snapshot;
     log 'ERROR: No data center network screen.';
     abort;

  novtam:
     snapshot;
     log 'ERROR: VTAM session not bound - contact VTAM support.';
     abort;

  nolog:
     snapshot;
     log 'ERROR: Did not get userid or password prompt.';
     abort;

  nouser:
     log 'ERROR: Unrecognized userid.';
     goto kill;

  nopass:
     log 'ERROR: Invalid password.';
     goto kill;

  nostrt:
     snapshot;
     log 'ERROR: Did not get CMS startup messages after logon.';
     goto kill;

  nosas:
     snapshot;
     log 'ERROR: Did not get SAS software startup messages.';
     goto kill;

  noterm:
     snapshot;
     log 'WARNING: Did not get messages confirming logoff.';
     goto kill;

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

  kill:
     snapshot;
     type '#cp logoff' enter;
     abort;
  1. The LOG statement issues the enquoted message in the log file or in the LOG window of the local SAS session. Although it is not necessary to include LOG statements in your script file, the LOG statements keep the user informed about the progress of the connection.

  2. The IF/THEN statement detects whether the script was called by the SIGNON command or statement or by the SIGNOFF command or statement. When you sign off, the IF/THEN statement directs script processing to the statement that is labeled SIGNOFF.

  3. This section logs the user onto CMS with the EHLLAPI access method.

  4. The WAITFOR statement awaits the login prompt from the remote host. If the statement does not receive the prompt within 20 seconds, it directs script processing to branch to the statement that is labeled NOLOG. The INPUT statement displays a window with the text Enter userid: to allow the user to enter a remote host logon userid. The TYPE statement sends an ENTER to the remote host to enter the userid to the remote host.

  5. The WAITFOR statement awaits the password prompt from the remote host. If the statement does not receive the prompt within 20 seconds, it directs script processing to branch to the statement that is labeled NOLOG. The INPUT statement that follows the WAITFOR statement displays a window in which the user enters a password.

  6. The WAITFOR statement looks for the READY prompt from the remote host, and processing goes to the NOSTRT label if no prompt is received.

  7. When the READY prompt is received, the TYPE statement invokes SAS on the remote host. The DMR option is necessary to invoke a special processing mode for SAS/CONNECT. The COMAMID= option specifies the PCLINK access method that is used to establish the connection.

  8. The WAITFOR statement looks for the message IN PROGRESS, which is displayed when a SAS session starts on the remote host. If the message is not found, processing goes to the NOSAS label.

  9. This LOG statement prints a message to the log that indicates that you have successfully established a link. After the connection has been successfully established, you must stop the rest of the script from processing. Without this STOP statement, processing continues through the remaining statements in the script.

  10. This is the SIGNOFF section for the EHLLAPI connection. See step 2. The TYPE statement logs you off CMS.

  11. This section issues a LOG statement to notify the user that the link is terminated. After the connection has been terminated, you must stop the rest of the script from processing. Without this STOP statement, processing continues through the remaining statements in the script.

  12. These are subroutines that handle various conditions that are found in the WAITFOR statements throughout the script file.

  13. These statements are processed only if the prompts that are expected in the previous steps are not received. This section of the script issues messages to the local SAS log and then abnormally ends the script processing as well as the SIGNON.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.