CFPRIME OPCHNL                                                          OPCHNL      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 OPCHNL(FILENA,LENF)                                    OPCHNL      3
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOPCHNL      4
CD                                                                      OPCHNL      5
CD         THIS ROUTINE PARSES FOR A FILE NAME PURPOSE AND OPENS A      OPCHNL      6
CD         CHANNEL FILE                                                 OPCHNL      7
CD                                                                      OPCHNL      8
CD         CALLING PARAMETERS :                                         OPCHNL      9
CD                                                                      OPCHNL     10
CD                     FILENA - CHARACTER STRING CONTAINING THE FILE    OPCHNL     11
CD                              NAME                                    OPCHNL     12
CD                     LENF   - LENGTH OF THE FILE NAME                 OPCHNL     13
CD                                                                      OPCHNL     14
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCOPCHNL     15
C                                                                       OPCHNL     16
      CHARACTER*50 FILENA                                               OPCHNL     17
      INCLUDE 'PARAM.INS'                                               OPCHNL     18
      INCLUDE 'SOAPC1.INS'                                              OPCHNL     19
      INCLUDE 'XYARAY.INS'                                              OPCHNL     20
      CHARACTER*80 MSG                                                  OPCHNL     21
      LOGICAL ISTOP                                                     OPCHNL     22
C    .................................................................  OPCHNL     23
C    : START RECORDING                                               :  OPCHNL     24
C    :                                                               :  OPCHNL     25
      IF(OPENED) THEN                                                   OPCHNL     26
          WRITE(LOUT,5006)                                              OPCHNL     27
          CLOSE (ICHNL)                                                 OPCHNL     28
      ENDIF                                                             OPCHNL     29
      OPENED=.TRUE.                                                     OPCHNL     30
      IF(FILENA(1:1).EQ.' ') THEN                                       OPCHNL     31
         MSG='ENTER NAME OF CHANNEL FILE'                               OPCHNL     32
         CALL PMTRED(LOUT,LIN,JERR,26,MSG,'OPE',CHNLFI)                 OPCHNL     33
         IF((JERR.LT.0).OR.(CHNLFI(1:4).EQ.'QUIT').OR.                  OPCHNL     34
     1   (CHNLFI(1:5).EQ.'ABORT') ) GOTO 1100                           OPCHNL     35
         LENFIL=LENS(CHNLFI)                                            OPCHNL     36
         FILENA(1:50)=CHNLFI(1:50)                                      OPCHNL     37
         IF(RECORD) WRITE(IREC,5106) CHNLFI(1:LENFIL)                   OPCHNL     38
         IF(LENFIL.LE.0) GOTO 1100                                      OPCHNL     39
      ELSE                                                              OPCHNL     40
         CHNLFI(1:80)=' '                                               OPCHNL     41
         LENFIL=LENF                                                    OPCHNL     42
         CHNLFI(1:LENFIL)=FILENA(1:LENFIL)                              OPCHNL     43
      ENDIF                                                             OPCHNL     44
                                                                        OPCHNL     45
C  ...............................................................      OPCHNL     46
C  : Parse parameter for a logical unit number                   :      OPCHNL     47
      CALL PARSIU(FILENA,LENFIL,IU,LO)                                  OPCHNL     48
      IF(IU.GT.0)THEN                                                   OPCHNL     49
         CHNLFI(1:LENFIL)=FILENA(1:LENFIL)                              OPCHNL     50
         ICHNL=IU                                                       OPCHNL     51
         LENFIL=LO                                                      OPCHNL     52
      ENDIF                                                             OPCHNL     53
C  :.............................................................:      OPCHNL     54
C  ...............................................................      OPCHNL     55
C  : THIS IS A REAL SIMU BIN FILE                                :      OPCHNL     56
C  :                                                             :      OPCHNL     57
      CALL OPENFI(ICHNL,CHNLFI,LENFIL,IERR,'OLD',2)                     OPCHNL     58
      CHNLFI=CHNLFI(INDEX(CHNLFI,']')+1:LENFIL)                         OPCHNL     59
      IF(IERR.LT.0) GOTO 1100                                           OPCHNL     60
C  :.............................................................:      OPCHNL     61
C  ............................................................         OPCHNL     62
C  :  SET DEFAULT PLOT TITLE TO FILE NAME                     :         OPCHNL     63
      CTITLE(1)=' '                                                     OPCHNL     64
      CHNLFI(LENFIL+1:80)=' '                                           OPCHNL     65
C  :..........................................................:         OPCHNL     66
      CALL RDREC9(ICHNL,ISTOP)                                          OPCHNL     67
      CASEID(1)=CASID                                                   OPCHNL     68
      IF(ISTOP) THEN                                                    OPCHNL     69
         WRITE(LOUT,1000)                                               OPCHNL     70
         GOTO 1120                                                      OPCHNL     71
 1000    FORMAT(1X,' (ERR)')                                            OPCHNL     72
      ENDIF                                                             OPCHNL     73
                                                                        OPCHNL     74
 5106 FORMAT(A)                                                         OPCHNL     75
      WRITE(LOUT,5105)                                                  OPCHNL     76
      HTIME=.TRUE.                                                      OPCHNL     77
      GOTO 1120                                                         OPCHNL     78
C    ................................                                   OPCHNL     79
C    :ERROR ON OPENING CHANNEL FILE :                                   OPCHNL     80
 1100 CONTINUE                                                          OPCHNL     81
      OPENED=.FALSE.                                                    OPCHNL     82
      WRITE(LOUT,5120)                                                  OPCHNL     83
C    :..............................:                                   OPCHNL     84
 1120 CONTINUE                                                          OPCHNL     85
      RETURN                                                            OPCHNL     86
 5006 FORMAT(/,                                                         OPCHNL     87
     1  10X,'.....................................',/,                  OPCHNL     88
     1  10X,':  -- OLD CHANNEL FILE CLOSED. --   :',/,                  OPCHNL     89
     1  10X,':...................................:',/)                  OPCHNL     90
 5105 FORMAT(/,                                                         OPCHNL     91
     1  10X,'....................................',/,                   OPCHNL     92
     1  10X,':    -- CHANNEL FILE OPENED --     :',/,                   OPCHNL     93
     1  10X,':..................................:',/)                   OPCHNL     94
 5120 FORMAT(/,                                                         OPCHNL     95
     1  10X,'************************************************',/,       OPCHNL     96
     1  10X,'*          ERROR OPENING CHANNEL FILE          *',/,       OPCHNL     97
     1  10X,'************************************************',/)       OPCHNL     98
      END                                                               OPCHNL     99
