CFPRIME INMENU                                                          INMENU      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 INMENU(STRING,ISTAT)                                   INMENU      3
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCINMENU      4
CD                                                                      INMENU      5
CD         THIS ROUTINE READS COMMAND OPTIONS FROM MENU                 INMENU      6
CD                                                                      INMENU      7
CD         CALLING PARAMETERS :                                         INMENU      8
CD                                                                      INMENU      9
CD                    STRING  -  COMMAND LINE                           INMENU     10
CD                    ISTAT   -  I/O ERORR STATUS                       INMENU     11
CD                               0 : NO ERROR IN READING                INMENU     12
CD                        NON-ZERO : ERROR IN READING                   INMENU     13
CD                                                                      INMENU     14
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCINMENU     15
C                                                                       INMENU     16
      INCLUDE 'SOAPC1.INS'                                              INMENU     17
      CHARACTER*80 STRING,MSG,CHRBUF                                    INMENU     18
      CHARACTER*1 CH,AA(9)                                              INMENU     19
      COMMON /KEYWOD/ INSTAL,KEYW                                       INMENU     20
      CHARACTER*8 KEYW(40)                                              INMENU     21
      CHARACTER*3 FUNCT(4)                                              INMENU     22
      DATA FUNCT/'CAL','LSF','ENV','RLY'/                               INMENU     23
      DATA AA/'1','2','3','4','5','6','7','8','9'/                      INMENU     24
C                                                                       INMENU     25
      ISTAT=0                                                           INMENU     26
C                                                                       INMENU     27
    1 CONTINUE                                                          INMENU     28
      IF(LIN.EQ.LPIN)THEN                                               INMENU     29
        WRITE(LOUT,'(/,18X,A,/)')                                       INMENU     30
     +       '-> PRESS <RETURN> TO CONTINUE <-'                         INMENU     31
        READ(LIN,'(A)')CH                                               INMENU     32
      ENDIF                                                             INMENU     33
C                                                                       INMENU     34
 90   LHELP=.FALSE.                                                     INMENU     35
C                                                                       INMENU     36
C    Display menu option on screen                                      INMENU     37
C                                                                       INMENU     38
      WRITE(LOUT,5010)                                                  INMENU     39
 5010 FORMAT(//,                                                        INMENU     40
     *1X,79('.'),/,                                                     INMENU     41
     *9X,'                      MENU MODE                      ',/,     INMENU     42
     *9X,'                     -----------                     ',/,     INMENU     43
     *9X,'  Select by number or type in command with parameter.',/,     INMENU     44
     *9X,'  To get help on specific command, type HELP=COMMAND ',/,     INMENU     45
     *9X,'  or HELP=option number',//)                                  INMENU     46
      WRITE(LOUT,5000)(I,KEYW(I),I=1,INSTAL)                            INMENU     47
 5000 FORMAT((5(' (',I2,') ',A8,:)))                                    INMENU     48
      IF(OPENED) THEN                                                   INMENU     49
         WRITE(LOUT,5030)CHNLFI(1:55)                                   INMENU     50
 5030    FORMAT(//,1X, 'Active Channel File : ',A55)                    INMENU     51
         IF(FILLED)THEN                                                 INMENU     52
           WRITE(LOUT,'(A)')' (Buffer FILLED)'                          INMENU     53
         ELSE                                                           INMENU     54
           WRITE(LOUT,'(A)')' (Buffer EMPTY)'                           INMENU     55
         ENDIF                                                          INMENU     56
      ELSE                                                              INMENU     57
         WRITE(LOUT,'(//,A)')' (No Channel File Active)'                INMENU     58
         WRITE(LOUT,'(A)') ' '                                          INMENU     59
      ENDIF                                                             INMENU     60
C                                                                       INMENU     61
      WRITE(LOUT,5020)                                                  INMENU     62
 5020 FORMAT(/,1X,79('.'),//)                                           INMENU     63
C                                                                       INMENU     64
C    Get selection from the user                                        INMENU     65
C                                                                       INMENU     66
      MSG='Menu mode is active. Select by number or type command '      INMENU     67
      CALL PMTRED(LOUT,LIN,JERR,54,MSG,'MEN',STRING)                    INMENU     68
C                                                                       INMENU     69
      IK=IFNBLK(STRING,79)                                              INMENU     70
      IF(IK.EQ.0)GOTO 90                                                INMENU     71
      CHRBUF=STRING(IK:80)                                              INMENU     72
      STRING=CHRBUF                                                     INMENU     73
C                                                                       INMENU     74
C    If ?# check help number and create parameter. let command          INMENU     75
C    mode handle it.                                                    INMENU     76
C                                                                       INMENU     77
      IF (STRING(1:1).EQ.'H') THEN                                      INMENU     78
         LHELP=.TRUE.                                                   INMENU     79
         IE=INDEX(STRING,'=')+1                                         INMENU     80
         IF(IE.EQ.1) IE=INDEX(STRING,' ')+1                             INMENU     81
C                                                                       INMENU     82
         DO 100 II=1,9                                                  INMENU     83
           IF(STRING(IE:IE).EQ.AA(II))GOTO 110                          INMENU     84
 100     CONTINUE                                                       INMENU     85
         GOTO 9999                                                      INMENU     86
C                                                                       INMENU     87
 110     READ(STRING(IE:80),*,IOSTAT=IOS) IH                            INMENU     88
         IF(IOS.NE.0)GOTO 9999                                          INMENU     89
         IF((IH.GT.0).AND.(IH.LE.INSTAL))THEN                           INMENU     90
            WRITE(STRING,'(A5,A8)')'HELP=',KEYW(IH)                     INMENU     91
            WRITE(LOUT,'(//)')                                          INMENU     92
            GOTO 9999                                                   INMENU     93
         ELSE                                                           INMENU     94
            LHELP=.FALSE.                                               INMENU     95
            WRITE(LOUT,9000)                                            INMENU     96
            GOTO 1                                                      INMENU     97
         ENDIF                                                          INMENU     98
      ENDIF                                                             INMENU     99
C    :..........................................................:       INMENU    100
      DO 125 I=1,9                                                      INMENU    101
       IF (STRING(1:1).EQ.AA(I)) GOTO 130                               INMENU    102
 125  CONTINUE                                                          INMENU    103
      GOTO 9999                                                         INMENU    104
C                                                                       INMENU    105
 130  CONTINUE                                                          INMENU    106
C                                                                       INMENU    107
      READ(STRING,*,IOSTAT=IOS)II                                       INMENU    108
      IF (IOS.NE.0) GOTO 9999                                           INMENU    109
      IF (II.EQ.17) LHELP=.TRUE.                                        INMENU    110
      IF((II.LT.1).OR.(II.GT.INSTAL))THEN                               INMENU    111
        WRITE(LOUT,9000)                                                INMENU    112
        GOTO 1                                                          INMENU    113
      ENDIF                                                             INMENU    114
C                                                                       INMENU    115
C    FOR FUNCTION MODE                                                  INMENU    116
C                                                                       INMENU    117
      IF(II.EQ.7)THEN                                                   INMENU    118
 140    WRITE(LOUT,5040)                                                INMENU    119
 5040   FORMAT(//,                                                      INMENU    120
     1  1X,79('.'),/,                                                   INMENU    121
     2  9X,'                   LIST OF FUNCTION                  ',/,   INMENU    122
     3  9X,'                   ----------------                  ',///, INMENU    123
     4  4X,' 1. (CALC) ARITHMETRIC FUNCTIONS',/,                        INMENU    124
     5  4X,' 2. (LSF)  LEAST SQUARES FIT',/,                            INMENU    125
     6  4X,' 3. (ENV)  ENVELOPE, TREND, PEAK TO PEAK ANALYSIS',/,       INMENU    126
     7  4X,' 4. (RLY)  RELAY ANALYSIS',//)                              INMENU    127
        MSG='Enter option number '                                      INMENU    128
        CALL PMTRED(LOUT,LIN,JERR,22,MSG,'MEN',STRING)                  INMENU    129
        READ(STRING,*,IOSTAT=IOS)IJ                                     INMENU    130
        IF(IOS.NE.0) GOTO 9999                                          INMENU    131
        IF(IJ.LT.1.OR.IJ.GT.4)THEN                                      INMENU    132
          WRITE(LOUT,9000)                                              INMENU    133
          GOTO 140                                                      INMENU    134
        ELSE                                                            INMENU    135
          WRITE(STRING,'(A)')KEYW(7)(1:3)//'='//FUNCT(IJ)               INMENU    136
        ENDIF                                                           INMENU    137
      ELSE                                                              INMENU    138
        WRITE(STRING,'(A)')KEYW(II)                                     INMENU    139
      ENDIF                                                             INMENU    140
C                                                                       INMENU    141
 9999 RETURN                                                            INMENU    142
C                                                                       INMENU    143
 9000 FORMAT(//,'Selection is out of range',//)                         INMENU    144
      END                                                               INMENU    145
