CFPRIME OPOUTF                                                          OPOUTF      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
C                                                                       OPOUTF      3
      SUBROUTINE OPOUTF(FILENA,LENF,IDPDEV,IERR)                        OPOUTF      4
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOPOUTF      5
CD                                                                      OPOUTF      6
CD          THIS ROUTINE OPENS A  DIGITAL PLOT OUTPUT FILE              OPOUTF      7
CD                                                                      OPOUTF      8
CD          PARAMETERS :                                                OPOUTF      9
CD                                                                      OPOUTF     10
CD                   FILENA - FILENAME                                  OPOUTF     11
CD                   LENF   - NUMBER OF CHARACTER IN THE FILENAME       OPOUTF     12
CD                   IDPDEV - LOGICAL UNIT NUMBER FOR THE FILE          OPOUTF     13
CD                   IERR   - I/O ERROR STATUS                          OPOUTF     14
CD                                                                      OPOUTF     15
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOPOUTF     16
      CHARACTER*(*) FILENA                                              OPOUTF     17
      CHARACTER*80 STRING,MSG                                           OPOUTF     18
      INCLUDE 'SOAPC1.INS'                                              OPOUTF     19
                                                                        OPOUTF     20
C    .................................................................  OPOUTF     21
C    :                                                               :  OPOUTF     22
      IF(FILENA(1:1).EQ.' ') THEN                                       OPOUTF     23
         MSG='ENTER NAME OF DP OUTPUT FILE (CON:)'                      OPOUTF     24
         CALL PMTRED(LOUT,LIN,JERR,35,MSG,'DPD',STRING)                 OPOUTF     25
         IF((JERR.LT.0).OR.(STRING(1:4).EQ.'QUIT').OR.                  OPOUTF     26
     1   (STRING(1:5).EQ.'ABORT') ) GOTO 1100                           OPOUTF     27
         LENFIL=LENS(STRING)                                            OPOUTF     28
         IF(LENFIL.LE.0) GOTO 1100                                      OPOUTF     29
         IF(RECORD) WRITE(IREC,5106) STRING(1:LENFIL)                   OPOUTF     30
      ELSE                                                              OPOUTF     31
         LENFIL=LENF                                                    OPOUTF     32
         STRING(1:LENFIL)=FILENA(1:LENFIL)                              OPOUTF     33
      ENDIF                                                             OPOUTF     34
                                                                        OPOUTF     35
      IF(FILENA(1:4).EQ.'CON:') THEN                                    OPOUTF     36
         IF(IDPDEV.NE.6)THEN                                            OPOUTF     37
            WRITE(LOUT,5115)                                            OPOUTF     38
            CLOSE(IDPDEV)                                               OPOUTF     39
         ENDIF                                                          OPOUTF     40
         IDPDEV=6                                                       OPOUTF     41
         WRITE(LOUT,5110)                                               OPOUTF     42
         GOTO 1120                                                      OPOUTF     43
      ELSE                                                              OPOUTF     44
         IF(IDPDEV.EQ.22)THEN                                           OPOUTF     45
            WRITE(LOUT,5115)                                            OPOUTF     46
            CLOSE(IDPDEV)                                               OPOUTF     47
         ENDIF                                                          OPOUTF     48
         IDPDEV=22                                                      OPOUTF     49
         CALL OPENFI(IDPDEV,STRING,LENFIL,IERR,'NEW',1)                 OPOUTF     50
         IF(IERR.LT.0) GOTO 1100                                        OPOUTF     51
      ENDIF                                                             OPOUTF     52
                                                                        OPOUTF     53
      IERR=0                                                            OPOUTF     54
 5106 FORMAT(A)                                                         OPOUTF     55
      WRITE(LOUT,5105)STRING(1:LENFIL)                                  OPOUTF     56
      GOTO 1120                                                         OPOUTF     57
C    ................................                                   OPOUTF     58
C    :ERROR ON OPENING DP OUTPUT FILE :                                 OPOUTF     59
 1100 CONTINUE                                                          OPOUTF     60
      IDPDEV=6                                                          OPOUTF     61
      IERR=-1                                                           OPOUTF     62
      WRITE(LOUT,5120)                                                  OPOUTF     63
C    :..............................:                                   OPOUTF     64
 1120 CONTINUE                                                          OPOUTF     65
      RETURN                                                            OPOUTF     66
 5105 FORMAT(/,                                                         OPOUTF     67
     1  10X,'.......................................',/,                OPOUTF     68
     1  10X,':     - DP OUTPUT FILE OPENED --      :',/,                OPOUTF     69
     1  10X,'        FILE NAME : ',A,/,                                 OPOUTF     70
     1  10X,':.....................................:',/)                OPOUTF     71
 5110 FORMAT(/,                                                         OPOUTF     72
     1  10X,'.......................................',/,                OPOUTF     73
     1  10X,':    -- PLOT OUTPUT ON TERMINAL --    :',/,                OPOUTF     74
     1  10X,':.....................................:',/)                OPOUTF     75
 5115 FORMAT(/,                                                         OPOUTF     76
     1  10X,'.......................................',/,                OPOUTF     77
     1  10X,': -- PREVIOUS PLOT FILE NOW CLOSED -- :',/,                OPOUTF     78
     1  10X,':.....................................:',/)                OPOUTF     79
 5120 FORMAT(/,                                                         OPOUTF     80
     1  10X,'************************************************',/,       OPOUTF     81
     1  10X,'*        ERROR OPENING DP OUTPUT FILE          *',/,       OPOUTF     82
     1  10X,'*       PLOT OUTPUT DEFAULT TO TERMINAL        *',/,       OPOUTF     83
     1  10X,'************************************************',/)       OPOUTF     84
      END                                                               OPOUTF     85
