CFPRIME SWTERM                                                          SWTERM      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*               Output Analysis Program for ETMSP (OAP)               *RIGHTE      4
C*               =======================================               *RIGHTE      5
C*                                                                     *RIGHTE     11
C*        copyright @(1993) Electric Power Research Institute          *RIGHTE     12
C*                                                                     *RIGHTE     13
C* EPRI reserves all rights in the software and associated             *RIGHTE     14
C* documentation as delivered. The software and its associated         *RIGHTE     15
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     16
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     17
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     18
C* of any changes or modifications to the software within two (2)      *RIGHTE     19
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     20
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     21
C* new designation sufficiently different from its then current        *RIGHTE     22
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     23
C* the current software as changed or modified.                        *RIGHTE     24
C*                                                                     *RIGHTE     25
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     26
C* directly from EPRI.                                                 *RIGHTE     27
C*                                                                     *RIGHTE     28
C* This program and supporting materials may be independently available*RIGHTE     29
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     30
C* distribution fee. The EPSC is a service of                          *RIGHTE     31
C*                                                                     *RIGHTE     32
C*                    Power Computing Company                          *RIGHTE     33
C*                    1930 Hi Line                                     *RIGHTE     34
C*                    Dallas, Tx 75207                                 *RIGHTE     35
C*                                                                     *RIGHTE     36
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     37
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     38
C*                                                                     *RIGHTE     39
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     40
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     41
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     42
C*    DOCUMENTATION; OR                                                *RIGHTE     43
C*                                                                     *RIGHTE     44
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     45
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     46
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     47
C*                                                                     *RIGHTE     48
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     49
C* THEREOF.                                                            *RIGHTE     50
C*                                                                     *RIGHTE     51
C***********************************************************************RIGHTE     52
      SUBROUTINE SWTERM(IS,FILENA,LENF)                                 SWTERM      3
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSWTERM      4
CD                                                                      SWTERM      5
CD       THIS ROUTINE SWITCHS INPUT DEVICES (BETWEEN TERMINAL AND FILE) SWTERM      6
CD                                                                      SWTERM      7
CD       CALLING PARAMETERS :                                           SWTERM      8
CD                                                                      SWTERM      9
CD                   IS     - INTEGER FLAG INDICATING THE INPUT DEVICE  SWTERM     10
CD                                =  0  INPUT IS A FILE                 SWTERM     11
CD                                = -1  INPUT IS FROM TERMINAL          SWTERM     12
CD                   FILENA - CHARACTER STRING CONTAINING THE FILE NAME SWTERM     13
CD                   LENF   - NO. OF CHARACTERS IN THE FILE NAME        SWTERM     14
CD                                                                      SWTERM     15
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSWTERM     16
C                                                                       SWTERM     17
      CHARACTER*50 FILENA                                               SWTERM     18
      INCLUDE 'SOAPC1.INS'                                              SWTERM     19
      CHARACTER*80 STRING,MSG                                           SWTERM     20
                                                                        SWTERM     21
      IF(LIN.NE.LPIN) THEN                                              SWTERM     22
        CLOSE(LIN)                                                      SWTERM     23
        LIN=LPIN                                                        SWTERM     24
        PLAYBA=.FALSE.                                                  SWTERM     25
        WRITE(LOUT,5010)                                                SWTERM     26
        IS=-1                                                           SWTERM     27
      ELSE IF(LIN.EQ.LPIN) THEN                                         SWTERM     28
        IF(FILENA(1:1).EQ.' ') THEN                                     SWTERM     29
            MSG='Enter Name Of Recording File'                          SWTERM     30
            CALL PMTRED(LOUT,LIN,JERR,28,MSG,'PLA',STRING)              SWTERM     31
            IF(JERR.LT.0)GOTO 1100                                      SWTERM     32
            IF(RECORD) WRITE(IREC,5000) STRING                          SWTERM     33
            LENFIL=LENS(STRING)                                         SWTERM     34
            FILENA(1:50)=STRING(1:50)                                   SWTERM     35
            IF(LENFIL.LE.0) GOTO 1100                                   SWTERM     36
        ELSE                                                            SWTERM     37
            LENFIL=LENF                                                 SWTERM     38
            STRING(1:LENFIL)=FILENA(1:LENFIL)                           SWTERM     39
        ENDIF                                                           SWTERM     40
        LIN=15                                                          SWTERM     41
C      ..................................................               SWTERM     42
C      : Parse parameter for a logical unit number      :               SWTERM     43
         CALL PARSIU(FILENA,LENFIL,IU,LO)                               SWTERM     44
         IF(IU.GT.0)THEN                                                SWTERM     45
            STRING(1:LENFIL)=FILENA(1:LENFIL)                           SWTERM     46
            LIN=IU                                                      SWTERM     47
            LENFIL=LO                                                   SWTERM     48
         ENDIF                                                          SWTERM     49
C      :................................................:               SWTERM     50
        CALL OPENFI(LIN,STRING,LENFIL,IERR,'OLD',1)                     SWTERM     51
        IF(IERR.LT.0) GOTO 1100                                         SWTERM     52
        PLAYBA=.TRUE.                                                   SWTERM     53
        IS=0                                                            SWTERM     54
      ENDIF                                                             SWTERM     55
      GOTO 2000                                                         SWTERM     56
C   ..................................                                  SWTERM     57
C   : ERROR ON OPENING RESPONSE FILE :                                  SWTERM     58
 1100 CONTINUE                                                          SWTERM     59
      IS=-1                                                             SWTERM     60
      LIN=LPIN                                                          SWTERM     61
      PLAYBA=.FALSE.                                                    SWTERM     62
      WRITE(LOUT,5002)                                                  SWTERM     63
C    :................................:                                 SWTERM     64
 2000 CONTINUE                                                          SWTERM     65
      RETURN                                                            SWTERM     66
 5000 FORMAT(A)                                                         SWTERM     67
 5002 FORMAT(/,                                                         SWTERM     68
     1  10X,'*******************ERROR************************',/,       SWTERM     69
     1  10X,'*            OPENING RESPONSE FILE             *',/,       SWTERM     70
     1  10X,'*       COMMAND INPUT DEFAULTS TO TERMINAL.    *',/,       SWTERM     71
     1  10X,'************************************************',/)       SWTERM     72
 5010 FORMAT(/,                                                         SWTERM     73
     1  10X,'................................................',/,       SWTERM     74
     1  10X,':  -- NO MORE COMMANDS IN RESPONSE FILE --     :',/,       SWTERM     75
     1  10X,':     COMMAND INPUT DEFAULTS TO TERMINAL.      :',/,       SWTERM     76
     1  10X,':..............................................:',/)       SWTERM     77
      END                                                               SWTERM     78
