CFPRIME SWTERM                                                          SWTERM      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*        Extended Transient-Midterm Stability Program (ETMSP)         *RIGHTE      3
C*        ====================================================         *RIGHTE      4
C*                                                                     *RIGHTE      5
C*       Copyright (C) (1993) Electric Power Research Institute        *RIGHTE      6
C*                                                                     *RIGHTE      7
C* EPRI reserves all rights in the software and associated             *RIGHTE      8
C* documentation as delivered. The software and its associated         *RIGHTE      9
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     10
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     11
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     12
C* of any changes or modifications to the software within two (2)      *RIGHTE     13
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     14
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     15
C* new designation sufficiently different from its then current        *RIGHTE     16
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     17
C* the current software as changed or modified.                        *RIGHTE     18
C*                                                                     *RIGHTE     19
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     20
C* directly from EPRI.                                                 *RIGHTE     21
C*                                                                     *RIGHTE     22
C* This program and supporting materials may be independently available*RIGHTE     23
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     24
C* distribution fee. The EPSC is a service of                          *RIGHTE     25
C*                                                                     *RIGHTE     26
C*                    Power Computing Company                          *RIGHTE     27
C*                    1930 Hi Line                                     *RIGHTE     28
C*                    Dallas, Tx 75207                                 *RIGHTE     29
C*                                                                     *RIGHTE     30
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     31
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     32
C*                                                                     *RIGHTE     33
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     34
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     35
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     36
C*    DOCUMENTATION; OR                                                *RIGHTE     37
C*                                                                     *RIGHTE     38
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     39
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     40
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     41
C*                                                                     *RIGHTE     42
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     43
C* THEREOF.                                                            *RIGHTE     44
C*                                                                     *RIGHTE     45
C***********************************************************************RIGHTE     46
      SUBROUTINE SWTERM(IS,FILENA,LENF,KLAYER)                          SWTERM      3
CD                                                                      SWTERM      4
CD    TO SWITCH INPUT DEVICES - TERMINAL/FILE.                          SWTERM      5
CD                                                                      SWTERM      6
C     CALLED BY:                                                        SWTERM      7
C            GOTOS  - When command "PLAYBACK" is entered.               SWTERM      8
C            INUSER - When an EOF is reach during read from the responseSWTERM      9
C                                                                       SWTERM     10
C                                                                       SWTERM     11
      INCLUDE 'CNLSTA.INS'                                              SWTERM     12
      INCLUDE 'CNLUN.INS'                                               SWTERM     13
      INCLUDE 'CNUNIT.INS'                                              SWTERM     14
C                                                                       SWTERM     15
      CHARACTER*50 FILENA                                               SWTERM     16
      CHARACTER*80 MSG,EMSG                                             SWTERM     17
      CHARACTER*7 SUBPMT                                                SWTERM     18
C                                                                       SWTERM     19
*IF PRIME                                                               SWTERM     20
*ENDIF                                                                  SWTERM     22
*IF -PRIME                                                              SWTERM     23
      IOUT5=5                                                           SWTERM     24
*ENDIF                                                                  SWTERM     25
C                                                                       SWTERM     26
      IF(LIN.NE.IOUT5) THEN                                             SWTERM     27
*IF -MIBM                                                               SWTERM     28
        LUNITS(LIN)=.FALSE.                                             SWTERM     29
*ENDIF                                                                  SWTERM     30
        CLOSE(LIN)                                                      SWTERM     31
        LIN=IOUT5                                                       SWTERM     32
        PLAYBA=.FALSE.                                                  SWTERM     33
        WRITE(LOUT,5010)                                                SWTERM     34
        IS=-1                                                           SWTERM     35
      ELSEIF(LIN.EQ.IOUT5) THEN                                         SWTERM     36
         SUBPMT='PLAYBAK'                                               SWTERM     37
         MSG='ENTER THE RECORDING FILE NAME:'                           SWTERM     38
         EMSG='ERROR IN OPENING RECORDING FILE'                         SWTERM     39
         LMSG=30                                                        SWTERM     40
         LEMSG=31                                                       SWTERM     41
         IKEY=1                                                         SWTERM     42
         JLENG=0                                                        SWTERM     43
         WRITE(LOUT,*)                                                  SWTERM     44
         CALL FILEMG(IU36,LMSG,MSG,LEMSG,EMSG,SUBPMT,IKEY,JLENG,IEBK)   SWTERM     45
         IF(IEBK.NE.0)GOTO 1100                                         SWTERM     46
        LIN=IU36                                                        SWTERM     47
        PLAYBA=.TRUE.                                                   SWTERM     48
        IS=0                                                            SWTERM     49
      ENDIF                                                             SWTERM     50
      GOTO 2000                                                         SWTERM     51
C   ..................................                                  SWTERM     52
C   : ERROR ON OPENING RESPONSE FILE :                                  SWTERM     53
 1100 CONTINUE                                                          SWTERM     54
      IS=-1                                                             SWTERM     55
      LIN=IOUT5                                                         SWTERM     56
      PLAYBA=.FALSE.                                                    SWTERM     57
      WRITE(LOUT,5002)                                                  SWTERM     58
      RETURN                                                            SWTERM     59
C    :................................:                                 SWTERM     60
 2000 CONTINUE                                                          SWTERM     61
C                                                                       SWTERM     62
      RETURN                                                            SWTERM     63
 5002 FORMAT(/,                                                         SWTERM     64
     1  10X,'................................................',/,       SWTERM     65
     1  10X,':     -- ERROR IN OPENING RECORDING FILE --    :',/,       SWTERM     66
     1  10X,':      COMMAND INPUT DEFAULTS TO TERMINAL.     :',/,       SWTERM     67
     1  10X,':..............................................:',/)       SWTERM     68
 5010 FORMAT(/,                                                         SWTERM     69
     1  10X,'................................................',/,       SWTERM     70
     1  10X,':   -- NO MORE COMMANDS IN RECORDING FILE --   :',/,       SWTERM     71
     1  10X,':      COMMAND INPUT DEFAULTS TO TERMINAL.     :',/,       SWTERM     72
     1  10X,':..............................................:',/)       SWTERM     73
      END                                                               SWTERM     74
