CFPRIME SOAP                                                            SOAP        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                                                                       SOAP        3
      PROGRAM SOAP                                                      SOAP        4
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSOAP        5
CD                                                                      SOAP        6
CD          THIS ROUTINE IS THE MAIN DRIVER FOR THE OUTPUT              SOAP        7
CD          ANALYSIS PROGRAM FOR ETMSP                                  SOAP        8
CD                                                                      SOAP        9
CD          ROUTINES CALLED :                                           SOAP       10
CD                                                                      SOAP       11
CD                 BANNER - To print out a title page of OAP            SOAP       12
CD                 INUSER - Get command from input device               SOAP       13
CD                 INMENU - Get command from menu selection routines.   SOAP       14
CD                   LENS - Determines the number of characters         SOAP       15
CD                          in an input command                         SOAP       16
CD                   CMMD - Check for valid command and returns         SOAP       17
CD                          a conresponding command number              SOAP       18
CD                  GOTOS - Based on command number, directs program    SOAP       19
CD                          controls to other program modules           SOAP       20
CD                                                                      SOAP       21
C-----------------------------------------------------------------------SOAP       22
C UPDATES :                                                             SOAP       23
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSOAP       24
C                                                                       SOAP       25
      CHARACTER*80 COMMD                                                SOAP       26
      CHARACTER*50 PARAM                                                SOAP       27
      LOGICAL LIDBOT                                                    SOAP       28
      COMMON /F99/ LIDBOT                                               SOAP       29
      INCLUDE 'PARAM.INS'                                               SOAP       30
      INCLUDE 'SOAPC1.INS'                                              SOAP       31
      INCLUDE 'XYARAY.INS'                                              SOAP       32
*IF WSX11                                                               SOAP       33
      INCLUDE 'STRTUP.INS'                                              SOAP       34
*ENDIF                                                                  SOAP       35
C                                                                       SOAP       36
      ICFRUN=0                                                          SOAP       37
C                                                                       SOAP       38
      CALL BANNER                                                       SOAP       39
*IF WSX11                                                               SOAP       40
#ifdef VMS                                                              SOAP       41
      HOMEDIR = 'sys$login'                                             SOAP       42
#else                                                                   SOAP       43
       CALL GETENV('HOME',HOMEDIR)                                      SOAP       44
#endif                                                                  SOAP       45
      CALL GETINI                                                       SOAP       46
*ENDIF                                                                  SOAP       47
      JEND=0                                                            SOAP       48
C   ..................................                                  SOAP       49
C   : MAIN LOOP OF PROGRAM           :                                  SOAP       50
 1    CONTINUE                                                          SOAP       51
C      ...............................                                  SOAP       52
C      : Abnormal ending of program  :                                  SOAP       53
C      :                             :                                  SOAP       54
        JEND=JEND+1                                                     SOAP       55
        IF(JEND.GT.5) THEN                                              SOAP       56
            WRITE(LOUT,1210)                                            SOAP       57
            GOTO 9999                                                   SOAP       58
        ENDIF                                                           SOAP       59
C      :.............................:                                  SOAP       60
        COMMD=' '                                                       SOAP       61
        ISTAT=0                                                         SOAP       62
        IF(MENUM) THEN                                                  SOAP       63
           CALL INMENU(COMMD,ISTAT)                                     SOAP       64
        ELSE                                                            SOAP       65
           CALL INUSER(COMMD,ISTAT,ICFRUN)                              SOAP       66
           IF(ICFRUN.EQ.1)THEN                                          SOAP       67
             ICFRUN=-1                                                  SOAP       68
             ICM=6                                                      SOAP       69
             GOTO 1000                                                  SOAP       70
           ENDIF                                                        SOAP       71
        ENDIF                                                           SOAP       72
        IF(ISTAT.EQ.-1) GOTO 1                                          SOAP       73
        LENSTR=LENS(COMMD)                                              SOAP       74
        IF(LENSTR.LE.2) GOTO 1                                          SOAP       75
        CALL CMMD(COMMD,LENSTR,PARAM,LENPAR,ICM)                        SOAP       76
        IF(ICM.EQ.-1) GOTO 1                                            SOAP       77
 1000   CALL GOTOS(ICM,COMMD,PARAM,LENPAR,IGOTO)                        SOAP       78
        ICFRUN=-1                                                       SOAP       79
        IF(IGOTO.EQ.1) GOTO 9999                                        SOAP       80
        JEND=0                                                          SOAP       81
      GOTO 1                                                            SOAP       82
C    :...............................:                                  SOAP       83
                                                                        SOAP       84
C    ....................................                               SOAP       85
C    : NORMAL END OF PROGRAM.  CLEAN UP :                               SOAP       86
C    :..................................:                               SOAP       87
 9999 CONTINUE                                                          SOAP       88
      IF(RECORD) CLOSE (IREC)                                           SOAP       89
      IF(LIDBOT) CLOSE(99)                                              SOAP       90
      WRITE(LOUT,5000)                                                  SOAP       91
 5000 FORMAT(//,                                                        SOAP       92
     1  10X,'......................................',/,                 SOAP       93
     1  10X,':  -- ITOAP NORMAL  TERMINATION --   :',/,                 SOAP       94
     1  10X,':....................................:',//)                SOAP       95
 1210 FORMAT(//,'### TOO MANY INVALID COMMANDS ###',///)                SOAP       96
      END                                                               SOAP       97
C                                                                       SOAP       98
      BLOCK DATA ALLDAT                                                 SOAP       99
CD                                                                      SOAP      100
CD             THIS ROUTINE INITIALIZES THE VARIABLES AND ARRAYS IN     SOAP      101
CD             THE LABELLED COMMON BLOCK.                               SOAP      102
CD                                                                      SOAP      103
CD             NOTE: When adding more commands, update variable         SOAP      104
CD                   "INSTAL" to show the total number of               SOAP      105
CD                   commands available.                                SOAP      106
CD                                                                      SOAP      107
      INCLUDE 'PARAM.INS'                                               SOAP      108
      INCLUDE 'SOAPC1.INS'                                              SOAP      109
      INCLUDE 'XYARAY.INS'                                              SOAP      110
      INCLUDE 'GTIT.INS'                                                SOAP      111
      INCLUDE 'DBFLG.INS'                                               SOAP      112
C ..  (in GOTOS,ALLDAT,BUSNUM)                                          SOAP      113
      COMMON /LABFLG/ NUMFLG                                            SOAP      114
      COMMON /RFNAME/ RNAME,LRNAME                                      SOAP      115
      CHARACTER*80 RNAME                                                SOAP      116
C ..                                                                    SOAP      117
      LOGICAL LIDBOT                                                    SOAP      118
      COMMON /F99/ LIDBOT                                               SOAP      119
      COMMON /KEYWOD/ INSTAL,KEYW                                       SOAP      120
      CHARACTER*8 KEYW(40)                                              SOAP      121
*IF LAHEY                                                               SOAP      122
*ENDIF                                                                  SOAP      140
      DATA LIDBOT /.FALSE./                                             SOAP      141
      DATA KEYW                                                         SOAP      142
     1 /'ALRELAY ',  'DELCHNL ',  'DPCLEAR ',  'DPDEVICE',  'DPPLOT  ', SOAP      143
     2  '        ',  'FUNCTION',  'G3D     ',  'GMC3D   ',  'GETCHNL ', SOAP      144
     3  'GP3D    ',  'GPCLOSE ',  'GPDEVICE',  'GPNEXT  ',  'GPPLOT  ', SOAP      145
     4  '        ',  'HELP    ',  'LISTDATA',  'MENU    ',  'MSAVE   ', SOAP      146
     5  'NAME    ',  'NUMBER  ',  'OPASCII ',  'OPENCASE',  'PLAYBACK', SOAP      147
     6  'QUIT    ',  'RDASCII ',  'RECORD  ',  'RELATIVE',  'RESTORE ', SOAP      148
     7  'SAVE    ',  'SPECTRUM',  'STOPREC ',  'TITLE   ',  'LIMITS  ', SOAP      149
     8  'VMSDCL  ',  'BSAVE   ',  'ABSOLUTE',  '        ',  '        '/ SOAP      150
C                                                                       SOAP      151
      DATA RECORD,OPEN1,OPENED,PLAYBA /.FALSE.,.FALSE.,.FALSE.,.FALSE./ SOAP      152
      DATA FILLED,DPINIT,SCALX,GPINIT /.FALSE.,.FALSE.,.TRUE.,.FALSE./  SOAP      153
      DATA GPPLOT,MENUM,USCALE,DPPLOT /.FALSE.,.FALSE.,.FALSE.,.FALSE./ SOAP      154
      DATA SSCALE,RELATE,GINIT,PINT /.FALSE.,.FALSE.,.FALSE.,.FALSE./   SOAP      155
      DATA WFLAG,WFLAG2,GPINI2,LHELP /.FALSE.,.FALSE.,.FALSE.,.FALSE./  SOAP      156
      DATA GSCALE/.FALSE./                                              SOAP      157
      DATA PROMPT /' ITOAP '/                                           SOAP      158
      DATA INSTAL /38/                                                  SOAP      159
      DATA KCH /MCHNL*0/                                                SOAP      160
*IF -OPRIME                                                             SOAP      161
      DATA LIN,LOUT,ICHNL,IREC,IREL,LU55,ISAVE,IPPLOT,LPIN,IOU          SOAP      162
     1    /5   ,6   ,17   ,20  ,33 ,  55,  9 ,   22,  5, 0/             SOAP      163
*ENDIF                                                                  SOAP      164
*IF OPRIME                                                              SOAP      165
*ENDIF                                                                  SOAP      168
      DATA NUMFLG/0/,KLFO/0/                                            SOAP      169
C                                                                       SOAP      170
*IF WSDEC                                                               SOAP      171
*ENDIF                                                                  SOAP      173
*IF VAX                                                                 SOAP      174
*ENDIF                                                                  SOAP      176
C                                                                       SOAP      177
      DATA DBNAME                                                       SOAP      178
     1/'RDHEAD',   'RDREC9',   'GETCHN',   'REMASS',   'RECFLD',        SOAP      179
     1 'FUNCTN',   'GOTOS ',   'PARSPA',   'PARSIN',   'FNTMIX',        SOAP      180
     1 'SAVEIT',   'IHWR  ',   'SPECT1',   'MAXANA',   'MINANA',        SOAP      181
     1 'FNTPOL',   'RESTOR',   '      ',   '      ',   '      ',        SOAP      182
     1 '      ',   '      ',   '      ',   '      ',   '      ',        SOAP      183
     1 '      ',   '      ',   '      ',   '      ',   '      ',        SOAP      184
     1 '      ',   '      ',   '      ',   '      ',   '      ',        SOAP      185
     1 '      ',   '      ',   '      ',   '      ',   '      '/        SOAP      186
      DATA DEBUG                                                        SOAP      187
     1/.FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      188
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      189
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      190
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      191
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      192
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      193
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE.,                         SOAP      194
     1 .FALSE.,.FALSE.,.FALSE.,.FALSE.,.FALSE./                         SOAP      195
      DATA IDBOUT/99/                                                   SOAP      196
C                                                                       SOAP      197
      DATA PTITLE/' ',' ',' ',' ',' ',' '/                              SOAP      198
      DATA FILCHN/' ',' ',' ',' ',' ',' '/                              SOAP      199
      DATA FTITLE/' '/                                                  SOAP      200
      DATA XTITLE/'TIME IN SECONDS'/                                    SOAP      201
      DATA YTITLE/' ',' ',' ',' ',' ',' '/                              SOAP      202
      DATA CTITLE/' ',' ',' ',' ',' ',' '/                              SOAP      203
      DATA CTITL2/' ',' ',' ',' ',' ',' '/                              SOAP      204
      DATA LTITLE/' ',' ',' ',' ',' ',' '/                              SOAP      205
      DATA LTITL2/' ',' ',' ',' ',' ',' '/                              SOAP      206
      DATA CASEID/' ',' ',' ',' ',' ',' '/                              SOAP      207
*IF LAHEY                                                               SOAP      208
*ENDIF                                                                  SOAP      215
      INCLUDE 'GTIT1.INS'                                               SOAP      216
      INCLUDE 'CHDISP.INS'                                              SOAP      217
      DATA IPLTYP /0/                                                   SOAP      218
      DATA CFLRUN /.FALSE./                                             SOAP      219
      END                                                               SOAP      220
                                                                        SOAP      221
C                                                                       SOAP      222
      INTEGER FUNCTION LENS(STRING)                                     SOAP      223
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSOAP      224
CD                                                                      SOAP      225
CD          THIS FUNCTION ROUTINE DETERMINES THE  LENGTH OF USER COMMANDSOAP      226
CD                                                                      SOAP      227
CD          CALLING PARAMETER :                                         SOAP      228
CD                                                                      SOAP      229
CD                     STRING - CHARACTER STRING CONTAINING THE COMMAND SOAP      230
CD                                                                      SOAP      231
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSOAP      232
      INCLUDE 'PARAM.INS'                                               SOAP      233
      INCLUDE 'SOAPC1.INS'                                              SOAP      234
C      CHARACTER*80 STRING                                              SOAP      235
      CHARACTER*(*) STRING                                              SOAP      236
C   .............................................                       SOAP      237
C   : IGNORE EVERYTHING AFTER THE '?' CHARACTER :                       SOAP      238
C   :                                           :                       SOAP      239
      LSEMIC=INDEX(STRING,'?')                                          SOAP      240
      IF(LSEMIC.EQ.0) LSEMIC=81                                         SOAP      241
      DO 100 I=LSEMIC-1,1,-1                                            SOAP      242
         IF(STRING(I:I).NE.' ') GOTO 200                                SOAP      243
 100  CONTINUE                                                          SOAP      244
C   :............................................:                      SOAP      245
 200  CONTINUE                                                          SOAP      246
      LENS=I                                                            SOAP      247
C      IF(LENS.LE.2) WRITE(LOUT,5000)                                   SOAP      248
C 5000 FORMAT(/,                                                        SOAP      249
C     1  10X,'*******************************************',/,           SOAP      250
C     1  10X,'* COMMANDS REQUIRED AT LEAST 3 CHARACTERS *',/,           SOAP      251
C     1  10X,'*   TYPE "HELP" FOR MORE INFORMATION.     *',/,           SOAP      252
C     1  10X,'*******************************************',/)           SOAP      253
      RETURN                                                            SOAP      254
      END                                                               SOAP      255
                                                                        SOAP      256
      CHARACTER*1 FUNCTION QQ(LIN,LOUT)                                 SOAP      257
CD                                                                      SOAP      258
CD        THIS FUNCTION DETERMINES THE KEYWORD OF THE INCOMING          SOAP      259
CD        COMMANDS (QUIT OR CONTINUE)                                   SOAP      260
CD                                                                      SOAP      261
CD        CALLING PARAMETERS :                                          SOAP      262
CD                                                                      SOAP      263
CD                      LIN  - LOGICAL UNIT FOR THE INPUT               SOAP      264
CD                      LOUT - LOGICAL UNIT FOR THE OUTPUT              SOAP      265
CD                                                                      SOAP      266
      CHARACTER*80 MSG                                                  SOAP      267
      CHARACTER*80 QQ80,CHRBUF                                          SOAP      268
      COMMON /QQQQ/ QQ80                                                SOAP      269
      QQ=' '                                                            SOAP      270
      MSG='"Q" TO QUIT LISTING , <RETURN> TO CONTINUE '                 SOAP      271
      CALL SCRPMT(LOUT,MSG,43)                                          SOAP      272
      READ(LIN,1023,IOSTAT=IOS)QQ80                                     SOAP      273
      IF(IOS.NE.0) RETURN                                               SOAP      274
      IK=IFNBLK(QQ80,79)                                                SOAP      275
      IF(IK.EQ.0)RETURN                                                 SOAP      276
      CHRBUF=QQ80(IK:80)                                                SOAP      277
      QQ80=CHRBUF                                                       SOAP      278
      IF(QQ80(1:1).EQ.'q'.OR.QQ80(1:1).EQ.'Q')QQ='Q'                    SOAP      279
 1023 FORMAT(A)                                                         SOAP      280
      RETURN                                                            SOAP      281
      END                                                               SOAP      282
C                                                                       SOAP      283
      SUBROUTINE UNPACK(CKT,JR,JFIN)                                    SOAP      284
*IF -PRIME                                                              SOAP      285
*IF -MIBM                                                               SOAP      286
      CHARACTER*2 CKT                                                   SOAP      287
      CHARACTER*4 RCKT                                                  SOAP      288
C                                                                       SOAP      289
      EQUIVALENCE (RCKT,JRCKT)                                          SOAP      290
C                                                                       SOAP      291
      DATA I16B/65536/                                                  SOAP      292
C                                                                       SOAP      293
      JRCKT=JFIN/I16B                                                   SOAP      294
      JR=MOD(JFIN,I16B)                                                 SOAP      295
      CKT(1:2)=RCKT(1:2)                                                SOAP      296
*IF -DIGITAL                                                            SOAP      297
      CKT(1:2)=RCKT(3:4)                                                SOAP      298
*ENDIF                                                                  SOAP      299
*ENDIF                                                                  SOAP      300
*IF MIBM                                                                SOAP      301
*ENDIF                                                                  SOAP      309
*ENDIF                                                                  SOAP      310
*IF PRIME                                                               SOAP      311
*ENDIF                                                                  SOAP      312
C                                                                       SOAP      313
      RETURN                                                            SOAP      314
      END                                                               SOAP      315
C                                                                       SOAP      316
      SUBROUTINE UPACKI(J1,J2,JFIN)                                     SOAP      317
C                                                                       SOAP      318
      DATA I16B/65536/                                                  SOAP      319
C                                                                       SOAP      320
      J1=MOD(JFIN,I16B)                                                 SOAP      321
      J2=JFIN/I16B                                                      SOAP      322
C                                                                       SOAP      323
      RETURN                                                            SOAP      324
      END                                                               SOAP      325
      INTEGER FUNCTION IFNBLK(STRING,LL)                                SOAP      326
CD                                                                      SOAP      327
CD    TO DETERMINE THE FIRST NON-BLANK OF A CHARACTER STRING.           SOAP      328
CD                                                                      SOAP      329
      CHARACTER*(*) STRING                                              SOAP      330
C                                                                       SOAP      331
      DO 100 IFNBLK=1,LL+1                                              SOAP      332
        IF(STRING(IFNBLK:IFNBLK).NE.' ') RETURN                         SOAP      333
 100  CONTINUE                                                          SOAP      334
      IFNBLK=0                                                          SOAP      335
      RETURN                                                            SOAP      336
      END                                                               SOAP      337
