CFPRIME GETCHN                                                          GETCHN      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*               Output Analysis Program for ETMSP (OAP)               *RIGHTE      4
C*               =======================================               *RIGHTE      5
C*                                                                     *RIGHTE     11
C*        copyright @(1993) Electric Power Research Institute          *RIGHTE     12
C*                                                                     *RIGHTE     13
C* EPRI reserves all rights in the software and associated             *RIGHTE     14
C* documentation as delivered. The software and its associated         *RIGHTE     15
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     16
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     17
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     18
C* of any changes or modifications to the software within two (2)      *RIGHTE     19
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     20
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     21
C* new designation sufficiently different from its then current        *RIGHTE     22
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     23
C* the current software as changed or modified.                        *RIGHTE     24
C*                                                                     *RIGHTE     25
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     26
C* directly from EPRI.                                                 *RIGHTE     27
C*                                                                     *RIGHTE     28
C* This program and supporting materials may be independently available*RIGHTE     29
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     30
C* distribution fee. The EPSC is a service of                          *RIGHTE     31
C*                                                                     *RIGHTE     32
C*                    Power Computing Company                          *RIGHTE     33
C*                    1930 Hi Line                                     *RIGHTE     34
C*                    Dallas, Tx 75207                                 *RIGHTE     35
C*                                                                     *RIGHTE     36
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     37
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     38
C*                                                                     *RIGHTE     39
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     40
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     41
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     42
C*    DOCUMENTATION; OR                                                *RIGHTE     43
C*                                                                     *RIGHTE     44
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     45
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     46
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     47
C*                                                                     *RIGHTE     48
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     49
C* THEREOF.                                                            *RIGHTE     50
C*                                                                     *RIGHTE     51
C***********************************************************************RIGHTE     52
      SUBROUTINE GETCHN(COMMD)                                          GETCHN      3
CD                                                                      GETCHN      4
CD       THIS ROUTINE INQUIRES THE USER INPUT CHANNEL NUMBER AND        GETCHN      5
CD       READS PLOTTING DATA FROM CHANNEL FILE.                         GETCHN      6
CD       IT ALSO SERVES AS THE CENTRAL SCALING ROUTINE.                 GETCHN      7
CD                                                                      GETCHN      8
      INCLUDE 'PARAM.INS'                                               GETCHN      9
      INCLUDE 'GPINFO.INS'                                              GETCHN     10
      INCLUDE 'XYARAY.INS'                                              GETCHN     11
      INCLUDE 'SOAPC1.INS'                                              GETCHN     12
      INCLUDE 'JJNAME.INS'                                              GETCHN     13
      INCLUDE 'GTIT.INS'                                                GETCHN     14
      INCLUDE 'DBFLG.INS'                                               GETCHN     15
      INCLUDE 'CHDISP.INS'                                              GETCHN     16
C                                                                       GETCHN     17
C     ICHTYP = 0 --> NEW CHANNELS FROM BINARY FILE                      GETCHN     18
C              1 --> OLD CHANNELS FROM BINARY FILE                      GETCHN     19
C              2 --> FROM ASCII FILE                                    GETCHN     20
C              3 --> FROM SAVED FILE                                    GETCHN     21
C              4 --> FROM FUNCTION/SPECTRUM                             GETCHN     22
C                                                                       GETCHN     23
C     IPLTYP = 0 --> DATA TYPE NOT DEFINED                              GETCHN     24
C              1 --> DATA TYPE IS Y .VS. TIME                           GETCHN     25
C              2 --> DATA TYPE IS Y .VS. X                              GETCHN     26
C              3 --> DATA TYPE IS Y .VS. FREQUENCY                      GETCHN     27
C                                                                       GETCHN     28
      COMMON /SCFLAG/ IFLG                                              GETCHN     29
C   ......................................................              GETCHN     30
C   : TEXTS AS READ FROM BIN FILE                        :              GETCHN     31
      CHARACTER*80 TITCAS,TITSWI,TITEXT                                 GETCHN     32
      CHARACTER*12 TITDAT                                               GETCHN     33
      CHARACTER*4  TITVER                                               GETCHN     34
      COMMON /BITEXT/ TITCAS,TITSWI,TITEXT,TITDAT,TITVER                GETCHN     35
C   :....................................................:              GETCHN     36
      COMMON /RECPT/ KRSTRT, ISTNAM, IIDARY, ITYARY, IHREC,ICHAN,       GETCHN     37
     *          NPFL,LRREC,IRREC                                        GETCHN     38
      CHARACTER*80 STRING,MSG,COMMD                                     GETCHN     39
      INTEGER NXWORD                                                    GETCHN     40
      DIMENSION YMX(MCHNL),YMN(MCHNL),YMX1(MCHNL),YMN1(MCHNL)           GETCHN     41
C                                                                       GETCHN     42
      IF(COMMD(1:7).EQ.'RESTORE'.OR.COMMD(1:7).EQ.'RDASCII'.OR.         GETCHN     43
     +   COMMD(1:7).EQ.'ANALYSI')THEN                                   GETCHN     44
        STRING(1:1)='S'                                                 GETCHN     45
        IFR=7                                                           GETCHN     46
        GOTO 100                                                        GETCHN     47
      ENDIF                                                             GETCHN     48
C                                                                       GETCHN     49
      I=NXWORD(COMMD,1)                                                 GETCHN     50
      IF(I.EQ.0)THEN                                                    GETCHN     51
         STRING=' '                                                     GETCHN     52
      ELSE                                                              GETCHN     53
         STRING=COMMD(I:80)                                             GETCHN     54
      ENDIF                                                             GETCHN     55
      CALL FIRSTP(STRING,IFR)                                           GETCHN     56
C                                                                       GETCHN     57
 100  IF(KCH(1).EQ.0)GOTO 5000                                          GETCHN     58
C                                                                       GETCHN     59
C  READ BINARY FILE                                                     GETCHN     60
C                                                                       GETCHN     61
      IF(KCH(1)-IFR.GE.0)THEN                                           GETCHN     62
        WRITE(LOUT,1200)                                                GETCHN     63
        CALL REMASS(T,YARAY,MXPT,MXPLOT,ICHNL,IFR,KCH(1),KRECFD)        GETCHN     64
C                                        Fill up the X array with TIME  GETCHN     65
        DO 120 II=IFR,KCH(1)                                            GETCHN     66
          DO 110 IPT=1,MAXPT(II)                                        GETCHN     67
            XARAY(IPT,II)=T(IPT,II)                                     GETCHN     68
 110      CONTINUE                                                      GETCHN     69
 120    CONTINUE                                                        GETCHN     70
      ENDIF                                                             GETCHN     71
C                                                                       GETCHN     72
      SCALX=.TRUE.                                                      GETCHN     73
      TMN=99999.0                                                       GETCHN     74
      DO 201 II=1,KCH(1)                                                GETCHN     75
        IF(TMN.GT.T(1,II))TMN=T(1,II)                                   GETCHN     76
 201  CONTINUE                                                          GETCHN     77
      TMX=-99999.0                                                      GETCHN     78
      DO 202 II=1,KCH(1)                                                GETCHN     79
        IF(TMX.LT.T(MAXPT(II),II))TMX=T(MAXPT(II),II)                   GETCHN     80
 202  CONTINUE                                                          GETCHN     81
      TMX1=TMX                                                          GETCHN     82
      TMN1=TMN                                                          GETCHN     83
      DO 210 II=1,KCH(1)                                                GETCHN     84
        IDX1(II)=1                                                      GETCHN     85
        IDX2(II)=MAXPT(II)                                              GETCHN     86
 210  CONTINUE                                                          GETCHN     87
C                                                                       GETCHN     88
      IF(IPLTYP.EQ.1.OR.IPLTYP.EQ.3)THEN                                GETCHN     89
        IF(COMMD(1:7).NE.'ANALYSI')XTITLE='TIME IN SECONDS'             GETCHN     90
C                                                                       GETCHN     91
 300    CYMN=999999.0                                                   GETCHN     92
        CYMX=-999999.0                                                  GETCHN     93
        DO 330 II=1,KCH(1)                                              GETCHN     94
          YMN(II)=999999.0                                              GETCHN     95
          YMX(II)=-999999.0                                             GETCHN     96
          DO 320 IPT=IDX1(II),IDX2(II)                                  GETCHN     97
            IF(YMN(II).GT.YARAY(IPT,II))YMN(II)=YARAY(IPT,II)           GETCHN     98
            IF(YMX(II).LT.YARAY(IPT,II))YMX(II)=YARAY(IPT,II)           GETCHN     99
 320      CONTINUE                                                      GETCHN    100
          IF(CYMN.GT.YMN(II))CYMN=YMN(II)                               GETCHN    101
          IF(CYMX.LT.YMX(II))CYMX=YMX(II)                               GETCHN    102
          CALL YSCALE(YMN(II),YMX(II),YMN1(II),YMX1(II))                GETCHN    103
 330    CONTINUE                                                        GETCHN    104
        CALL YSCALE(CYMN,CYMX,CYMN1,CYMX1)                              GETCHN    105
C                                                                       GETCHN    106
 400    DO 420 II=1,KCH(1)                                              GETCHN    107
          IF(GSCALE)THEN                                                GETCHN    108
            CALL SCALEV(TMN1,TMX1,CYMN1,CYMX1,II)                       GETCHN    109
            CALL SCALED(TMN1,TMX1,CYMN1,CYMX1,II)                       GETCHN    110
          ELSE                                                          GETCHN    111
            CALL SCALEV(TMN1,TMX1,YMN1(II),YMX1(II),II)                 GETCHN    112
            CALL SCALED(TMN1,TMX1,YMN1(II),YMX1(II),II)                 GETCHN    113
          ENDIF                                                         GETCHN    114
          SCALX=.FALSE.                                                 GETCHN    115
 420    CONTINUE                                                        GETCHN    116
C                                                                       GETCHN    117
        IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')GOTO 5000           GETCHN    118
C                                                                       GETCHN    119
 500    IF(IPLTYP.EQ.1)THEN                                             GETCHN    120
          WRITE(LOUT,3000)                                              GETCHN    121
          WRITE(LOUT,3100) 1,'  TIME',TMN,TMX,TMN1,TMX1                 GETCHN    122
        ELSE                                                            GETCHN    123
          WRITE(LOUT,3010)                                              GETCHN    124
          WRITE(LOUT,3100) 1,'  FREQ',TMN,TMX,TMN1,TMX1                 GETCHN    125
        ENDIF                                                           GETCHN    126
        WRITE(LOUT,3300)                                                GETCHN    127
        DO 520 II=1,KCH(1)                                              GETCHN    128
          WRITE(STRING(1:4),'(I4)')KCH(II+1)                            GETCHN    129
          WRITE(LOUT,3100) II+1,'  '//STRING(1:4),YMN(II),YMX(II),      GETCHN    130
     +                                      YMN1(II),YMX1(II)           GETCHN    131
 520    CONTINUE                                                        GETCHN    132
        WRITE(LOUT,3150) KCH(1)+2,'COMMON SCALE',CYMN,CYMX,             GETCHN    133
     +                                           CYMN1,CYMX1            GETCHN    134
        IF(GSCALE)THEN                                                  GETCHN    135
          WRITE(LOUT,'(/,A,/)') '          * COMMON SCALE IS USED'      GETCHN    136
        ELSE                                                            GETCHN    137
          WRITE(LOUT,'(/,A,/)') '          * INDIVIDUAL SCALE IS USED'  GETCHN    138
        ENDIF                                                           GETCHN    139
C                                                                       GETCHN    140
        MSG='SELECT BY # FOR SCALE CHANGE; (D)ONE,(C)OMMON SCALE:'      GETCHN    141
        CALL PMTRED(LOUT,LIN,JERR,52,MSG,'S01',STRING)                  GETCHN    142
        IF(JERR.LT.0) GOTO 500                                          GETCHN    143
        IF(RECORD)WRITE(IREC,'(A)')STRING                               GETCHN    144
        IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')GOTO 5000           GETCHN    145
        IF(STRING(1:1).EQ.'C'.OR.STRING(1:1).EQ.'c')THEN                GETCHN    146
          GSCALE=.NOT.GSCALE                                            GETCHN    147
          GOTO 400                                                      GETCHN    148
        ENDIF                                                           GETCHN    149
        READ(STRING,*,IOSTAT=IOS) ISCN                                  GETCHN    150
        IF(IOS.NE.0.OR.ISCN.LE.0.OR.ISCN.GT.KCH(1)+2)GOTO 500           GETCHN    151
C                                                                       GETCHN    152
 600    IF(ISCN.EQ.1)THEN                                               GETCHN    153
          IF(IPLTYP.EQ.1)THEN                                           GETCHN    154
            MSG='ENTER NEW T-MIN AND T-MAX. (D)EFAULT (M)IN,MAX'        GETCHN    155
          ELSE                                                          GETCHN    156
            MSG='ENTER NEW F-MIN AND F-MAX. (D)EFAULT (M)IN,MAX'        GETCHN    157
          ENDIF                                                         GETCHN    158
        ELSE                                                            GETCHN    159
          MSG='ENTER NEW Y-MIN AND Y-MAX. (D)EFAULT (M)IN,MAX'          GETCHN    160
        ENDIF                                                           GETCHN    161
        CALL PMTRED(LOUT,LIN,JERR,48,MSG,'S01',STRING)                  GETCHN    162
        IF(JERR.LT.0) GOTO 600                                          GETCHN    163
        IF(RECORD) WRITE(IREC,'(A)')STRING                              GETCHN    164
C                                                              Default  GETCHN    165
        IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN                GETCHN    166
          IF(ISCN.EQ.1)THEN                                             GETCHN    167
            V1=TMN                                                      GETCHN    168
            V2=TMX                                                      GETCHN    169
          ELSEIF(ISCN.EQ.KCH(1)+2)THEN                                  GETCHN    170
            CALL YSCALE(CYMN,CYMX,V1,V2)                                GETCHN    171
          ELSE                                                          GETCHN    172
            CALL YSCALE(YMN(ISCN-1),YMX(ISCN-1),V1,V2)                  GETCHN    173
          ENDIF                                                         GETCHN    174
C                                                            Min - Max  GETCHN    175
        ELSEIF(STRING(1:1).EQ.'M'.OR.STRING(1:1).EQ.'m')THEN            GETCHN    176
          IF(ISCN.EQ.1)THEN                                             GETCHN    177
            V1=TMN                                                      GETCHN    178
            V2=TMX                                                      GETCHN    179
          ELSEIF(ISCN.EQ.KCH(1)+2)THEN                                  GETCHN    180
            V1=CYMN                                                     GETCHN    181
            V2=CYMX                                                     GETCHN    182
          ELSE                                                          GETCHN    183
            V1=YMN(ISCN-1)                                              GETCHN    184
            V2=YMX(ISCN-1)                                              GETCHN    185
          ENDIF                                                         GETCHN    186
C                                                       User specified  GETCHN    187
        ELSE                                                            GETCHN    188
          READ(STRING,*,IOSTAT=IOS)V1,V2                                GETCHN    189
          IF(IOS.NE.0)GOTO 600                                          GETCHN    190
        ENDIF                                                           GETCHN    191
C                                                     Process the data  GETCHN    192
        IF(ISCN.EQ.1)THEN                                               GETCHN    193
          VMN1=TMN                                                      GETCHN    194
          VMX1=TMX                                                      GETCHN    195
        ELSEIF(ISCN.EQ.KCH(1)+2)THEN                                    GETCHN    196
          VMN1=CYMN                                                     GETCHN    197
          VMX1=CYMX                                                     GETCHN    198
        ELSE                                                            GETCHN    199
          VMN1=YMN(ISCN-1)                                              GETCHN    200
          VMX1=YMX(ISCN-1)                                              GETCHN    201
        ENDIF                                                           GETCHN    202
C                                                                       GETCHN    203
        IF((V1.GE.V2).OR.                                               GETCHN    204
     +     (V1.LE.VMN1.AND.V2.LE.VMN1).OR.                              GETCHN    205
     +     (V1.GE.VMX1.AND.V2.GE.VMX1))THEN                             GETCHN    206
          WRITE(LOUT,4000)                                              GETCHN    207
          GOTO 600                                                      GETCHN    208
        ENDIF                                                           GETCHN    209
C                                                                       GETCHN    210
        IF(ISCN.NE.1)THEN                                               GETCHN    211
          IF(ISCN.EQ.KCH(1)+2)THEN                                      GETCHN    212
            CYMN1=V1                                                    GETCHN    213
            CYMX1=V2                                                    GETCHN    214
          ELSE                                                          GETCHN    215
            YMN1(ISCN-1)=V1                                             GETCHN    216
            YMX1(ISCN-1)=V2                                             GETCHN    217
          ENDIF                                                         GETCHN    218
          GOTO 400                                                      GETCHN    219
        ELSE                                                            GETCHN    220
          TMN1=V1                                                       GETCHN    221
          TMX1=V2                                                       GETCHN    222
          DO 1000 II=1,KCH(1)                                           GETCHN    223
            IPT=0                                                       GETCHN    224
 800        IPT=IPT+1                                                   GETCHN    225
            IF(T(IPT,II).LT.V1)GOTO 800                                 GETCHN    226
            IDX1(II)=IPT                                                GETCHN    227
C                                                                       GETCHN    228
            IPT=0                                                       GETCHN    229
 900        IPT=IPT+1                                                   GETCHN    230
            IF(T(IPT,II).LT.V2.AND.IPT.LT.MAXPT(II))GOTO 900            GETCHN    231
            IDX2(II)=IPT                                                GETCHN    232
 1000     CONTINUE                                                      GETCHN    233
          SCALX=.TRUE.                                                  GETCHN    234
          GOTO 300                                                      GETCHN    235
        ENDIF                                                           GETCHN    236
      ELSE                                                              GETCHN    237
C                                                                       GETCHN    238
C                                                            X-Y Plots  GETCHN    239
C                                                                       GETCHN    240
 1300   CYMN=999999.0                                                   GETCHN    241
        CYMX=-999999.0                                                  GETCHN    242
        XMN=999999.0                                                    GETCHN    243
        XMX=-999999.0                                                   GETCHN    244
        DO 1330 II=1,KCH(1)                                             GETCHN    245
          YMN(II)=999999.0                                              GETCHN    246
          YMX(II)=-999999.0                                             GETCHN    247
          DO 1320 IPT=IDX1(II),IDX2(II)                                 GETCHN    248
            IF(YMN(II).GT.YARAY(IPT,II))YMN(II)=YARAY(IPT,II)           GETCHN    249
            IF(YMX(II).LT.YARAY(IPT,II))YMX(II)=YARAY(IPT,II)           GETCHN    250
            IF(XMN.GT.XARAY(IPT,II))XMN=XARAY(IPT,II)                   GETCHN    251
            IF(XMX.LT.XARAY(IPT,II))XMX=XARAY(IPT,II)                   GETCHN    252
 1320     CONTINUE                                                      GETCHN    253
          IF(CYMN.GT.YMN(II))CYMN=YMN(II)                               GETCHN    254
          IF(CYMX.LT.YMX(II))CYMX=YMX(II)                               GETCHN    255
          CALL YSCALE(YMN(II),YMX(II),YMN1(II),YMX1(II))                GETCHN    256
 1330   CONTINUE                                                        GETCHN    257
        CALL YSCALE(CYMN,CYMX,CYMN1,CYMX1)                              GETCHN    258
        CALL YSCALE(XMN,XMX,XMN1,XMX1)                                  GETCHN    259
C                                                                       GETCHN    260
 1400   DO 1420 II=1,KCH(1)                                             GETCHN    261
          IF(GSCALE)THEN                                                GETCHN    262
            CALL SCALEV(XMN1,XMX1,CYMN1,CYMX1,II)                       GETCHN    263
            CALL SCALED(XMN1,XMX1,CYMN1,CYMX1,II)                       GETCHN    264
          ELSE                                                          GETCHN    265
            CALL SCALEV(XMN1,XMX1,YMN1(II),YMX1(II),II)                 GETCHN    266
            CALL SCALED(XMN1,XMX1,YMN1(II),YMX1(II),II)                 GETCHN    267
          ENDIF                                                         GETCHN    268
          SCALX=.FALSE.                                                 GETCHN    269
 1420   CONTINUE                                                        GETCHN    270
C                                                                       GETCHN    271
        IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')GOTO 5000           GETCHN    272
C                                                                       GETCHN    273
 1500   WRITE(LOUT,3000)                                                GETCHN    274
        WRITE(LOUT,3100) 1,'  TIME',TMN,TMX,TMN1,TMX1                   GETCHN    275
        WRITE(LOUT,3500)                                                GETCHN    276
        WRITE(LOUT,3100) 2,'X-AXIS',XMN,XMX,XMN1,XMX1                   GETCHN    277
        WRITE(LOUT,3300)                                                GETCHN    278
        DO 1520 II=1,KCH(1)                                             GETCHN    279
          WRITE(STRING(1:4),'(I4)')KCH(II+1)                            GETCHN    280
          WRITE(LOUT,3100) II+2,'  '//STRING(1:4),YMN(II),YMX(II),      GETCHN    281
     +                                      YMN1(II),YMX1(II)           GETCHN    282
 1520   CONTINUE                                                        GETCHN    283
        WRITE(LOUT,3150) KCH(1)+3,'COMMON SCALE',CYMN,CYMX,             GETCHN    284
     +                                           CYMN1,CYMX1            GETCHN    285
        IF(GSCALE)THEN                                                  GETCHN    286
          WRITE(LOUT,'(/,A,/)') '          * COMMON SCALE IS USED'      GETCHN    287
        ELSE                                                            GETCHN    288
          WRITE(LOUT,'(/,A,/)') '          * INDIVIDUAL SCALE IS USED'  GETCHN    289
        ENDIF                                                           GETCHN    290
C                                                                       GETCHN    291
        MSG='SELECT BY # FOR SCALE CHANGE; (D)ONE,(C)OMMON SCALE:'      GETCHN    292
        CALL PMTRED(LOUT,LIN,JERR,52,MSG,'S01',STRING)                  GETCHN    293
        IF(JERR.LT.0) GOTO 500                                          GETCHN    294
        IF(RECORD)WRITE(IREC,'(A)')STRING                               GETCHN    295
        IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')GOTO 5000           GETCHN    296
        IF(STRING(1:1).EQ.'C'.OR.STRING(1:1).EQ.'c')THEN                GETCHN    297
          GSCALE=.NOT.GSCALE                                            GETCHN    298
          GOTO 1400                                                     GETCHN    299
        ENDIF                                                           GETCHN    300
        READ(STRING,*,IOSTAT=IOS) ISCN                                  GETCHN    301
        IF(IOS.NE.0.OR.ISCN.LE.0.OR.ISCN.GT.KCH(1)+3)GOTO 1500          GETCHN    302
C                                                                       GETCHN    303
 1600   IF(ISCN.EQ.1)THEN                                               GETCHN    304
          MSG='ENTER NEW T-MIN AND T-MAX. (D)EFAULT (M)IN,MAX'          GETCHN    305
        ELSEIF(ISCN.EQ.2)THEN                                           GETCHN    306
          MSG='ENTER NEW X-MIN AND X-MAX. (D)EFAULT (M)IN,MAX'          GETCHN    307
        ELSE                                                            GETCHN    308
          MSG='ENTER NEW Y-MIN AND Y-MAX. (D)EFAULT (M)IN,MAX'          GETCHN    309
        ENDIF                                                           GETCHN    310
        CALL PMTRED(LOUT,LIN,JERR,48,MSG,'S01',STRING)                  GETCHN    311
        IF(JERR.LT.0) GOTO 1600                                         GETCHN    312
        IF(RECORD) WRITE(IREC,'(A)')STRING                              GETCHN    313
C                                                              Default  GETCHN    314
        IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN                GETCHN    315
          IF(ISCN.EQ.1)THEN                                             GETCHN    316
            V1=TMN                                                      GETCHN    317
            V2=TMX                                                      GETCHN    318
          ELSEIF(ISCN.EQ.2)THEN                                         GETCHN    319
            CALL YSCALE(XMN,XMX,V1,V2)                                  GETCHN    320
          ELSEIF(ISCN.EQ.KCH(1)+3)THEN                                  GETCHN    321
            CALL YSCALE(CYMN,CYMX,V1,V2)                                GETCHN    322
          ELSE                                                          GETCHN    323
            CALL YSCALE(YMN(ISCN-2),YMX(ISCN-2),V1,V2)                  GETCHN    324
          ENDIF                                                         GETCHN    325
C                                                            Min - Max  GETCHN    326
        ELSEIF(STRING(1:1).EQ.'M'.OR.STRING(1:1).EQ.'m')THEN            GETCHN    327
          IF(ISCN.EQ.1)THEN                                             GETCHN    328
            V1=TMN                                                      GETCHN    329
            V2=TMX                                                      GETCHN    330
          ELSEIF(ISCN.EQ.2)THEN                                         GETCHN    331
            V1=XMN                                                      GETCHN    332
            V2=XMX                                                      GETCHN    333
          ELSEIF(ISCN.EQ.KCH(1)+3)THEN                                  GETCHN    334
            V1=CYMN                                                     GETCHN    335
            V2=CYMX                                                     GETCHN    336
          ELSE                                                          GETCHN    337
            V1=YMN(ISCN-2)                                              GETCHN    338
            V2=YMX(ISCN-2)                                              GETCHN    339
          ENDIF                                                         GETCHN    340
C                                                       User specified  GETCHN    341
        ELSE                                                            GETCHN    342
          READ(STRING,*,IOSTAT=IOS)V1,V2                                GETCHN    343
          IF(IOS.NE.0)GOTO 1600                                         GETCHN    344
        ENDIF                                                           GETCHN    345
C                                                     Process the data  GETCHN    346
        IF(ISCN.EQ.1)THEN                                               GETCHN    347
          VMN1=TMN                                                      GETCHN    348
          VMX1=TMX                                                      GETCHN    349
        ELSEIF(ISCN.EQ.2)THEN                                           GETCHN    350
          VMN1=XMN                                                      GETCHN    351
          VMX1=XMX                                                      GETCHN    352
        ELSEIF(ISCN.EQ.KCH(1)+3)THEN                                    GETCHN    353
          VMN1=CYMN                                                     GETCHN    354
          VMX1=CYMX                                                     GETCHN    355
        ELSE                                                            GETCHN    356
          VMN1=YMN(ISCN-2)                                              GETCHN    357
          VMX1=YMX(ISCN-2)                                              GETCHN    358
        ENDIF                                                           GETCHN    359
C                                                                       GETCHN    360
        IF((V1.GE.V2).OR.                                               GETCHN    361
     +     (V1.LE.VMN1.AND.V2.LE.VMN1).OR.                              GETCHN    362
     +     (V1.GE.VMX1.AND.V2.GE.VMX1))THEN                             GETCHN    363
          WRITE(LOUT,4000)                                              GETCHN    364
          GOTO 1600                                                     GETCHN    365
        ENDIF                                                           GETCHN    366
C                                                                       GETCHN    367
        IF(ISCN.NE.1)THEN                                               GETCHN    368
          IF(ISCN.EQ.KCH(1)+2)THEN                                      GETCHN    369
            CYMN1=V1                                                    GETCHN    370
            CYMX1=V2                                                    GETCHN    371
          ELSEIF(ISCN.EQ.2)THEN                                         GETCHN    372
            XMN1=V1                                                     GETCHN    373
            XMX1=V2                                                     GETCHN    374
            SCALX=.TRUE.                                                GETCHN    375
          ELSE                                                          GETCHN    376
            YMN1(ISCN-2)=V1                                             GETCHN    377
            YMX1(ISCN-2)=V2                                             GETCHN    378
          ENDIF                                                         GETCHN    379
          GOTO 1400                                                     GETCHN    380
        ELSE                                                            GETCHN    381
          TMN1=V1                                                       GETCHN    382
          TMX1=V2                                                       GETCHN    383
          DO 2000 II=1,KCH(1)                                           GETCHN    384
            IPT=0                                                       GETCHN    385
 1800       IPT=IPT+1                                                   GETCHN    386
            IF(T(IPT,II).LT.V1)GOTO 1800                                GETCHN    387
            IDX1(II)=IPT                                                GETCHN    388
C                                                                       GETCHN    389
            IPT=0                                                       GETCHN    390
 1900       IPT=IPT+1                                                   GETCHN    391
            IF(T(IPT,II).LT.V2.AND.IPT.LT.MAXPT(II))GOTO 1900           GETCHN    392
            IDX2(II)=IPT                                                GETCHN    393
 2000     CONTINUE                                                      GETCHN    394
          SCALX=.TRUE.                                                  GETCHN    395
          GOTO 1300                                                     GETCHN    396
        ENDIF                                                           GETCHN    397
      ENDIF                                                             GETCHN    398
C                                                                       GETCHN    399
 5000 CONTINUE                                                          GETCHN    400
      KRECFD(1,1)=KCH(1)                                                GETCHN    401
      IF(GSCALE) SSCALE=.FALSE.                                         GETCHN    402
      RETURN                                                            GETCHN    403
 1200 FORMAT(/,10X,'...................................',/              GETCHN    404
     1,10X,':   READING CHANNEL FILE. WAIT    :',/                      GETCHN    405
     1,10X,':.................................:')                       GETCHN    406
 3000 FORMAT(///,49X,'SELECTED',/,49X,8('-'),/,10X,'#',18X,'T-MIN'      GETCHN    407
     *,4X,'T-MAX    T-MIN    T-MAX',/,9X,'---',13X,4(' --------'))      GETCHN    408
 3010 FORMAT(///,49X,'SELECTED',/,49X,8('-'),/,10X,'#',18X,'F-MIN'      GETCHN    409
     *,4X,'F-MAX    F-MIN    F-MAX',/,9X,'---',13X,4(' --------'))      GETCHN    410
 3100 FORMAT(I11,5X,A,3X,4F9.3)                                         GETCHN    411
 3150 FORMAT(/,I11,2X,A,4F9.3)                                          GETCHN    412
 3200 FORMAT(18X,A,3X,4F9.3)                                            GETCHN    413
 3300 FORMAT(/,10X,'       CHANNEL'                                     GETCHN    414
     *,5X,'Y-MIN    Y-MAX    Y-MIN    Y-MAX',/,9X,'        ------- '    GETCHN    415
     *,4(' --------'))                                                  GETCHN    416
 3500 FORMAT(/,10X,19X,'X-MIN'                                          GETCHN    417
     *,4X,'X-MAX    X-MIN    X-MAX',/,9X,16X,4(' --------'))            GETCHN    418
 4000 FORMAT(/,2X,'SPECIFIED  RANGE IS NOT VALID')                      GETCHN    419
      END                                                               GETCHN    420
      SUBROUTINE WNTYPE(NTYPE,NTIT,NSTATE)                              GETCHN    421
CD                                                                      GETCHN    422
CD        THIS ROUTINE USES THE TYPE OF CHANNEL TO DETERMINE THE        GETCHN    423
CD        PLOT TITLE AND STATE NUMBER                                   GETCHN    424
CD                                                                      GETCHN    425
CD        CALLING PARAMETERS :                                          GETCHN    426
CD                                                                      GETCHN    427
CD                     NTYPE  -  CHANNEL TYPE                           GETCHN    428
CD                     NTIT   -  TITLE NUMBER                           GETCHN    429
CD                     NSTATE -  STATE NUMBER                           GETCHN    430
CD                                                                      GETCHN    431
      NTIT=NTYPE                                                        GETCHN    432
      IF(NTYPE.LT.500) RETURN                                           GETCHN    433
      NTIT=NTYPE/100                                                    GETCHN    434
      NSTATE=NTYPE-NTIT*100                                             GETCHN    435
      NTIT=NTIT+49                                                      GETCHN    436
      RETURN                                                            GETCHN    437
      END                                                               GETCHN    438
C***********************************************************            GETCHN    439
      SUBROUTINE FIRSTP(STRING,IFR)                                     GETCHN    440
CD                                                                      GETCHN    441
CD    THIS SUBROUTINE DISPLAYS CONTENTS OF PLOT BUFFERS AND             GETCHN    442
CD    PROMPTS THE USER FOR A VARIETY OF OPTIONS                         GETCHN    443
CD                                                                      GETCHN    444
C                                                                       GETCHN    445
      INCLUDE 'PARAM.INS'                                               GETCHN    446
      INCLUDE 'SOAPC1.INS'                                              GETCHN    447
      INCLUDE 'XYARAY.INS'                                              GETCHN    448
      INCLUDE 'JJNAME.INS'                                              GETCHN    449
      INCLUDE 'GTIT.INS'                                                GETCHN    450
      INCLUDE 'CHDISP.INS'                                              GETCHN    451
C                                                                       GETCHN    452
      CHARACTER*80 TITCAS,TITSWI,TITEXT                                 GETCHN    453
      CHARACTER*12 TITDAT                                               GETCHN    454
      CHARACTER*4  TITVER                                               GETCHN    455
      COMMON /BITEXT/ TITCAS,TITSWI,TITEXT,TITDAT,TITVER                GETCHN    456
      COMMON /RECPT/ KRSTRT,ISTNAM,IIDARY,ITYARY,IHREC,ICHAN            GETCHN    457
     *   ,NPFL,LRREC,IRREC                                              GETCHN    458
      COMMON /BSAVEM/ ISLAST                                            GETCHN    459
      CHARACTER*1 AA(9)                                                 GETCHN    460
      CHARACTER*2 UID                                                   GETCHN    461
      CHARACTER*80 STRING,MSG,CHRBUF                                    GETCHN    462
      CHARACTER*82 ACOMMD                                               GETCHN    463
      INTEGER NXWORD,LENS                                               GETCHN    464
      DATA AA/'1','2','3','4','5','6','7','8','9'/                      GETCHN    465
C                                                                       GETCHN    466
      IFR=KCH(1)+1                                                      GETCHN    467
      DO 40 I=IFR,6                                                     GETCHN    468
        ICHTYP(I)=0                                                     GETCHN    469
   40 CONTINUE                                                          GETCHN    470
C                                                                       GETCHN    471
   50 CONTINUE                                                          GETCHN    472
      L=LENS(STRING)                                                    GETCHN    473
      IF(L.GT.0)THEN                                                    GETCHN    474
        ACOMMD=STRING(1:L)                                              GETCHN    475
      ELSE                                                              GETCHN    476
        ACOMMD=' '                                                      GETCHN    477
      ENDIF                                                             GETCHN    478
      ACOMMD(81:82)=' /'                                                GETCHN    479
C                                                                       GETCHN    480
      L=1                                                               GETCHN    481
      IF(ACOMMD(1:1).EQ.' ') L=NXWORD(ACOMMD,L)                         GETCHN    482
C                                   Start processing next channel spec  GETCHN    483
  200 IF(ACOMMD(L:L).EQ.',')THEN                                        GETCHN    484
        L=L+1                                                           GETCHN    485
        L=NXWORD(ACOMMD,L)                                              GETCHN    486
      ENDIF                                                             GETCHN    487
      IF(ACOMMD(L:L).EQ.'/') GOTO 150                                   GETCHN    488
C                                                  To delete a channel  GETCHN    489
      IF(ACOMMD(L:L).EQ.'-') THEN                                       GETCHN    490
        READ(ACOMMD(L+1:),*,IOSTAT=IOS)IBF                              GETCHN    491
        J=INDEX(ACOMMD(L+1:),',')+L                                     GETCHN    492
        K=INDEX(ACOMMD(L+1:),' ')+L                                     GETCHN    493
        IF(J.NE.L.AND.J.LT.K)THEN                                       GETCHN    494
           L=J+1                                                        GETCHN    495
        ELSE                                                            GETCHN    496
           L=NXWORD(ACOMMD,L)                                           GETCHN    497
           IF(ACOMMD(L:L).EQ.',')THEN                                   GETCHN    498
             L=L+1                                                      GETCHN    499
             L=NXWORD(ACOMMD,L)                                         GETCHN    500
           ENDIF                                                        GETCHN    501
        ENDIF                                                           GETCHN    502
        IF(IOS.NE.0.OR.                                                 GETCHN    503
     +     IBF.LT.1.OR.IBF.GT.6)THEN                                    GETCHN    504
          WRITE(LOUT,'(A)')                                             GETCHN    505
     +     ' *** ERROR - BUFFER NUMBER MUST BE BETWEEN 1 AND 6.'        GETCHN    506
        ELSE                                                            GETCHN    507
          IF(IBF.GT.KCH(1))GOTO 200                                     GETCHN    508
          IF(ISLAST.GT.0)ISLAST=ISLAST-1                                GETCHN    509
          KCH(1)=KCH(1)-1                                               GETCHN    510
          IF(KCH(1).GT.0)THEN                                           GETCHN    511
            DO 440 I=IBF,KCH(1)                                         GETCHN    512
              KCH(I+1)=KCH(I+2)                                         GETCHN    513
              YTITLE(I)=YTITLE(I+1)                                     GETCHN    514
              LTITLE(I)=LTITLE(I+1)                                     GETCHN    515
              LTITL2(I)=LTITL2(I+1)                                     GETCHN    516
              CTITLE(I)=CTITLE(I+1)                                     GETCHN    517
              CTITL2(I)=CTITL2(I+1)                                     GETCHN    518
              CASEID(I)=CASEID(I+1)                                     GETCHN    519
              FILCHN(I)=FILCHN(I+1)                                     GETCHN    520
              ICHTYP(I)=ICHTYP(I+1)                                     GETCHN    521
              DISPCH(1,I)=DISPCH(1,I+1)                                 GETCHN    522
              DISPCH(2,I)=DISPCH(2,I+1)                                 GETCHN    523
              MAXPT(I)=MAXPT(I+1)                                       GETCHN    524
              DO 420 IQ=1,MAXPT(I)                                      GETCHN    525
                T(IQ,I)=T(IQ,I+1)                                       GETCHN    526
                XARAY(IQ,I)=XARAY(IQ,I+1)                               GETCHN    527
                YARAY(IQ,I)=YARAY(IQ,I+1)                               GETCHN    528
  420         CONTINUE                                                  GETCHN    529
  440       CONTINUE                                                    GETCHN    530
          ELSE                                                          GETCHN    531
            FILLED=.FALSE.                                              GETCHN    532
            IPLTYP=0                                                    GETCHN    533
            DO 450 I=1,6                                                GETCHN    534
              ICHTYP(I)=0                                               GETCHN    535
  450       CONTINUE                                                    GETCHN    536
          ENDIF                                                         GETCHN    537
          IF(IBF.LT.IFR)IFR=IFR-1                                       GETCHN    538
        ENDIF                                                           GETCHN    539
        GOTO 200                                                        GETCHN    540
      ENDIF                                                             GETCHN    541
C                                  Check if channel number or variable  GETCHN    542
      DO 210 II=1,9                                                     GETCHN    543
        IF(ACOMMD(L:L).EQ.AA(II))GOTO 215                               GETCHN    544
  210 CONTINUE                                                          GETCHN    545
      GOTO 600                                                          GETCHN    546
C                                                       Channel number  GETCHN    547
  215 READ(ACOMMD(L:),*,IOSTAT=IOS) I                                   GETCHN    548
      IF(IOS.NE.0) GOTO 600                                             GETCHN    549
      J=INDEX(ACOMMD(L+1:),',')+L                                       GETCHN    550
      K=INDEX(ACOMMD(L+1:),' ')+L                                       GETCHN    551
      IF(J.NE.L.AND.J.LT.K)THEN                                         GETCHN    552
         L=J+1                                                          GETCHN    553
      ELSE                                                              GETCHN    554
         L=NXWORD(ACOMMD,L)                                             GETCHN    555
         IF(ACOMMD(L:L).EQ.',')THEN                                     GETCHN    556
           L=L+1                                                        GETCHN    557
           L=NXWORD(ACOMMD,L)                                           GETCHN    558
         ENDIF                                                          GETCHN    559
      ENDIF                                                             GETCHN    560
      IF(I.GE.1.AND.I.LE.10.OR.I.GT.ICHAN)THEN                          GETCHN    561
         WRITE(LOUT,'(A,I4,A,I4)') ' *** ERROR CHANNEL',I               GETCHN    562
     *      ,' IS NOT BETWEEN  11 AND',ICHAN                            GETCHN    563
         GOTO 200                                                       GETCHN    564
      ENDIF                                                             GETCHN    565
C                                                        Add a channel  GETCHN    566
  220 IF(KCH(1).EQ.6)GOTO 200                                           GETCHN    567
      IF(IPLTYP.GT.1)THEN                                               GETCHN    568
        WRITE(LOUT,5500)                                                GETCHN    569
        WRITE(LOUT,5600)I                                               GETCHN    570
      ELSE                                                              GETCHN    571
        IPLTYP=1                                                        GETCHN    572
        FILLED=.TRUE.                                                   GETCHN    573
        KCH(1)=KCH(1)+1                                                 GETCHN    574
        KCH(KCH(1)+1)=I                                                 GETCHN    575
      ENDIF                                                             GETCHN    576
      GOTO 200                                                          GETCHN    577
C                                                     Channel variable  GETCHN    578
  600 CALL STRCHN(ACOMMD,I,NTYPE,L,*150)                                GETCHN    579
      IF(ACOMMD(L:L).EQ.' ') L=NXWORD(ACOMMD,L)                         GETCHN    580
      GOTO 220                                                          GETCHN    581
C                                                                       GETCHN    582
  150 CONTINUE                                                          GETCHN    583
      IF(KCH(1).GT.0)WRITE(LOUT,5000)                                   GETCHN    584
      DO 160 I=1,KCH(1)                                                 GETCHN    585
        IF(ICHTYP(I).EQ.0)THEN                                          GETCHN    586
          CALL UNPACK(UID,NTYPE,ITY(1,KCH(I+1)))                        GETCHN    587
          CALL WNTYPE(NTYPE,NTIT,NSTATE)                                GETCHN    588
          DISPCH(1,I)=' '                                               GETCHN    589
          DISPCH(2,I)=' '                                               GETCHN    590
          IF(NTIT.GE.36.AND.NTIT.LE.41)THEN                             GETCHN    591
            WRITE(DISPCH(1,I),5100)                                     GETCHN    592
     +       I,KCH(I+1),ITY(2,KCH(I+1)),JNAME(1,KCH(I+1)),              GETCHN    593
     +       JNAME(2,KCH(I+1)),JNAME(3,KCH(I+1))                        GETCHN    594
            WRITE(DISPCH(2,I),5200)                                     GETCHN    595
     +       ITY(3,KCH(I+1)),JNAME(4,KCH(I+1)),JNAME(5,KCH(I+1)),       GETCHN    596
     +       JNAME(6,KCH(I+1)),UID,GRPTIL(NTIT)(1:35)                   GETCHN    597
          ELSEIF(NTIT.GE.42.AND.NTIT.LE.43)THEN                         GETCHN    598
            WRITE(DISPCH(1,I),5300)                                     GETCHN    599
     +       I,KCH(I+1),JNAME(1,KCH(I+1)),JNAME(2,KCH(I+1)),            GETCHN    600
     +       JNAME(3,KCH(I+1)),JNAME(4,KCH(I+1)),JNAME(5,KCH(I+1)),     GETCHN    601
     +       JNAME(6,KCH(I+1)),GRPTIL(NTIT)(1:35)                       GETCHN    602
          ELSE                                                          GETCHN    603
            WRITE(DISPCH(1,I),5400)                                     GETCHN    604
     +       I,KCH(I+1),ITY(2,KCH(I+1)),JNAME(1,KCH(I+1)),              GETCHN    605
     +       JNAME(2,KCH(I+1)),JNAME(3,KCH(I+1)),UID,                   GETCHN    606
     +       GRPTIL(NTIT)(1:35)                                         GETCHN    607
          ENDIF                                                         GETCHN    608
        ENDIF                                                           GETCHN    609
        WRITE(LOUT,'(A)')DISPCH(1,I)                                    GETCHN    610
        IF(DISPCH(2,I).NE.' ')WRITE(LOUT,'(A)')DISPCH(2,I)              GETCHN    611
  160 CONTINUE                                                          GETCHN    612
      WRITE(LOUT,'(/)')                                                 GETCHN    613
  170 CONTINUE                                                          GETCHN    614
      MSG=' ENTER CHN SPECS TO ADD / -BUF# TO DELETE; '//               GETCHN    615
     +    '(F)INISH, (S)CALES, (L)IST:'                                 GETCHN    616
      WRITE(LOUT,'(A)') MSG                                             GETCHN    617
      MSG=' '                                                           GETCHN    618
      CALL PMTRED(LOUT,LIN,JERR,1,MSG,'S01',STRING)                     GETCHN    619
      IK=IFNBLK(STRING,79)                                              GETCHN    620
      IF(IK.EQ.0)GOTO 50                                                GETCHN    621
      CHRBUF=STRING(IK:80)                                              GETCHN    622
      STRING=CHRBUF                                                     GETCHN    623
      IF(JERR.LT.0) GOTO 170                                            GETCHN    624
      IF(RECORD) WRITE(IREC,'(A)') STRING                               GETCHN    625
      IF(STRING(1:2).EQ.'L '.OR.STRING(1:2).EQ.'l ')THEN                GETCHN    626
         CALL LISTCH                                                    GETCHN    627
         GOTO 170                                                       GETCHN    628
      ENDIF                                                             GETCHN    629
      IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f') GOTO 500             GETCHN    630
      IF(STRING(1:1).EQ.'S'.OR.STRING(1:1).EQ.'s') GOTO 500             GETCHN    631
      GOTO 50                                                           GETCHN    632
C                                                                       GETCHN    633
  500 CONTINUE                                                          GETCHN    634
      DO 550 I=1,KCH(1)                                                 GETCHN    635
        IF(ICHTYP(I).EQ.0)THEN                                          GETCHN    636
          ICHTYP(I)=1                                                   GETCHN    637
          CALL UNPACK(UID,NTYPE,ITY(1,KCH(I+1)))                        GETCHN    638
          CALL WNTYPE(NTYPE,NTIT,NSTATE)                                GETCHN    639
          IF(NTIT.EQ.4.AND.RELATE)THEN                                  GETCHN    640
            YTITLE(I)='GENERATOR RELATIVE ANGLE'                        GETCHN    641
          ELSE                                                          GETCHN    642
            YTITLE(I)=GRPTIL(NTIT)                                      GETCHN    643
            IF(NTIT.EQ.54.OR.NTIT.EQ.55)                                GETCHN    644
     *      WRITE(YTITLE(I)(30:35),'(I6)') NSTATE                       GETCHN    645
          ENDIF                                                         GETCHN    646
          CALL BUSNAM(LTITLE(I),KCH(I+1),KLFO,III)                      GETCHN    647
          WRITE(LTITL2(I),'(A,I3)') 'CH# ',KCH(I+1)                     GETCHN    648
          CTITLE(I)=TITCAS                                              GETCHN    649
          CTITL2(I)=CHNLFI                                              GETCHN    650
          FILCHN(I)=CHNLFI                                              GETCHN    651
          CASEID(I)=CASID                                               GETCHN    652
          CALL RECFLD(KCH(I+1),KRECFD(I+1,1),KRECFD(I+1,2))             GETCHN    653
        ENDIF                                                           GETCHN    654
  550 CONTINUE                                                          GETCHN    655
      RETURN                                                            GETCHN    656
C                                                                       GETCHN    657
 5000 FORMAT(////,' BUF CHN      BUS# BUS NAME     ID',17X,'TYPE',/     GETCHN    658
     *,' --- ---     ----- ------------ --    ',35('-'))                GETCHN    659
 5100 FORMAT(I4,I5,' (F)',I5,1X,3A4)                                    GETCHN    660
 5200 FORMAT(9X,' (T)',I5,1X,3A4,1X,A2,4X,A)                            GETCHN    661
 5300 FORMAT(I4,I5,4X,6A4,1X,A)                                         GETCHN    662
 5400 FORMAT(I4,I5,I9,1X,3A4,1X,A2,4X,A)                                GETCHN    663
 5500 FORMAT(/,                                                         GETCHN    664
     + 10X,'BUFFERS CONTAIN INCOMPATIBLE DATA',                         GETCHN    665
     + /,10X,'PLEASE USE DEL=ALL BEFORE READING FROM BINARY FILE')      GETCHN    666
 5600 FORMAT(/,10X,'CHANNEL ',I3, ' WILL NOT BE READ.')                 GETCHN    667
      END                                                               GETCHN    668
C*********************************************************************  GETCHN    669
      INTEGER FUNCTION NXWORD(STRING,I)                                 GETCHN    670
CD                                                                      GETCHN    671
CD   THIS FUNCTION SEARCHES A STRING STARTING FROM INDEX I AND          GETCHN    672
CD   RETURNS THE INDEX TO THE FIRST NON BLANK CHARACTER AFTER A         GETCHN    673
CD   BLANK CHARACTER.                                                   GETCHN    674
CD   IF THE SEARCH FAILS, A VALUE OF ZERO IS RETURNED.                  GETCHN    675
CD                                                                      GETCHN    676
C                                                                       GETCHN    677
      CHARACTER*(*) STRING                                              GETCHN    678
C                                                                       GETCHN    679
      IL=LEN(STRING)                                                    GETCHN    680
      NXWORD=INDEX(STRING(I:),' ')                                      GETCHN    681
      IF(NXWORD.EQ.0)GOTO 9999                                          GETCHN    682
      NXWORD=NXWORD+I                                                   GETCHN    683
C                                                                       GETCHN    684
 100  IF(NXWORD.LE.IL)THEN                                              GETCHN    685
        IF(STRING(NXWORD:NXWORD).NE.' ')GOTO 9999                       GETCHN    686
        NXWORD=NXWORD+1                                                 GETCHN    687
        GOTO 100                                                        GETCHN    688
      ELSE                                                              GETCHN    689
        NXWORD=0                                                        GETCHN    690
      ENDIF                                                             GETCHN    691
C                                                                       GETCHN    692
 9999 RETURN                                                            GETCHN    693
      END                                                               GETCHN    694
