CFPRIME PARSIN                                                          PARSIN      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 PARSIN(PARAM,LENPAR,XA,YA,LCH,LRECFD,CONST,NC2,        PARSIN      3
     1                  IOK)                                            PARSIN      4
CD                                                                      PARSIN      5
CD             THIS ROUTINE PARSES CAMMAND PARAMETER FOR CHANNEL NO.    PARSIN      6
CD             AND THEN READ IN THE CONTENT OF THE CHANNEL              PARSIN      7
CD                                                                      PARSIN      8
CD            CALLING PARAMETERS :                                      PARSIN      9
CD                                                                      PARSIN     10
CD                        PARAM  :  COMMAND LINE                        PARSIN     11
CD                        LENPAR :  LENGTH OF THE CHARARCTER STRING IN  PARSIN     12
CD                                  THE COMMAD LINE                     PARSIN     13
CD                        XA     :  ARRAY FOR THE X-AXIS                PARSIN     14
CD                        YA     :  ARRAY FOR THE Y-AXIS                PARSIN     15
CD                        LCH    :  CHANNEL NUMBER ARRAY                PARSIN     16
CD                        LRECFD :  RECORD/FIELD POINTER ARRAY          PARSIN     17
CD                        CONST  :  READ IN CONSTANT                    PARSIN     18
CD                        NC2    :  INCOMING FLAG,DETERMINE THE NO. OF  PARSIN     19
CD                                  CHANNEL IN THE COMMAND LINE         PARSIN     20
CD                        IOK    :  ERROR STATUS FLAG                   PARSIN     21
CD                                                                      PARSIN     22
CD                                                                      PARSIN     23
      INCLUDE 'PARAM.INS'                                               PARSIN     24
      INCLUDE 'SOAPC1.INS'                                              PARSIN     25
      INCLUDE 'DBFLG.INS'                                               PARSIN     26
      INCLUDE 'XYARAY.INS'                                              PARSIN     27
C!                                                                      PARSIN     28
C      DIMENSION XA(MXPT),YA(MXPT,NBUF),LCH(NBUF),LRECFD(NBUF,2)        PARSIN     29
      DIMENSION XA(MXPT,MXPLOT),YA(MXPT,MXPLOT),LCH(MCHNL),             PARSIN     30
     *  LRECFD(MCHNL,2)                                                 PARSIN     31
C                                                                       PARSIN     32
      CHARACTER*50 PARAM                                                PARSIN     33
      CHARACTER*80 STRING,MSG                                           PARSIN     34
      LDEBUG=DEBUG(9)                                                   PARSIN     35
      IOK=0                                                             PARSIN     36
      LDEB=99                                                           PARSIN     37
C    .................................................................. PARSIN     38
C    : Call PARSPA to parse command parameter for channel numbers and : PARSIN     39
C    : make sure they're the same type. If not issue a warning .      : PARSIN     40
C    : Then read the channel data into buffer.                        : PARSIN     41
C    :                                                                : PARSIN     42
      IF(OPENED) THEN                                                   PARSIN     43
            CONST=0.0                                                   PARSIN     44
      N1=KCH(1)+1                                                       PARSIN     45
            CALL PARSPA(PARAM,LENPAR,LCH,LRECFD,NBUF,LOUT,CONST,        PARSIN     46
     1                  NC2,IOK,N1)                                     PARSIN     47
      N2=KCH(1)+LCH(1)                                                  PARSIN     48
      DO 100 I=N1,N2+1                                                  PARSIN     49
        KCH(I)=LCH(I)                                                   PARSIN     50
 100  CONTINUE                                                          PARSIN     51
      IF(N2.GT.MCHNL-1)N2=MCHNL-1                                       PARSIN     52
            IF(LDEBUG) WRITE(LDEB,1029) CONST                           PARSIN     53
 1029       FORMAT(/,1X,'*DEBUG (FUNCTN) CONST = ',F10.4,/)             PARSIN     54
            IF(IOK.EQ.1) THEN                                           PARSIN     55
               WRITE(LOUT,1030)                                         PARSIN     56
 1030          FORMAT(/,1X,'** Channels read in are not the same type', PARSIN     57
     1         ', the plot may not be valid.',/)                        PARSIN     58
               MSG='ABORT or CONTINUE ?'                                PARSIN     59
               CALL PMTRED(LOUT,LIN,JERR,19,MSG,'DIF',STRING)           PARSIN     60
C               CALL SCRPMT(LOUT,MSG,19)                                PARSIN     61
C               READ(LIN,1040) STRING                                   PARSIN     62
               IF(RECORD) WRITE(IREC,1040) STRING                       PARSIN     63
 1040          FORMAT(A)                                                PARSIN     64
               IF((STRING(1:1).EQ.'A').OR.(JERR.LT.0)) IOK=-1           PARSIN     65
            ENDIF                                                       PARSIN     66
            IF(IOK.LT.0) THEN                                           PARSIN     67
               WRITE(LOUT,1050)                                         PARSIN     68
 1050          FORMAT(/,1X,'**FUNCTION ABORTED**',/)                    PARSIN     69
               GOTO 9999                                                PARSIN     70
            ENDIF                                                       PARSIN     71
C!                                                                      PARSIN     72
                                                                        PARSIN     73
                                                                        PARSIN     74
                                                                        PARSIN     75
C            CALL REMASS(XA,YA,MXPT,NBUF,ICHNL,NBUF,LOUT)               PARSIN     76
            CALL REMASS(XA,YA,MXPT,MXPLOT,ICHNL,N1,N2,LRECFD)           PARSIN     77
C                                                                       PARSIN     78
C            IF(LDEBUG) CALL PRNBUF(XA,YA,MXPT,MXPLOT,MAXPT,LCH,NBUF,   PARSIN     79
C     1      LOUT,99)                                                   PARSIN     80
      ELSE                                                              PARSIN     81
            WRITE(LOUT,1026)                                            PARSIN     82
            IOK=-1                                                      PARSIN     83
      ENDIF                                                             PARSIN     84
C    :................................................................: PARSIN     85
                                                                        PARSIN     86
 9999 CONTINUE                                                          PARSIN     87
      RETURN                                                            PARSIN     88
1026       FORMAT(/,                                                    PARSIN     89
     1      10X,'********************************',/,                   PARSIN     90
     1      10X,'*  CHANNEL FILE NOT AVAILABLE  *',/,                   PARSIN     91
     1      10X,'* USE "OPENCASE" COMMAND FIRST *',/,                   PARSIN     92
     1      10X,'********************************')                     PARSIN     93
                                                                        PARSIN     94
       END                                                              PARSIN     95
                                                                        PARSIN     96
