CFPRIME CCMMD                                                           CCMMD       1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*        Extended Transient-Midterm Stability Program (ETMSP)         *RIGHTE      3
C*        ====================================================         *RIGHTE      4
C*                                                                     *RIGHTE      5
C*       Copyright (C) (1993) Electric Power Research Institute        *RIGHTE      6
C*                                                                     *RIGHTE      7
C* EPRI reserves all rights in the software and associated             *RIGHTE      8
C* documentation as delivered. The software and its associated         *RIGHTE      9
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     10
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     11
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     12
C* of any changes or modifications to the software within two (2)      *RIGHTE     13
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     14
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     15
C* new designation sufficiently different from its then current        *RIGHTE     16
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     17
C* the current software as changed or modified.                        *RIGHTE     18
C*                                                                     *RIGHTE     19
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     20
C* directly from EPRI.                                                 *RIGHTE     21
C*                                                                     *RIGHTE     22
C* This program and supporting materials may be independently available*RIGHTE     23
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     24
C* distribution fee. The EPSC is a service of                          *RIGHTE     25
C*                                                                     *RIGHTE     26
C*                    Power Computing Company                          *RIGHTE     27
C*                    1930 Hi Line                                     *RIGHTE     28
C*                    Dallas, Tx 75207                                 *RIGHTE     29
C*                                                                     *RIGHTE     30
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     31
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     32
C*                                                                     *RIGHTE     33
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     34
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     35
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     36
C*    DOCUMENTATION; OR                                                *RIGHTE     37
C*                                                                     *RIGHTE     38
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     39
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     40
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     41
C*                                                                     *RIGHTE     42
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     43
C* THEREOF.                                                            *RIGHTE     44
C*                                                                     *RIGHTE     45
C***********************************************************************RIGHTE     46
      SUBROUTINE CCMMD(STRING,LEN,PARAME,LENPAR,IS)                     CCMMD       3
CD                                                                      CCMMD       4
CD    TO CHECK FOR VALID ETMSP COMMANDS AND RETURN A COMMAND NUMBER AND CCMMD       5
CD    ITS ASSOCIATED PARAMETER.                                         CCMMD       6
CD                                                                      CCMMD       7
CD    THE ARGUMENT LIST IS GIVEN BELOW.                                 CCMMD       8
CD                                                                      CCMMD       9
CD    STRING = CHARACTER STRING CONTAINING THE COMMAND                  CCMMD      10
CD    LEN    = LENGTH OF VALID CHARACTERS IN STRING                     CCMMD      11
CD    PARAME = RETURNED COMMAND LINE PARAMETER                          CCMMD      12
CD    LENPAR = NO. OF CHARACTER IN PARAME                               CCMMD      13
CD                                                                      CCMMD      14
      INCLUDE 'CNLSTA.INS'                                              CCMMD      15
      INCLUDE 'CNKEYW.INS'                                              CCMMD      16
C                                                                       CCMMD      17
      CHARACTER*80 STRING                                               CCMMD      18
      CHARACTER*50 PARAME                                               CCMMD      19
      CHARACTER*14 SPACE                                                CCMMD      20
C                                                                       CCMMD      21
      DATA SPACE/'              '/                                      CCMMD      22
C                                                                       CCMMD      23
      CALL GETPAR(STRING,LEN,PARAME,LENPAR)                             CCMMD      24
C   .................................................                   CCMMD      25
C   : DETERMINE COMMAND NUMBER                      :                   CCMMD      26
C   :                                               :                   CCMMD      27
      IF(LEN.GT.8) LEN=8                                                CCMMD      28
      DO 50 I=1,LEN                                                     CCMMD      29
      JCHAR=ICHAR(STRING(I:I))                                          CCMMD      30
      IF(JCHAR.GE.ICHAR('a').AND.JCHAR.LE.ICHAR('z'))                   CCMMD      31
     *STRING(I:I)=CHAR(JCHAR-ICHAR('a')+ICHAR('A'))                     CCMMD      32
  50  CONTINUE                                                          CCMMD      33
      DO 100 IS=1,INSTAL                                                CCMMD      34
         IF(STRING(1:LEN).EQ.KEYW(IS)(1:LEN)) RETURN                    CCMMD      35
 100  CONTINUE                                                          CCMMD      36
C   :...............................................:                   CCMMD      37
C   ......................                                              CCMMD      38
C   : INVALID COMMAND    :                                              CCMMD      39
C   :                    :                                              CCMMD      40
      WRITE(LOUT,5000)                                                  CCMMD      41
      IS=-1                                                             CCMMD      42
      RETURN                                                            CCMMD      43
C   :....................:                                              CCMMD      44
                                                                        CCMMD      45
 5000 FORMAT(/,                                                         CCMMD      46
     1  10X,'........................................',/,               CCMMD      47
     1  10X,':        COMMAND NOT RECOGNIZED        :',/,               CCMMD      48
     1  10X,':   TYPE "HELP" FOR MORE INFORMATION   :',/,               CCMMD      49
     1  10X,':......................................:',/)               CCMMD      50
      END                                                               CCMMD      51
C                                                                       CCMMD      52
      SUBROUTINE GETPAR(STRING,LEN,PARAME,LENPAR)                       CCMMD      53
CD                                                                      CCMMD      54
CD    TO GET PARAMETER FROM THE COMMAND LINE.                           CCMMD      55
CD                                                                      CCMMD      56
CD       PARAME = PARAMETER                                             CCMMD      57
CD       LENPAR = NUMBER OF CHARACTER                                   CCMMD      58
CD                                                                      CCMMD      59
      CHARACTER*(*) STRING                                              CCMMD      60
      CHARACTER*(*) PARAME                                              CCMMD      61
      PARAME=' '                                                        CCMMD      62
      LENPAR=0                                                          CCMMD      63
      DO 100 I=LEN+1,16                                                 CCMMD      64
      IF(STRING(I:I).NE.' ')GOTO 200                                    CCMMD      65
 100  CONTINUE                                                          CCMMD      66
      RETURN                                                            CCMMD      67
 200  CONTINUE                                                          CCMMD      68
      LENPAR=INDEX(STRING(I:80),'  ')-1                                 CCMMD      69
      IF(LENPAR.EQ.-1) LENPAR=81-I                                      CCMMD      70
      LENPAR=MIN(50,LENPAR)                                             CCMMD      71
      J=I+LENPAR-1                                                      CCMMD      72
      PARAME(1:LENPAR)=STRING(I:J)                                      CCMMD      73
C   :.....................................:                             CCMMD      74
      RETURN                                                            CCMMD      75
      END                                                               CCMMD      76
