CFPRIME FILRUN                                                          FILRUN      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                                                                       FILRUN      3
      SUBROUTINE FILRUN                                                 FILRUN      4
CD                                                                      FILRUN      5
CD    THIS SUBROUTINE READS IN THE INFORMATION FROM A CONTROL FILE      FILRUN      6
CD    AND TRANSLATES IT INTO A RECORD FILE.                             FILRUN      7
CD                                                                      FILRUN      8
CD    THEN, IT REWINDS THE RECORD FILE AND TRANSFERS CONTROL BACK TO    FILRUN      9
CD    GOTOS TO EXCEXUTE OAP IN PLAY BACK MODE.                          FILRUN     10
CD                                                                      FILRUN     11
C---------------------------------------------------------------------  FILRUN     12
C                                                        Include files  FILRUN     13
C                                                                       FILRUN     14
      INCLUDE 'SOAPC1.INS'                                              FILRUN     15
      INCLUDE 'CHDISP.INS'                                              FILRUN     16
C---------------------------------------------------------------------  FILRUN     17
C                                                      Local variables  FILRUN     18
C                                                                       FILRUN     19
      LOGICAL LCASE,TITFLG(14),TPLOT,XPLOT,CHGTIT,CALPLT,FIRMSV,        FILRUN     20
     +        SAVFLG                                                    FILRUN     21
C                                                                       FILRUN     22
      CHARACTER*1  SCATYP                                               FILRUN     23
      CHARACTER*20 BLNK20                                               FILRUN     24
      CHARACTER*30 RNGE(9)                                              FILRUN     25
      CHARACTER*50 FILNAM,SAVFIL                                        FILRUN     26
      CHARACTER*80 CARD,MSG,CHRBUF,BLNK80,TITLES(14),STRING             FILRUN     27
*IF -WSX11                                                              FILRUN     28
*ENDIF                                                                  FILRUN     30
*IF WSX11                                                               FILRUN     31
      LOGICAL ASKPS,EMPTY                                               FILRUN     32
      CHARACTER*20 PRTNAM                                               FILRUN     33
      CHARACTER*50 PSFILE                                               FILRUN     34
*ENDIF                                                                  FILRUN     35
C---------------------------------------------------------------------  FILRUN     36
C                                                       Initialization  FILRUN     37
C                                                                       FILRUN     38
      BLNK20='                    '                                     FILRUN     39
      BLNK80=BLNK20//BLNK20//BLNK20//BLNK20                             FILRUN     40
C                                                                       FILRUN     41
      LCASE=.FALSE.                                                     FILRUN     42
      FIRMSV=.TRUE.                                                     FILRUN     43
      SAVFLG=.FALSE.                                                    FILRUN     44
*IF -WSX11                                                              FILRUN     45
*ENDIF                                                                  FILRUN     47
C                                                                       FILRUN     48
*IF WSX11                                                               FILRUN     49
      ASKPS=.TRUE.                                                      FILRUN     50
      EMPTY=.TRUE.                                                      FILRUN     51
      PSFILE='psoap.001'                                                FILRUN     52
      PRTNAM='amssps1'                                                  FILRUN     53
      NPPAGE=1                                                          FILRUN     54
      NPP=1                                                             FILRUN     55
*ENDIF                                                                  FILRUN     56
C---------------------------------------------------------------------  FILRUN     57
C                    Prompt for name of control file and open the file  FILRUN     58
C                                                                       FILRUN     59
      MSG='Enter Control File Name (Q to quit): '                       FILRUN     60
  100 CALL PMTRED (LOUT,LIN,JERR,37,MSG,'FIL',STRING)                   FILRUN     61
      IF(JERR.LT.0)GOTO 100                                             FILRUN     62
      IK=IFNBLK(STRING,79)                                              FILRUN     63
      CHRBUF=STRING(IK:80)                                              FILRUN     64
      STRING=CHRBUF                                                     FILRUN     65
      IF(STRING(1:2).EQ.'Q '.OR.STRING(1:2).EQ.'q ')GOTO 9999           FILRUN     66
      IF(STRING(1:1).EQ.'*')THEN                                        FILRUN     67
        IU44=LIN                                                        FILRUN     68
      ELSE                                                              FILRUN     69
        IU44=44                                                         FILRUN     70
        LENFIL=LENS(STRING)                                             FILRUN     71
        CALL OPENFI(IU44,STRING,LENFIL,IERR,'OLD',1)                    FILRUN     72
        IF(IERR.LT.0) THEN                                              FILRUN     73
          WRITE(LOUT,7000)                                              FILRUN     74
          GOTO 100                                                      FILRUN     75
        ENDIF                                                           FILRUN     76
      ENDIF                                                             FILRUN     77
C                                 Open record file with status=scratch  FILRUN     78
      IUR=42                                                            FILRUN     79
      OPEN(IUR,STATUS='SCRATCH')                                        FILRUN     80
C---------------------------------------------------------------------  FILRUN     81
C                                              Get name of binary file  FILRUN     82
C                                                                       FILRUN     83
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN     84
      IF(CARD(1:8).NE.'[RESULT]')THEN                                   FILRUN     85
        WRITE(LOUT,7020)                                                FILRUN     86
        GOTO 9900                                                       FILRUN     87
      ELSE                                                              FILRUN     88
        CALL GETLIN(IU44,CARD,*9880)                                    FILRUN     89
        IK=INDEX(CARD,'=')                                              FILRUN     90
        IF(IK.EQ.0)GOTO 400                                             FILRUN     91
        STRING=CARD(IK+1:80)                                            FILRUN     92
        CALL FSTLST(STRING,80,IFCHR,ILCHR)                              FILRUN     93
        IF(IFCHR.EQ.0)GOTO 400                                          FILRUN     94
        IF((ILCHR-IFCHR+1).GT.46)GOTO 400                               FILRUN     95
        FILNAM=STRING(IFCHR:ILCHR)                                      FILRUN     96
        DO 300 II=1,46                                                  FILRUN     97
          IF(FILNAM(II:II).GE.'A'.AND.FILNAM(II:II).LE.'Z')THEN         FILRUN     98
            LCASE=.FALSE.                                               FILRUN     99
            GOTO 350                                                    FILRUN    100
          ELSEIF(FILNAM(II:II).GE.'a'.AND.FILNAM(II:II).LE.'z')THEN     FILRUN    101
            LCASE=.TRUE.                                                FILRUN    102
            GOTO 350                                                    FILRUN    103
          ENDIF                                                         FILRUN    104
  300   CONTINUE                                                        FILRUN    105
      ENDIF                                                             FILRUN    106
C                                                                       FILRUN    107
  350 II=INDEX(FILNAM,' ')                                              FILRUN    108
      IF(LCASE)THEN                                                     FILRUN    109
        FILNAM(II:II+3)='.bin'                                          FILRUN    110
      ELSE                                                              FILRUN    111
        FILNAM(II:II+3)='.BIN'                                          FILRUN    112
      ENDIF                                                             FILRUN    113
      WRITE(IUR,'(A)')'OPE='//FILNAM                                    FILRUN    114
      GOTO 500                                                          FILRUN    115
C                               Improper specification of result files  FILRUN    116
  400 WRITE(LOUT,7040)                                                  FILRUN    117
      GOTO 9900                                                         FILRUN    118
C---------------------------------------------------------------------  FILRUN    119
C                                  Filter the control file as required  FILRUN    120
C                                                                       FILRUN    121
  500 CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    122
C                                                                       FILRUN    123
  600 IF(CARD(1:10).EQ.'[ANALYSIS]')GOTO 1000                           FILRUN    124
      IF(CARD(1:5).NE.'[END]')GOTO 500                                  FILRUN    125
C                                                                       FILRUN    126
      WRITE(IUR,'(A)')'QUIT'                                            FILRUN    127
C                                                                       FILRUN    128
*IF -WSX11                                                              FILRUN    129
*ENDIF                                                                  FILRUN    131
*IF WSX11                                                               FILRUN    132
      WRITE(IUR,'(A)')'1'                                               FILRUN    133
      WRITE(IUR,'(A)')'4'                                               FILRUN    134
      WRITE(IUR,'(A)')PRTNAM                                            FILRUN    135
      WRITE(IUR,'(A)')'1'                                               FILRUN    136
*ENDIF                                                                  FILRUN    137
C                                                                       FILRUN    138
      REWIND(IUR)                                                       FILRUN    139
      LIN=IUR                                                           FILRUN    140
      CFLRUN=.TRUE.                                                     FILRUN    141
      GOTO 9999                                                         FILRUN    142
C---------------------------------------------------------------------  FILRUN    143
C                                Process control file commands for OAP  FILRUN    144
C                                                                       FILRUN    145
 1000 CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    146
 1010 IF(CARD(1:1).EQ.'[')GOTO 600                                      FILRUN    147
C                                                                       FILRUN    148
      IF(CARD(1:6).EQ.'INPFIL')GOTO 1100                                FILRUN    149
*IF -WSX11                                                              FILRUN    150
*ENDIF                                                                  FILRUN    152
*IF WSX11                                                               FILRUN    153
      IF(CARD(1:6).EQ.'PSPECS')GOTO 1200                                FILRUN    154
*ENDIF                                                                  FILRUN    155
      IF(CARD(1:6).EQ.'*MSAVE')GOTO 1300                                FILRUN    156
      IF(CARD(1:8).EQ.'SPECTRUM')GOTO 1400                              FILRUN    157
      IF(CARD(1:8).EQ.'ENVELOPE')GOTO 1500                              FILRUN    158
      IF(CARD(1:5).EQ.'TREND')GOTO 1500                                 FILRUN    159
      IF(CARD(1:5).EQ.'*PLOT')GOTO 2000                                 FILRUN    160
C                                                                       FILRUN    161
      GOTO 9800                                                         FILRUN    162
C---------------------------------------------------------------------  FILRUN    163
C                                                             OPENCASE  FILRUN    164
C     INPFIL = BPA1.BIN                                                 FILRUN    165
C                                                                       FILRUN    166
 1100 IK=INDEX(CARD,'=')                                                FILRUN    167
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    168
      STRING=CARD(IK+1:80)                                              FILRUN    169
      CALL FSTLST(STRING,80,IFCHR,ILCHR)                                FILRUN    170
      IF(IFCHR.EQ.0)GOTO 9800                                           FILRUN    171
      IF((ILCHR-IFCHR+1).GT.50)GOTO 9800                                FILRUN    172
      FILNAM=STRING(IFCHR:ILCHR)                                        FILRUN    173
C                                                                       FILRUN    174
      WRITE(IUR,'(A)')'OPE='//FILNAM                                    FILRUN    175
      GOTO 1000                                                         FILRUN    176
*IF WSX11                                                               FILRUN    177
C---------------------------------------------------------------------  FILRUN    178
C                                            POSTSCRIPT SPECIFICATIONS  FILRUN    179
C                                                                       FILRUN    180
C     PSPECS = PS_FILE  PRINTER_NAME  NUMBER_OF_PLOTS_PER_PAGE          FILRUN    181
C                                                                       FILRUN    182
 1200 WRITE(IUR,'(A)')'GPC'                                             FILRUN    183
      ASKPS=.TRUE.                                                      FILRUN    184
      IF(.NOT.EMPTY)THEN                                                FILRUN    185
        WRITE(IUR,'(A)')'1'                                             FILRUN    186
        WRITE(IUR,'(A)')'4'                                             FILRUN    187
        WRITE(IUR,'(A)')PRTNAM                                          FILRUN    188
        WRITE(IUR,'(A)')'1'                                             FILRUN    189
        EMPTY=.TRUE.                                                    FILRUN    190
      ENDIF                                                             FILRUN    191
C                                                                       FILRUN    192
      IK=INDEX(CARD,'=')                                                FILRUN    193
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    194
      STRING=CARD(IK+1:80)                                              FILRUN    195
C                                                     Get PS file name  FILRUN    196
      IK=IFNBLK(STRING,79)                                              FILRUN    197
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    198
      STRING=STRING(IK:80)                                              FILRUN    199
      IKB=INDEX(STRING,' ')                                             FILRUN    200
      IKC=INDEX(STRING,',')                                             FILRUN    201
      IF(IKB.EQ.0)THEN                                                  FILRUN    202
        IK=IKC                                                          FILRUN    203
      ELSEIF(IKC.EQ.0)THEN                                              FILRUN    204
        IK=IKB                                                          FILRUN    205
      ELSEIF(IKB.GT.IKC)THEN                                            FILRUN    206
        IK=IKC                                                          FILRUN    207
      ELSE                                                              FILRUN    208
        IK=IKB                                                          FILRUN    209
      ENDIF                                                             FILRUN    210
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    211
      IF(IK.GT.50)THEN                                                  FILRUN    212
        PSFILE=STRING(1:50)                                             FILRUN    213
      ELSE                                                              FILRUN    214
        PSFILE=STRING(1:IK-1)                                           FILRUN    215
      ENDIF                                                             FILRUN    216
      STRING=STRING(IK+1:80)                                            FILRUN    217
C                                                     Get printer name  FILRUN    218
      IK=IFNBLK(STRING,79)                                              FILRUN    219
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    220
      STRING=STRING(IK:80)                                              FILRUN    221
      IKB=INDEX(STRING,' ')                                             FILRUN    222
      IKC=INDEX(STRING,',')                                             FILRUN    223
      IF(IKB.EQ.0)THEN                                                  FILRUN    224
        IK=IKC                                                          FILRUN    225
      ELSEIF(IKC.EQ.0)THEN                                              FILRUN    226
        IK=IKB                                                          FILRUN    227
      ELSEIF(IKB.GT.IKC)THEN                                            FILRUN    228
        IK=IKC                                                          FILRUN    229
      ELSE                                                              FILRUN    230
        IK=IKB                                                          FILRUN    231
      ENDIF                                                             FILRUN    232
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    233
      IF(IK.GT.20)THEN                                                  FILRUN    234
        PRTNAM=STRING(1:20)                                             FILRUN    235
      ELSE                                                              FILRUN    236
        PRTNAM=STRING(1:IK-1)                                           FILRUN    237
      ENDIF                                                             FILRUN    238
      STRING=STRING(IK+1:80)                                            FILRUN    239
C                                         Get number of plots per page  FILRUN    240
      READ(STRING,*,IOSTAT=IOS)NPPAGE                                   FILRUN    241
      IF(IOS.NE.0.OR.NPPAGE.LT.1.OR.NPPAGE.GT.4                         FILRUN    242
     +   .OR. NPPAGE.EQ.3)GOTO 9800                                     FILRUN    243
      NPP=NPPAGE                                                        FILRUN    244
      IF(NPPAGE.EQ.4)NPP=3                                              FILRUN    245
C                                                                       FILRUN    246
      GOTO 1000                                                         FILRUN    247
*ENDIF                                                                  FILRUN    248
C---------------------------------------------------------------------  FILRUN    249
C                                                                MSAVE  FILRUN    250
C     *MSAVE                                                            FILRUN    251
C     CHANNEL NUMBERS (or VARIABLES)                                    FILRUN    252
C     OUTFIL = MSAVE.LIST                                               FILRUN    253
C     ? For channel numbers (one per line)                              FILRUN    254
C     channel number                                                    FILRUN    255
C     ? For channel variables (bus name case)                           FILRUN    256
C     >variable name ;bus name (;bus name ;id)                          FILRUN    257
C     ? For channel variables (bus number case)                         FILRUN    258
C     >variable name ;bus number (;bus number ;id)                      FILRUN    259
C     *END                                                              FILRUN    260
 1300 WRITE(IUR,'(A)')'MSA'                                             FILRUN    261
C                                                   Number or Variable  FILRUN    262
      IF(FIRMSV)THEN                                                    FILRUN    263
        FIRMSV=.FALSE.                                                  FILRUN    264
        CALL GETLIN(IU44,CARD,*9880)                                    FILRUN    265
        INU=INDEX(CARD,'NUMBER')                                        FILRUN    266
        INA=INDEX(CARD,'VARIABLE')                                      FILRUN    267
        IF(INU.NE.0)THEN                                                FILRUN    268
          WRITE(IUR,'(A)')'N'                                           FILRUN    269
        ELSEIF(INA.NE.0)THEN                                            FILRUN    270
          WRITE(IUR,'(A)')'V'                                           FILRUN    271
        ELSE                                                            FILRUN    272
          GOTO 9800                                                     FILRUN    273
        ENDIF                                                           FILRUN    274
C                                                          Output file  FILRUN    275
        CALL GETLIN(IU44,CARD,*9880)                                    FILRUN    276
        IF(CARD(1:6).NE.'OUTFIL')GOTO 9800                              FILRUN    277
        IK=INDEX(CARD,'=')                                              FILRUN    278
        IF(IK.EQ.0)GOTO 9800                                            FILRUN    279
        STRING=CARD(IK+1:80)                                            FILRUN    280
        CALL FSTLST(STRING,80,IFCHR,ILCHR)                              FILRUN    281
        IF(IFCHR.EQ.0)GOTO 9800                                         FILRUN    282
        IF((ILCHR-IFCHR+1).GT.50)GOTO 9800                              FILRUN    283
        WRITE(IUR,'(A)') STRING(IFCHR:ILCHR)                            FILRUN    284
      ENDIF                                                             FILRUN    285
C                                                Channel specs or quit  FILRUN    286
 1350 CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    287
      IF(CARD(1:4).EQ.'*END')THEN                                       FILRUN    288
        WRITE(IUR,'(A)')'Q'                                             FILRUN    289
      ELSE                                                              FILRUN    290
        WRITE(IUR,'(A)')CARD                                            FILRUN    291
        GOTO 1350                                                       FILRUN    292
      ENDIF                                                             FILRUN    293
C                                                                       FILRUN    294
      GOTO 1000                                                         FILRUN    295
C---------------------------------------------------------------------  FILRUN    296
C                                                             SPECTRUM  FILRUN    297
C     SPECTRUM = channel number                                         FILRUN    298
C     OUTFIL = SPECT.DAT                                                FILRUN    299
C     TIME RANGE = 1.0 5.0 (or DEFAULT)                                 FILRUN    300
C     %MODE TRIM = 0.001                                                FILRUN    301
C     ?                                                                 FILRUN    302
C     ? if required, one of the below four commands                     FILRUN    303
C     ? otherwise plots will not be saved                               FILRUN    304
C     ?                                                                 FILRUN    305
C     PLOT ORIGINAL AND CALCULATED DATA                                 FILRUN    306
C     PLOT DIFFERENCE OF ORIGINAL AND CALCULATED DATA                   FILRUN    307
C     PLOT AMPLITUDE VS FREQUENCY                                       FILRUN    308
C     PLOT ANGLE VS FREQUENCY                                           FILRUN    309
C                                                                       FILRUN    310
C                                                                       FILRUN    311
 1400 WRITE(IUR,'(A)')'DEL=ALL'                                         FILRUN    312
      WRITE(IUR,'(A)')'SPEC'                                            FILRUN    313
C                                                         Channel spec  FILRUN    314
      IK=INDEX(CARD,'=')                                                FILRUN    315
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    316
      STRING=CARD(IK+1:80)                                              FILRUN    317
      READ(STRING,*,IOSTAT=IOS)ICN                                      FILRUN    318
      IF(IOS.NE.0)GOTO 9800                                             FILRUN    319
      WRITE(IUR,'(I4)')ICN                                              FILRUN    320
C                                                          Output file  FILRUN    321
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    322
      IF(CARD(1:6).NE.'OUTFIL')GOTO 9800                                FILRUN    323
      IK=INDEX(CARD,'=')                                                FILRUN    324
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    325
      STRING=CARD(IK+1:80)                                              FILRUN    326
      CALL FSTLST(STRING,80,IFCHR,ILCHR)                                FILRUN    327
      IF(IFCHR.EQ.0)GOTO 9800                                           FILRUN    328
      IF((ILCHR-IFCHR+1).GT.50)GOTO 9800                                FILRUN    329
      WRITE(IUR,'(A)') STRING(IFCHR:ILCHR)                              FILRUN    330
C                                                           Time range  FILRUN    331
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    332
      IF(CARD(1:4).NE.'TIME')GOTO 9800                                  FILRUN    333
      IK=INDEX(CARD,'=')                                                FILRUN    334
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    335
      STRING=CARD(IK+1:80)                                              FILRUN    336
      IF(INDEX(STRING,'DEFAULT').NE.0)THEN                              FILRUN    337
        WRITE(IUR,'(A)')'M'                                             FILRUN    338
      ELSE                                                              FILRUN    339
        READ(STRING,*,IOSTAT=IOS)V1,V2                                  FILRUN    340
        IF(IOS.NE.0)GOTO 9800                                           FILRUN    341
        WRITE(IUR,*)V1,V2                                               FILRUN    342
      ENDIF                                                             FILRUN    343
C                                                            Mode trim  FILRUN    344
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    345
      IF(CARD(1:5).NE.'%MODE')GOTO 9800                                 FILRUN    346
      IK=INDEX(CARD,'=')                                                FILRUN    347
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    348
      STRING=CARD(IK+1:80)                                              FILRUN    349
      READ(STRING,*,IOSTAT=IOS)V1                                       FILRUN    350
      IF(IOS.NE.0)GOTO 9800                                             FILRUN    351
      WRITE(IUR,*)V1                                                    FILRUN    352
C                                                              Repeat?  FILRUN    353
      WRITE(IUR,'(A)')'N'                                               FILRUN    354
C                                                     Plot to be saved  FILRUN    355
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    356
      IF(CARD(1:4).EQ.'PLOT')THEN                                       FILRUN    357
        IF(INDEX(CARD,'FREQUENCY').NE.0)THEN                            FILRUN    358
          IF(INDEX(CARD,'ANGLE').NE.0)THEN                              FILRUN    359
            WRITE(IUR,'(A)')'4'                                         FILRUN    360
          ELSE                                                          FILRUN    361
            WRITE(IUR,'(A)')'3'                                         FILRUN    362
          ENDIF                                                         FILRUN    363
        ELSE                                                            FILRUN    364
          IF(INDEX(CARD,'DIFFERENCE').NE.0)THEN                         FILRUN    365
            WRITE(IUR,'(A)')'2'                                         FILRUN    366
          ELSE                                                          FILRUN    367
            WRITE(IUR,'(A)')'1'                                         FILRUN    368
          ENDIF                                                         FILRUN    369
       ENDIF                                                            FILRUN    370
C                                                              Scaling  FILRUN    371
        WRITE(IUR,'(A)')'D'                                             FILRUN    372
      ELSE                                                              FILRUN    373
        WRITE(IUR,'(A)')'5'                                             FILRUN    374
        GOTO 1010                                                       FILRUN    375
      ENDIF                                                             FILRUN    376
C                                                       Plot using GPP  FILRUN    377
      GOTO 6000                                                         FILRUN    378
C---------------------------------------------------------------------  FILRUN    379
C                                                     ENVELOPE / TREND  FILRUN    380
C                                                                       FILRUN    381
C     ENVELOPE (or TREND) = channel number                              FILRUN    382
C     TIME RANGE = 1,5 (or DEFAULT)                                     FILRUN    383
C                                                                       FILRUN    384
 1500 WRITE(IUR,'(A)')'DEL=ALL'                                         FILRUN    385
      IF(CARD(1:5).EQ.'TREND')THEN                                      FILRUN    386
        WRITE(IUR,'(A)')'FUN=LSF'                                       FILRUN    387
      ELSE                                                              FILRUN    388
        WRITE(IUR,'(A)')'FUN=ENV'                                       FILRUN    389
      ENDIF                                                             FILRUN    390
C                                                         Channel spec  FILRUN    391
      IK=INDEX(CARD,'=')                                                FILRUN    392
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    393
      STRING=CARD(IK+1:80)                                              FILRUN    394
      READ(STRING,*,IOSTAT=IOS)ICN                                      FILRUN    395
      IF(IOS.NE.0)GOTO 9800                                             FILRUN    396
      WRITE(IUR,'(I4)')ICN                                              FILRUN    397
C                                                           Time range  FILRUN    398
      CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    399
      IF(CARD(1:4).NE.'TIME')GOTO 9800                                  FILRUN    400
      IK=INDEX(CARD,'=')                                                FILRUN    401
      IF(IK.EQ.0)GOTO 9800                                              FILRUN    402
      STRING=CARD(IK+1:80)                                              FILRUN    403
      IF(INDEX(STRING,'DEFAULT').NE.0)THEN                              FILRUN    404
        WRITE(IUR,'(A)')'M'                                             FILRUN    405
      ELSE                                                              FILRUN    406
        READ(STRING,*,IOSTAT=IOS)V1,V2                                  FILRUN    407
        IF(IOS.NE.0)GOTO 9800                                           FILRUN    408
        WRITE(IUR,*)V1,V2                                               FILRUN    409
      ENDIF                                                             FILRUN    410
C                                                              Scaling  FILRUN    411
      WRITE(IUR,'(A)')'D'                                               FILRUN    412
C                                                       Plot using GPP  FILRUN    413
      GOTO 6000                                                         FILRUN    414
C---------------------------------------------------------------------  FILRUN    415
C                                                                 PLOT  FILRUN    416
C     ?                                                                 FILRUN    417
C     *PLOT                                                             FILRUN    418
C     ? Maximum of 6 plots per page                                     FILRUN    419
C     ?                                                                 FILRUN    420
C     ? Specification of titles                                         FILRUN    421
C     PTITLEn (n=1 to 6)                                                FILRUN    422
C     n th line of page title                                           FILRUN    423
C     YTITLEn (n=1 to 6)                                                FILRUN    424
C     n th Y-axis title                                                 FILRUN    425
C     XTITLE                                                            FILRUN    426
C     X-axis title                                                      FILRUN    427
C     FTITLE                                                            FILRUN    428
C     Figure title                                                      FILRUN    429
C     ?                                                                 FILRUN    430
C     ? Generator angles                                                FILRUN    431
C     ? Generator relative angles                                       FILRUN    432
C     RELATE = ;bus spec ;id                                            FILRUN    433
C     ? Generator absolute angles                                       FILRUN    434
C     ABSOLUTE                                                          FILRUN    435
C     ?                                                                 FILRUN    436
C     ? Scales                                                          FILRUN    437
C     YRANGEn = 1.0 5.0 (or DEFAULT or MAXIMIXE) (n = 1 to 6)           FILRUN    438
C     XRANGE = 1.0 5.0 (or DEFAULT or MAXIMIXE)                         FILRUN    439
C     TRANGE = 1.0 5.0 (or DEFAULT)                                     FILRUN    440
C     YRANGEC = 1.0 5.0 (or DEFAULT or MAXIMIXE) (for common scale)     FILRUN    441
C     YSCALE = COMMON or INDIVIDUAL (default is INDIVIDUAL)             FILRUN    442
C     ?                                                                 FILRUN    443
C     ? X-Y plots (cannot be combined with TIME plots)                  FILRUN    444
C     ?           (can only be done inside CALCULATION)                 FILRUN    445
C     CALCULATION                                                       FILRUN    446
C     ? (Commands inside CALCULATION must follow the usual rules)       FILRUN    447
C     R=(100)                                                           FILRUN    448
C     X=(101)                                                           FILRUN    449
C     PLOT R .VS. X                                                     FILRUN    450
C     ? End of CALCULATION                                              FILRUN    451
C     RETURN                                                            FILRUN    452
C     ?                                                                 FILRUN    453
C     ? TIME plots (cannot be combined with X-Y plots)                  FILRUN    454
C     ?            (can also be done inside CALCULATION)                FILRUN    455
C     ?            (a different INPFIL can be opened inside PLOT)       FILRUN    456
C     ?                                                                 FILRUN    457
C     ? For channel numbers                                             FILRUN    458
C     11                                                                FILRUN    459
C     ? For channel variables (bus name case)                           FILRUN    460
C     >variable name ;bus name (;bus name ;id)                          FILRUN    461
C     ? For channel variables (bus number case)                         FILRUN    462
C     >variable name ;bus number (;bus number ;id)                      FILRUN    463
C     ?                                                                 FILRUN    464
C     ? End of PLOT                                                     FILRUN    465
C     *END                                                              FILRUN    466
C                                                                       FILRUN    467
 2000 NPLOT=0                                                           FILRUN    468
      CALPLT=.FALSE.                                                    FILRUN    469
      SAVFLG=.FALSE.                                                    FILRUN    470
C                                                                       FILRUN    471
      CHGTIT=.FALSE.                                                    FILRUN    472
      DO 2100 II=1,14                                                   FILRUN    473
        TITFLG(II)=.FALSE.                                              FILRUN    474
 2100 CONTINUE                                                          FILRUN    475
C                                                                       FILRUN    476
      DO 2200 II=1,9                                                    FILRUN    477
        RNGE(II)='D'                                                    FILRUN    478
 2200 CONTINUE                                                          FILRUN    479
C                                                                       FILRUN    480
      SCATYP=' '                                                        FILRUN    481
      TPLOT=.FALSE.                                                     FILRUN    482
      XPLOT=.FALSE.                                                     FILRUN    483
C                                                                       FILRUN    484
2500  CALL GETLIN(IU44,CARD,*9880)                                      FILRUN    485
C                                                          Binary file  FILRUN    486
      IF(CARD(1:6).EQ.'INPFIL')THEN                                     FILRUN    487
        IK=INDEX(CARD,'=')                                              FILRUN    488
        IF(IK.EQ.0)GOTO 9800                                            FILRUN    489
        STRING=CARD(IK+1:80)                                            FILRUN    490
        CALL FSTLST(STRING,80,IFCHR,ILCHR)                              FILRUN    491
        IF(IFCHR.EQ.0)GOTO 9800                                         FILRUN    492
        IF((ILCHR-IFCHR+1).GT.50)GOTO 9800                              FILRUN    493
        FILNAM=STRING(IFCHR:ILCHR)                                      FILRUN    494
        WRITE(IUR,'(A)')'OPE='//FILNAM                                  FILRUN    495
C                                                            Save file  FILRUN    496
      ELSEIF(CARD(1:6).EQ.'SAVFIL')THEN                                 FILRUN    497
        IK=INDEX(CARD,'=')                                              FILRUN    498
        IF(IK.EQ.0)GOTO 9800                                            FILRUN    499
        STRING=CARD(IK+1:80)                                            FILRUN    500
        CALL FSTLST(STRING,80,IFCHR,ILCHR)                              FILRUN    501
        IF(IFCHR.EQ.0)GOTO 9800                                         FILRUN    502
        IF((ILCHR-IFCHR+1).GT.50)GOTO 9800                              FILRUN    503
        SAVFIL=STRING(IFCHR:ILCHR)                                      FILRUN    504
        SAVFLG=.TRUE.                                                   FILRUN    505
C                                                               Titles  FILRUN    506
      ELSEIF(CARD(1:6).EQ.'PTITLE'.OR.                                  FILRUN    507
     +       CARD(1:6).EQ.'FTITLE'.OR.                                  FILRUN    508
     +       CARD(1:6).EQ.'XTITLE'.OR.                                  FILRUN    509
     +       CARD(1:6).EQ.'YTITLE')THEN                                 FILRUN    510
        IF(CARD(1:1).EQ.'P')THEN                                        FILRUN    511
          READ(CARD(7:7),'(I1)',IOSTAT=IOS)II                           FILRUN    512
          IF((IOS.NE.0).OR.II.LT.1.OR.II.GT.6)GOTO 9800                 FILRUN    513
        ELSEIF(CARD(1:1).EQ.'F')THEN                                    FILRUN    514
          II=7                                                          FILRUN    515
        ELSEIF(CARD(1:1).EQ.'X')THEN                                    FILRUN    516
          II=8                                                          FILRUN    517
        ELSE                                                            FILRUN    518
          READ(CARD(7:7),'(I1)',IOSTAT=IOS)II                           FILRUN    519
          IF((IOS.NE.0).OR.II.LT.1.OR.II.GT.6)GOTO 9800                 FILRUN    520
          II=II+8                                                       FILRUN    521
        ENDIF                                                           FILRUN    522
        CHGTIT=.TRUE.                                                   FILRUN    523
        TITFLG(II)=.TRUE.                                               FILRUN    524
        CALL GETLIN(IU44,CARD,*9880)                                    FILRUN    525
        TITLES(II)=CARD                                                 FILRUN    526
C                                                               Ranges  FILRUN    527
      ELSEIF(CARD(1:6).EQ.'YRANGE'.OR.                                  FILRUN    528
     +       CARD(1:6).EQ.'XRANGE'.OR.                                  FILRUN    529
     +       CARD(1:6).EQ.'TRANGE')THEN                                 FILRUN    530
        IK=INDEX(CARD,'=')                                              FILRUN    531
        IF(IK.EQ.0)GOTO 9800                                            FILRUN    532
        STRING=CARD(IK+1:80)                                            FILRUN    533
        IF(CARD(1:1).EQ.'Y')THEN                                        FILRUN    534
          IF(CARD(7:7).EQ.'C')THEN                                      FILRUN    535
            II=9                                                        FILRUN    536
          ELSE                                                          FILRUN    537
            READ(CARD(7:7),'(I1)',IOSTAT=IOS)II                         FILRUN    538
            IF((IOS.NE.0).OR.II.LT.1.OR.II.GT.6)GOTO 9800               FILRUN    539
          ENDIF                                                         FILRUN    540
        ELSEIF(CARD(1:1).EQ.'X')THEN                                    FILRUN    541
          II=7                                                          FILRUN    542
        ELSE                                                            FILRUN    543
          II=8                                                          FILRUN    544
        ENDIF                                                           FILRUN    545
        ID=INDEX(STRING,'DEFAULT')                                      FILRUN    546
        IM=INDEX(STRING,'MAXIMIZE')                                     FILRUN    547
        IF(II.EQ.8)IM=0                                                 FILRUN    548
        IF(ID.NE.0)THEN                                                 FILRUN    549
          RNGE(II)='D'                                                  FILRUN    550
        ELSEIF(IM.NE.0)THEN                                             FILRUN    551
          RNGE(II)='M'                                                  FILRUN    552
        ELSE                                                            FILRUN    553
          READ(STRING,*,IOSTAT=IOS)V1,V2                                FILRUN    554
          IF(IOS.NE.0)GOTO 9800                                         FILRUN    555
          WRITE(RNGE(II),'(2F14.6)')V1,V2                               FILRUN    556
        ENDIF                                                           FILRUN    557
C                                                               Yscale  FILRUN    558
      ELSEIF(CARD(1:6).EQ.'YSCALE')THEN                                 FILRUN    559
        IK=INDEX(CARD,'COMMON')                                         FILRUN    560
        IF(IK.NE.0)THEN                                                 FILRUN    561
          SCATYP='C'                                                    FILRUN    562
        ELSE                                                            FILRUN    563
          SCATYP=' '                                                    FILRUN    564
        ENDIF                                                           FILRUN    565
C                                                          Calculation  FILRUN    566
      ELSEIF(CARD(1:11).EQ.'CALCULATION')THEN                           FILRUN    567
        WRITE(IUR,'(A)')'FUN=CAL'                                       FILRUN    568
 2700   CALL GETLIN(IU44,CARD,*9880)                                    FILRUN    569
        IF(CARD(1:4).EQ.'PLOT')THEN                                     FILRUN    570
          NPLOT=NPLOT+1                                                 FILRUN    571
          IF(NPLOT.EQ.1)THEN                                            FILRUN    572
            II=INDEX(CARD,'.VS.')                                       FILRUN    573
            IF(II.NE.0)THEN                                             FILRUN    574
              XPLOT=.TRUE.                                              FILRUN    575
            ELSE                                                        FILRUN    576
              TPLOT=.TRUE.                                              FILRUN    577
            ENDIF                                                       FILRUN    578
          ELSEIF(NPLOT.GT.6)THEN                                        FILRUN    579
            WRITE(LOUT,7060)                                            FILRUN    580
            GOTO 9820                                                   FILRUN    581
          ELSE                                                          FILRUN    582
            II=INDEX(CARD,'.VS.')                                       FILRUN    583
            IF(II.NE.0)GOTO 9800                                        FILRUN    584
          ENDIF                                                         FILRUN    585
          CALPLT=.TRUE.                                                 FILRUN    586
        ELSEIF(CARD(1:6).EQ.'RETURN')THEN                               FILRUN    587
          WRITE(IUR,'(A)')CARD                                          FILRUN    588
          IF(CALPLT)WRITE(IUR,'(A)')'D'                                 FILRUN    589
          GOTO 2500                                                     FILRUN    590
        ENDIF                                                           FILRUN    591
        WRITE(IUR,'(A)')CARD                                            FILRUN    592
        GOTO 2700                                                       FILRUN    593
C                                                          End of plot  FILRUN    594
      ELSEIF(CARD(1:4).EQ.'*END')THEN                                   FILRUN    595
        IF(NPLOT.EQ.0) GOTO 1000                                        FILRUN    596
        GOTO 4000                                                       FILRUN    597
C                                                             Relative  FILRUN    598
      ELSEIF(CARD(1:8).EQ.'RELATIVE')THEN                               FILRUN    599
        WRITE(IUR,'(A)')'REL'                                           FILRUN    600
        IK=INDEX(CARD,'=')                                              FILRUN    601
        IF(IK.EQ.0)GOTO 9800                                            FILRUN    602
        STRING=CARD(IK+1:80)                                            FILRUN    603
        WRITE(IUR,'(A)')STRING                                          FILRUN    604
C                                                             Absolute  FILRUN    605
      ELSEIF(CARD(1:8).EQ.'ABSOLUTE')THEN                               FILRUN    606
        WRITE(IUR,'(A)')'ABS'                                           FILRUN    607
C                                                          Get channel  FILRUN    608
      ELSE                                                              FILRUN    609
        TPLOT=.TRUE.                                                    FILRUN    610
        IF(XPLOT)THEN                                                   FILRUN    611
          WRITE(LOUT,7200)                                              FILRUN    612
          GOTO 9820                                                     FILRUN    613
        ENDIF                                                           FILRUN    614
        NPLOT=NPLOT+1                                                   FILRUN    615
        IF(NPLOT.GT.6)THEN                                              FILRUN    616
          WRITE(LOUT,7060)                                              FILRUN    617
          GOTO 9820                                                     FILRUN    618
        ENDIF                                                           FILRUN    619
        WRITE(IUR,'(A)')'GET'                                           FILRUN    620
        WRITE(IUR,'(A)')CARD                                            FILRUN    621
        WRITE(IUR,'(A)')'F'                                             FILRUN    622
      ENDIF                                                             FILRUN    623
C                                                                       FILRUN    624
      GOTO 2500                                                         FILRUN    625
C---------------------------------------------------------------------  FILRUN    626
C                                                               SCALES  FILRUN    627
C                                                                       FILRUN    628
 4000 IYS=2                                                             FILRUN    629
      IYE=NPLOT+2                                                       FILRUN    630
C                                                                       FILRUN    631
      WRITE(IUR,'(A)')'GET'                                             FILRUN    632
      WRITE(IUR,'(A)')'S'                                               FILRUN    633
C                                                         Time scaling  FILRUN    634
      WRITE(IUR,'(A)')'1'                                               FILRUN    635
      WRITE(IUR,'(A)')RNGE(8)                                           FILRUN    636
C                                                       X-axis scaling  FILRUN    637
      IF(XPLOT)THEN                                                     FILRUN    638
        IYS=IYS+1                                                       FILRUN    639
        IYE=IYE+1                                                       FILRUN    640
        WRITE(IUR,'(A)')'2'                                             FILRUN    641
        WRITE(IUR,'(A)')RNGE(7)                                         FILRUN    642
      ENDIF                                                             FILRUN    643
C                                                       Y-axis scaling  FILRUN    644
      IS=0                                                              FILRUN    645
      DO 4100 II=IYS,IYE-1                                              FILRUN    646
        IS=IS+1                                                         FILRUN    647
        WRITE(IUR,'(I1)')II                                             FILRUN    648
        WRITE(IUR,'(A)')RNGE(IS)                                        FILRUN    649
 4100 CONTINUE                                                          FILRUN    650
      WRITE(IUR,'(I1)')IYE                                              FILRUN    651
      WRITE(IUR,'(A)')RNGE(9)                                           FILRUN    652
C                                                         Y-scale type  FILRUN    653
      WRITE(IUR,'(A)')SCATYP                                            FILRUN    654
      WRITE(IUR,'(A)')'D'                                               FILRUN    655
C---------------------------------------------------------------------  FILRUN    656
C                                                               TITLES  FILRUN    657
C                                                                       FILRUN    658
      IF(CHGTIT)THEN                                                    FILRUN    659
        WRITE(IUR,'(A)')'TIT'                                           FILRUN    660
        WRITE(IUR,'(A)')'1'                                             FILRUN    661
C                                                          Page titles  FILRUN    662
        DO 5100 II=1,6                                                  FILRUN    663
          IF(TITFLG(II))THEN                                            FILRUN    664
            WRITE(IUR,'(I1)')II                                         FILRUN    665
            WRITE(IUR,'(A)')TITLES(II)                                  FILRUN    666
          ENDIF                                                         FILRUN    667
 5100   CONTINUE                                                        FILRUN    668
        WRITE(IUR,'(A)')'Q'                                             FILRUN    669
C                                                         Figure title  FILRUN    670
        IF(TITFLG(7))THEN                                               FILRUN    671
          WRITE(IUR,'(A)')'2'                                           FILRUN    672
          WRITE(IUR,'(A)')TITLES(7)                                     FILRUN    673
        ENDIF                                                           FILRUN    674
C                                                         X-axis title  FILRUN    675
        IF(TITFLG(8))THEN                                               FILRUN    676
          WRITE(IUR,'(A)')'3'                                           FILRUN    677
          WRITE(IUR,'(A)')TITLES(8)                                     FILRUN    678
        ENDIF                                                           FILRUN    679
        WRITE(IUR,'(A)')'C'                                             FILRUN    680
C                                                Y-axis titles 1 and 2  FILRUN    681
        IF(TITFLG(9))THEN                                               FILRUN    682
          WRITE(IUR,'(A)')'4'                                           FILRUN    683
          WRITE(IUR,'(A)')TITLES(9)                                     FILRUN    684
        ENDIF                                                           FILRUN    685
        IF(TITFLG(10))THEN                                              FILRUN    686
          WRITE(IUR,'(A)')'8'                                           FILRUN    687
          WRITE(IUR,'(A)')TITLES(10)                                    FILRUN    688
        ENDIF                                                           FILRUN    689
        WRITE(IUR,'(A)')'C'                                             FILRUN    690
C                                                Y-axis titles 3 and 4  FILRUN    691
        IF(TITFLG(11))THEN                                              FILRUN    692
          WRITE(IUR,'(A)')'12'                                          FILRUN    693
          WRITE(IUR,'(A)')TITLES(11)                                    FILRUN    694
        ENDIF                                                           FILRUN    695
        IF(TITFLG(12))THEN                                              FILRUN    696
          WRITE(IUR,'(A)')'16'                                          FILRUN    697
          WRITE(IUR,'(A)')TITLES(12)                                    FILRUN    698
        ENDIF                                                           FILRUN    699
        WRITE(IUR,'(A)')'C'                                             FILRUN    700
C                                                Y-axis titles 5 and 6  FILRUN    701
        IF(TITFLG(13))THEN                                              FILRUN    702
          WRITE(IUR,'(A)')'20'                                          FILRUN    703
          WRITE(IUR,'(A)')TITLES(13)                                    FILRUN    704
        ENDIF                                                           FILRUN    705
        IF(TITFLG(14))THEN                                              FILRUN    706
          WRITE(IUR,'(A)')'24'                                          FILRUN    707
          WRITE(IUR,'(A)')TITLES(14)                                    FILRUN    708
        ENDIF                                                           FILRUN    709
        WRITE(IUR,'(A)')'Q'                                             FILRUN    710
      ENDIF                                                             FILRUN    711
C      -----------------------------------------------------------------FILRUN    712
C                                        Save buffer to specified file  FILRUN    713
C                                                                       FILRUN    714
      IF(SAVFLG)THEN                                                    FILRUN    715
        IF(XPLOT)THEN                                                   FILRUN    716
          WRITE(LOUT,7300)                                              FILRUN    717
          GOTO 9900                                                     FILRUN    718
        ELSE                                                            FILRUN    719
          WRITE(IUR,'(A)')'SAVE'                                        FILRUN    720
          WRITE(IUR,'(A)')SAVFIL                                        FILRUN    721
        ENDIF                                                           FILRUN    722
      ENDIF                                                             FILRUN    723
C---------------------------------------------------------------------  FILRUN    724
C                                                               GPPLOT  FILRUN    725
C                                                                       FILRUN    726
 6000 WRITE(IUR,'(A)')'GPP'                                             FILRUN    727
C                                                                       FILRUN    728
*IF -WSX11                                                              FILRUN    729
*ENDIF                                                                  FILRUN    734
C                                                                       FILRUN    735
*IF WSX11                                                               FILRUN    736
      WRITE(IUR,'(A)')'GPD'                                             FILRUN    737
      IF(ASKPS)THEN                                                     FILRUN    738
        WRITE(IUR,'(A)')PSFILE                                          FILRUN    739
        WRITE(IUR,'(I1)')NPP                                            FILRUN    740
        ASKPS=.FALSE.                                                   FILRUN    741
      ENDIF                                                             FILRUN    742
      EMPTY=.FALSE.                                                     FILRUN    743
*ENDIF                                                                  FILRUN    744
C                                                                       FILRUN    745
      WRITE(IUR,'(A)')'GPN'                                             FILRUN    746
C                                                                       FILRUN    747
      GOTO 1000                                                         FILRUN    748
C---------------------------------------------------------------------  FILRUN    749
C                                                 Messages and formats  FILRUN    750
C                                                                       FILRUN    751
 7000 FORMAT(/,10X,'*** ERROR OPENING CONTROL FILE ***')                FILRUN    752
 7020 FORMAT(/,10X,'*** KEYWORD - RESULT - IS MISSING ***')             FILRUN    753
 7040 FORMAT(/,10X,'*** IMPROPER SPECIFICATION OF RESULT FILES ***')    FILRUN    754
 7060 FORMAT(/,10X,'*** MORE THAN SIX PLOTS ARE REQUESTED ***')         FILRUN    755
 7200 FORMAT(/,10X,'*** MIXING OF TIME AND X-Y PLOTS ***')              FILRUN    756
 7300 FORMAT(/,10X,'*** X-Y PLOTS CANNOT BE SAVED ***')                 FILRUN    757
 8800 FORMAT(/,10X,'*** INCORRECT SYNTAX IN FOLLOWING CARD ***')        FILRUN    758
 8900 FORMAT(/,10X,'*** ERROR READING CONTROL FILE ***')                FILRUN    759
 9000 FORMAT(/,10X,'*** FRUN COMMAND IS ABORTED ***',/)                 FILRUN    760
C---------------------------------------------------------------------  FILRUN    761
C                                                           Abort FRUN  FILRUN    762
C                                                                       FILRUN    763
 9800 WRITE(LOUT,8800)                                                  FILRUN    764
 9820 WRITE(LOUT,'(A)')' '//CARD(1:79)                                  FILRUN    765
      GOTO 9900                                                         FILRUN    766
C                                                                       FILRUN    767
 9880 WRITE(LOUT,8900)                                                  FILRUN    768
 9900 WRITE(LOUT,9000)                                                  FILRUN    769
C---------------------------------------------------------------------  FILRUN    770
 9999 RETURN                                                            FILRUN    771
      END                                                               FILRUN    772
C*********************************************************************  FILRUN    773
       SUBROUTINE FSTLST(STRING,LEN,IFCHR,ILCHR)                        FILRUN    774
CD                                                                      FILRUN    775
CD     GIVEN A CHARACTER STRING AND ITS LENGTH, THIS ROUTINE WILL FIND  FILRUN    776
CD     THE POSITION OF THE FIRST AND THE LAST NON BLANK CHARACTERS IN   FILRUN    777
CD     THE STRING                                                       FILRUN    778
CD                                                                      FILRUN    779
       CHARACTER*(*) STRING                                             FILRUN    780
C---------------------------------------------------------------------  FILRUN    781
       DO 1000 IFCHR=1,LEN                                              FILRUN    782
         IF(STRING(IFCHR:IFCHR).NE.' ')GOTO 1100                        FILRUN    783
 1000  CONTINUE                                                         FILRUN    784
C                                                                       FILRUN    785
       IFCHR=0                                                          FILRUN    786
       ILCHR=0                                                          FILRUN    787
       GOTO 9999                                                        FILRUN    788
C                                                                       FILRUN    789
 1100  DO 1200 ILCHR=LEN,1,-1                                           FILRUN    790
         IF(STRING(ILCHR:ILCHR).NE.' ')GOTO 9999                        FILRUN    791
 1200  CONTINUE                                                         FILRUN    792
C---------------------------------------------------------------------  FILRUN    793
 9999  RETURN                                                           FILRUN    794
       END                                                              FILRUN    795
C*********************************************************************  FILRUN    796
       SUBROUTINE GETLIN(IUX,STRING,*)                                  FILRUN    797
CD                                                                      FILRUN    798
CD     THIS SUBROUTINE GETS A COMMAND LINE FROM A FILE.                 FILRUN    799
CD     IT IGNORES LINES STARTING WITH A QUESTION MARK (?).              FILRUN    800
CD     THE COMMAND LINE IS RETURNED WITHOUT THE LEADING BLANKS.         FILRUN    801
CD                                                                      FILRUN    802
CD     A BLANK COMMAND LINE WILL HOWEVER BE RETURNED AS IT COULD BE A   FILRUN    803
CD     CHARACTER STRING (FOR TITLES)                                    FILRUN    804
CD                                                                      FILRUN    805
CD     ALTERNATE RETURN ON READ ERROR                                   FILRUN    806
CD                                                                      FILRUN    807
       CHARACTER*80 STRING,CHRBUF                                       FILRUN    808
C---------------------------------------------------------------------  FILRUN    809
  100  READ(IUX,'(A)',IOSTAT=IOS)STRING                                 FILRUN    810
       IF(IOS.NE.0) RETURN 1                                            FILRUN    811
C                                                                       FILRUN    812
       IF(STRING(1:1).EQ.'?')GOTO 100                                   FILRUN    813
C                                                                       FILRUN    814
       IK=IFNBLK(STRING,79)                                             FILRUN    815
       IF(IK.EQ.0)GOTO 9999                                             FILRUN    816
C                                                                       FILRUN    817
       CHRBUF=STRING(IK:80)                                             FILRUN    818
       STRING=CHRBUF                                                    FILRUN    819
C---------------------------------------------------------------------  FILRUN    820
 9999  RETURN                                                           FILRUN    821
       END                                                              FILRUN    822
