CFPRIME CMMD                                                            CMMD        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                                                                       CMMD        3
      SUBROUTINE CMMD(STRING,LEN,PARAME,LENPAR,IS)                      CMMD        4
CD                                                                      CMMD        5
CD              THIS ROUTINE CHECKS FOR VALID COMMANDS AND RETURN       CMMD        6
CD              WITH A COMMAND NUMBER AND PARAMETER TO THE MAIN         CMMD        7
CD              ROUTINE.                                                CMMD        8
CD                                                                      CMMD        9
CD              CALLING PARAMETERS :                                    CMMD       10
CD                                                                      CMMD       11
CD                          STRING => COMMAND LINE                      CMMD       12
CD                          LEN    => LEN OF COMMAND LINE               CMMD       13
CD                          PARAME => RETURN COMMAND LINE PARAMETER     CMMD       14
CD                                    TO THE CALLING ROUTINE            CMMD       15
CD                          LENPAR => NUMBER OF CHARACTER IN PARAME     CMMD       16
CD                                                                      CMMD       17
CD                                                                      CMMD       18
      INCLUDE 'SOAPC1.INS'                                              CMMD       19
      CHARACTER*80 STRING                                               CMMD       20
      CHARACTER*50 PARAME,CHRBUF                                        CMMD       21
      CHARACTER*8 KEYW(40)                                              CMMD       22
      COMMON /KEYWOD/ INSTAL,KEYW                                       CMMD       23
C   .......................................                             CMMD       24
C   : GET PARAMETER FROM THE COMMAND LINE :                             CMMD       25
C   :             PARAME=PARAMETER        :                             CMMD       26
C   :             LENPAR=NUMBER OF CHAR   :                             CMMD       27
      PARAME=' '                                                        CMMD       28
      IPARA=INDEX(STRING(1:LEN),'=')                                    CMMD       29
      IF(IPARA.NE.0) THEN                                               CMMD       30
        DO 98 I=IPARA-1,1,-1                                            CMMD       31
           IF(STRING(I:I).NE.' ') GOTO 99                               CMMD       32
  98    CONTINUE                                                        CMMD       33
  99    CONTINUE                                                        CMMD       34
        IPARA=IPARA+1                                                   CMMD       35
        LENPAR=LEN-IPARA+1                                              CMMD       36
        IF(LENPAR.GT.0) THEN                                            CMMD       37
          PARAME=STRING(IPARA:LEN)                                      CMMD       38
          IK=IFNBLK(PARAME,49)                                          CMMD       39
          CHRBUF=PARAME(IK:50)                                          CMMD       40
          PARAME=CHRBUF                                                 CMMD       41
        ELSE                                                            CMMD       42
          PARAME=' '                                                    CMMD       43
        ENDIF                                                           CMMD       44
        LEN=I                                                           CMMD       45
      ENDIF                                                             CMMD       46
C   :.....................................:                             CMMD       47
C   .................................................                   CMMD       48
C   : DETERMINE COMMAND NUMBER                      :                   CMMD       49
C   :                                               :                   CMMD       50
      I=INDEX(STRING(1:LEN),' ')                                        CMMD       51
      IF(I.NE.0) LEN=I-1                                                CMMD       52
      IF(LEN.LE.2) GOTO 9990                                            CMMD       53
      IF(LEN.GT.8) LEN=8                                                CMMD       54
      DO 100 IS=1,INSTAL                                                CMMD       55
        IF(STRING(1:LEN).EQ.KEYW(IS)(1:LEN)) GOTO 9999                  CMMD       56
 100  CONTINUE                                                          CMMD       57
C   :...............................................:                   CMMD       58
C   ......................                                              CMMD       59
C   : INVALID COMMAND    :                                              CMMD       60
C   :                    :                                              CMMD       61
 9990 IS=-1                                                             CMMD       62
      WRITE(LOUT,5000)                                                  CMMD       63
C   :....................:                                              CMMD       64
 9999 RETURN                                                            CMMD       65
 5000 FORMAT(/,                                                         CMMD       66
     1  10X,'**************************************',/,                 CMMD       67
     1  10X,'*       COMMAND NOT RECOGNIZED       *',/,                 CMMD       68
     1  10X,'* TYPE "HELP" FOR MORE INFORMATION.  *',/,                 CMMD       69
     1  10X,'**************************************',/)                 CMMD       70
      END                                                               CMMD       71
