CFPRIME FNCTN                                                           FNCTN       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 FNCTN                                                FNCTN       3
CD                                                                      FNCTN       4
CD              THIS ROUTINE ALLOWS COMPLEX FUNCTIONS TO BE OPERATED    FNCTN       5
CD              ON THE CHANNEL LISTS AND VARIABLES. THE FACILITIES      FNCTN       6
CD              AVIALABLE ARE:                                          FNCTN       7
CD                                                                      FNCTN       8
CD                       1) DEFINING THE VARIABLE AND CHANNEL LISTS     FNCTN       9
CD                       2) BASIC ARITHMETIC OPERATIONS                 FNCTN      10
CD                       3) BUILT-IN FUNCTIONS SUCH AS SIN,COS,.,ETC.   FNCTN      11
CD                       4) COMMANDS SUCH AS LIST, SHOW AND PLOT .      FNCTN      12
CD                                                                      FNCTN      13
      INCLUDE 'PARAM.INS'                                               FNCTN      14
      INCLUDE 'SOAPC1.INS'                                              FNCTN      15
      INCLUDE 'XYARAY.INS'                                              FNCTN      16
      INCLUDE 'DBFLG.INS'                                               FNCTN      17
      INCLUDE 'GTIT.INS'                                                FNCTN      18
      INCLUDE 'JJNAME.INS'                                              FNCTN      19
      INCLUDE 'CHDISP.INS'                                              FNCTN      20
        COMMON /SCFLAG/ IFLG                                            FNCTN      21
        CHARACTER*2 UID                                                 FNCTN      22
        CHARACTER*3 MPROMP                                              FNCTN      23
        CHARACTER*10 FUNC(30),FNC                                       FNCTN      24
        CHARACTER*50 FILE                                               FNCTN      25
        CHARACTER*6 LISNAM(MAXLIS),VARNAM(MAXVAR),NAME                  FNCTN      26
        CHARACTER*80 STRING,CHNLIS(MAXLIS),TEMP,TEMP1,TEMP2,MSG,        FNCTN      27
     *          ERRMSG,STR1,STR2                                        FNCTN      28
        INTEGER NCHN(MAXLIS),CHN(MAXLIS,MAXCHN),BUFPNT(MAXLIS,NBUF)     FNCTN      29
        REAL BUF(NBUF,MXPT),VAR(MAXVAR),TIME(MXPT),TIMEN(MXPT),         FNCTN      30
     *          BUF2(MXPT)                                              FNCTN      31
        LOGICAL RE1,RE2,FOUND,FOUNV1,FOUNV2,FOUNL1,FOUNL2               FNCTN      32
C                                                                       FNCTN      33
        COMMON /FUNCTR/BUF,VAR,TIME,TIMEN,BUF2                          FNCTN      34
        COMMON /FUNCTC/LISNAM,VARNAM,CHNLIS                             FNCTN      35
        COMMON /FUNCTI/NCHN,CHN,BUFPNT,LRECFD                           FNCTN      36
C                                                                       FNCTN      37
        DIMENSION LRECFD(MCHNL,2)                                       FNCTN      38
C                                                                       FNCTN      39
C   ......................................................              FNCTN      40
C   : TEXTS AS READ FROM BIN FILE                        :              FNCTN      41
      CHARACTER*80 TITCAS,TITSWI,TITEXT                                 FNCTN      42
      CHARACTER*12 TITDAT                                               FNCTN      43
      CHARACTER*4  TITVER                                               FNCTN      44
      COMMON /BITEXT/ TITCAS,TITSWI,TITEXT,TITDAT,TITVER                FNCTN      45
C   :....................................................:              FNCTN      46
C                                                                       FNCTN      47
        DATA FUNC /'**','/','*','^','+','-',                            FNCTN      48
     *          'ATAN2','POLAR','RECTANGL',                             FNCTN      49
     *          'ACOS','ASIN','ATAN','COSH','SINH','TANH',              FNCTN      50
     *          'COS','SIN','TAN','LOG10','LOG','SQRT',                 FNCTN      51
     *          'ABS','EXP','DELTA','DEL_R','MIN','MAX',                FNCTN      52
     *          'INTEG','DERIV',' '/                                    FNCTN      53
C                                                                       FNCTN      54
        NOCH=KCH(1)                                                     FNCTN      55
        IF(IPLTYP.EQ.2)THEN                                             FNCTN      56
          IFLG=1                                                        FNCTN      57
        ELSE                                                            FNCTN      58
          IFLG=0                                                        FNCTN      59
        ENDIF                                                           FNCTN      60
        NFUNCS=29                                                       FNCTN      61
C                                                                       FNCTN      62
        MPROMP=' # '                                                    FNCTN      63
C       PRESET CONSTANTS                                                FNCTN      64
        IF(NVAR.EQ.0)NVAR=3                                             FNCTN      65
        VARNAM(1)='PI'                                                  FNCTN      66
        VAR(1)=3.1415927                                                FNCTN      67
        VARNAM(2)='RTD'                                                 FNCTN      68
        VAR(2)=57.29578                                                 FNCTN      69
        VARNAM(3)='DTR'                                                 FNCTN      70
        VAR(3)=0.0174533                                                FNCTN      71
          IF(NLIS.EQ.0)THEN                                             FNCTN      72
            NLIS=1                                                      FNCTN      73
            NPOINT=1                                                    FNCTN      74
            LISNAM(NLIS)='TIME'                                         FNCTN      75
            NCHN(NLIS)=1                                                FNCTN      76
            BUFPNT(NLIS,1)=NPOINT                                       FNCTN      77
          ENDIF                                                         FNCTN      78
C       ********************************************                    FNCTN      79
  10    CONTINUE                                                        FNCTN      80
C       ********************************************                    FNCTN      81
C       WRITE(LOUT,1000)MPROMP                                          FNCTN      82
C       READ(*,1010)STRING                                              FNCTN      83
        CALL PMTRED(LOUT,LIN,JERR,3,MPROMP,'CAL',STRING)                FNCTN      84
        IF(RECORD)WRITE(IREC,1010) STRING                               FNCTN      85
        CALL UPCAS1(STRING,80)                                          FNCTN      86
        CALL PACK(STRING)                                               FNCTN      87
C       CHECK FOR UNARY MINUS                                           FNCTN      88
        XS1=1.0                                                         FNCTN      89
        XS2=1.0                                                         FNCTN      90
        IND1=INDEX(STRING,'(-')                                         FNCTN      91
        IF(IND1.NE.0)THEN                                               FNCTN      92
          XS1=-1.0                                                      FNCTN      93
          IF(IND1.EQ.1)THEN                                             FNCTN      94
            NN1=INDEX(STRING,')')-1                                     FNCTN      95
            NN2=INDEX(STRING,')')+1                                     FNCTN      96
            STRING=STRING(3:NN1)//                                      FNCTN      97
     *          STRING(NN2:80)                                          FNCTN      98
          ELSE                                                          FNCTN      99
            NN1=INDEX(STRING,')')-1                                     FNCTN     100
            NN2=INDEX(STRING,')')+1                                     FNCTN     101
            IND11=IND1-1                                                FNCTN     102
            STRING=STRING(1:IND11)//                                    FNCTN     103
     *          STRING(IND1+2:NN1)//                                    FNCTN     104
     *          STRING(NN2:80)                                          FNCTN     105
          ENDIF                                                         FNCTN     106
          IND2=INDEX(STRING,'(-')                                       FNCTN     107
          IF(IND2.NE.0)THEN                                             FNCTN     108
            XS2=-1.0                                                    FNCTN     109
            NN1=INDEX(STRING,')')-1                                     FNCTN     110
            NN2=INDEX(STRING,')')+1                                     FNCTN     111
            IND21=IND2-1                                                FNCTN     112
            STRING=STRING(1:IND21)//                                    FNCTN     113
     *          STRING(IND2+2:NN1)//                                    FNCTN     114
     *          STRING(NN2:80)                                          FNCTN     115
          ENDIF                                                         FNCTN     116
        ENDIF                                                           FNCTN     117
C       CHECK FOR OPERATIONS                                            FNCTN     118
        IFUNC=0                                                         FNCTN     119
        DO 20 I=1,NFUNCS                                                FNCTN     120
          INDF=INDEX(STRING,FUNC(I)(1:ISLEN(FUNC(I))))                  FNCTN     121
          IF(INDF.NE.0)THEN                                             FNCTN     122
            IFUNC=I                                                     FNCTN     123
            GOTO 30                                                     FNCTN     124
          ENDIF                                                         FNCTN     125
 20     CONTINUE                                                        FNCTN     126
 30     CONTINUE                                                        FNCTN     127
C       IF ARITHMETIC OPERATION, UNARY MINUS MAY BE 2ND OPERAND         FNCTN     128
        IF((IFUNC.GE.1).AND.(IFUNC.LE.6).AND.(IND1.GT.INDF))THEN        FNCTN     129
          XS1=1.0                                                       FNCTN     130
          XS2=-1.0                                                      FNCTN     131
        ENDIF                                                           FNCTN     132
        NN1=INDEX(STRING,'=')+1                                         FNCTN     133
        TEMP1=STRING(NN1:80)                                            FNCTN     134
        IF((TEMP1(1:1).EQ.'-').OR.(TEMP1(1:1).EQ.'+'))IFUNC=0           FNCTN     135
C       ********************************************                    FNCTN     136
C       DETERMINE STRINGS                                               FNCTN     137
C       ********************************************                    FNCTN     138
C       DETECT STRING LIKE ( ,) ,{ , } FOR THE USE IN                   FNCTN     139
C       IN THE ASSIGNMENT OF NEW CHANNEL LIST                           FNCTN     140
C                                                                       FNCTN     141
            NEW1X=INDEX(STRING,'(')                                     FNCTN     142
            NEW2X=INDEX(STRING,')')                                     FNCTN     143
            NEW3X=INDEX(STRING,'{')                                     FNCTN     144
            NEW4X=INDEX(STRING,'}')                                     FNCTN     145
            NEW5X=INDEX(STRING,'=')                                     FNCTN     146
C                                                                       FNCTN     147
        IF(STRING(1:6).EQ.'RETURN')THEN                                 FNCTN     148
          GOTO 999                                                      FNCTN     149
C       ********************************************                    FNCTN     150
C       ********************************************                    FNCTN     151
        ELSE IF(STRING(1:5).EQ.'CLEAR')THEN                             FNCTN     152
C         PRESET CONSTANTS                                              FNCTN     153
          NVAR=3                                                        FNCTN     154
          VARNAM(1)='PI'                                                FNCTN     155
          VAR(1)=3.1415927                                              FNCTN     156
          VARNAM(2)='RTD'                                               FNCTN     157
          VAR(2)=57.29578                                               FNCTN     158
          VARNAM(3)='DTR'                                               FNCTN     159
          VAR(3)=0.0174533                                              FNCTN     160
          NLIS=1                                                        FNCTN     161
          NPOINT=1                                                      FNCTN     162
          LISNAM(NLIS)='TIME'                                           FNCTN     163
          NCHN(NLIS)=1                                                  FNCTN     164
          BUFPNT(NLIS,1)=NPOINT                                         FNCTN     165
C       ********************************************                    FNCTN     166
C       ********************************************                    FNCTN     167
        ELSE IF(STRING(1:4).EQ.'LIST')THEN                              FNCTN     168
          IF(NVAR.EQ.0)THEN                                             FNCTN     169
            WRITE(LOUT,*)'NO VARIABLES'                                 FNCTN     170
          ELSE                                                          FNCTN     171
            WRITE(LOUT,*)'CURRENT VARIABLES'                            FNCTN     172
            WRITE(LOUT,2010)(VARNAM(I),I=1,NVAR)                        FNCTN     173
          ENDIF                                                         FNCTN     174
          IF(NLIS.EQ.0)THEN                                             FNCTN     175
            WRITE(LOUT,*)'NO CHANNEL LISTS'                             FNCTN     176
          ELSE                                                          FNCTN     177
            WRITE(LOUT,*)'CURRENT CHANNEL LISTS'                        FNCTN     178
            STR1=' '                                                    FNCTN     179
            DO 32 I=1,NLIS                                              FNCTN     180
              WRITE(STR2,'(I4)')NCHN(I)                                 FNCTN     181
              CALL PACK(STR2)                                           FNCTN     182
              STR1=STR1(1:ISLEN(STR1)+1)//'  '//LISNAM(I)(1:            FNCTN     183
     *          ISLEN(LISNAM(I)))//'('//STR2(1:ISLEN(STR2))//')'        FNCTN     184
  32        CONTINUE                                                    FNCTN     185
            WRITE(LOUT,*)STR1                                           FNCTN     186
          ENDIF                                                         FNCTN     187
 2010     FORMAT(1X,8(A7))                                              FNCTN     188
C       ********************************************                    FNCTN     189
C       SHOW CONTENTS OF CHANNEL LISTS AND VARIABLES                    FNCTN     190
C       ********************************************                    FNCTN     191
        ELSE IF(STRING(1:4).EQ.'SHOW')THEN                              FNCTN     192
          NN1=INDEX(STRING,'SHOW')+4                                    FNCTN     193
          TEMP=STRING(NN1:80)                                           FNCTN     194
          NSHOW=1                                                       FNCTN     195
          DO 35 I=1,80                                                  FNCTN     196
            IF(TEMP(I:I).EQ.',')NSHOW=NSHOW+1                           FNCTN     197
  35      CONTINUE                                                      FNCTN     198
          DO 38 K=1,NSHOW                                               FNCTN     199
            IF(K.NE.NSHOW)THEN                                          FNCTN     200
              NN1=INDEX(TEMP,',')-1                                     FNCTN     201
              TEMP1=TEMP(1:NN1)                                         FNCTN     202
              NN2=INDEX(TEMP,',')+1                                     FNCTN     203
              TEMP=TEMP(NN2:80)                                         FNCTN     204
            ELSE                                                        FNCTN     205
              TEMP1=TEMP                                                FNCTN     206
            ENDIF                                                       FNCTN     207
            CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR,FOUND)              FNCTN     208
            IF(FOUND)THEN                                               FNCTN     209
              WRITE(LOUT,*)'VARIABLE ',VARNAM(IVAR),' = ',VAR(IVAR)     FNCTN     210
              GOTO 38                                                   FNCTN     211
            ENDIF                                                       FNCTN     212
            TEMP2=' '                                                   FNCTN     213
            NN1=INDEX(TEMP1,'(')                                        FNCTN     214
            NN2=INDEX(TEMP1,')')                                        FNCTN     215
            IF(NN1.NE.0)THEN                                            FNCTN     216
              NNP1=NN1+1                                                FNCTN     217
              NNM1=NN1-1                                                FNCTN     218
              NNM2=NN2-1                                                FNCTN     219
              TEMP2=TEMP1(NNP1:NNM2)                                    FNCTN     220
              TEMP1=TEMP1(1:NNM1)                                       FNCTN     221
            ENDIF                                                       FNCTN     222
            CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS,FOUND)              FNCTN     223
            IF(FOUND)THEN                                               FNCTN     224
              ICOLON=INDEX(TEMP2,':')                                   FNCTN     225
              IF(ICOLON.NE.0)THEN                                       FNCTN     226
                READ(TEMP2(1:ICOLON-1),*)KK1                            FNCTN     227
                READ(TEMP2(ICOLON+1:80),*)KK2                           FNCTN     228
              ELSE IF(TEMP2.NE.' ')THEN                                 FNCTN     229
                READ(TEMP2,*)KK                                         FNCTN     230
                KK1=KK                                                  FNCTN     231
                KK2=KK                                                  FNCTN     232
              ELSE                                                      FNCTN     233
                KK1=1                                                   FNCTN     234
                KK2=NCHN(ILIS)                                          FNCTN     235
              ENDIF                                                     FNCTN     236
C       LIMIT TO 6 CHANNELS PER SHOW                                    FNCTN     237
              IF(KK2-KK1.GT.5)KK2=KK1+5                                 FNCTN     238
              IF((KK1.GT.NCHN(ILIS)).OR.(KK2.GT.NCHN(ILIS)))THEN        FNCTN     239
                WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(ILIS),              FNCTN     240
     *          ' ONLY HAS ',NCHN(ILIS),' CHANNELS'                     FNCTN     241
                GOTO 10                                                 FNCTN     242
              ENDIF                                                     FNCTN     243
              WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(ILIS),':'             FNCTN     244
              WRITE(LOUT,*)                                             FNCTN     245
              WRITE(LOUT,1025)(I,I=KK1,KK2)                             FNCTN     246
              WRITE(LOUT,1020)(CHN(ILIS,I),I=KK1,KK2)                   FNCTN     247
              DO 40 J=1,NTP                                             FNCTN     248
                WRITE(LOUT,1030)(BUF(BUFPNT(ILIS,I),J),I=KK1,KK2)       FNCTN     249
                IF(MOD(J,20).EQ.0)THEN                                  FNCTN     250
  36              CONTINUE                                              FNCTN     251
                  MSG='(A)bort or (C)ontinue'                           FNCTN     252
                  CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLS',STRING)FNCTN     253
                  IF(RECORD) WRITE(IREC,1010) STRING                    FNCTN     254
                  IF(STRING(1:1).EQ.'A'.OR.STRING(1:1).EQ.'a')GOTO 38   FNCTN     255
                  IF(STRING(1:1).NE.'C'.AND.STRING(1:1).NE.'c')GOTO 36  FNCTN     256
                  WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(ILIS),':'         FNCTN     257
                  WRITE(LOUT,*)                                         FNCTN     258
                  WRITE(LOUT,1025)(I,I=KK1,KK2)                         FNCTN     259
                  WRITE(LOUT,1020)(CHN(ILIS,I),I=KK1,KK2)               FNCTN     260
                ENDIF                                                   FNCTN     261
  40          CONTINUE                                                  FNCTN     262
              GOTO 38                                                   FNCTN     263
            ENDIF                                                       FNCTN     264
            WRITE(LOUT,2020)TEMP1                                       FNCTN     265
  38      CONTINUE                                                      FNCTN     266
 1020   FORMAT(1X,'CHANNELS ',6(I9))                                    FNCTN     267
 1025   FORMAT(1X,'INDEX    ',6(I9))                                    FNCTN     268
 1030   FORMAT(10X,6(F9.3))                                             FNCTN     269
C       ********************************************                    FNCTN     270
C       PLOT FROM BUFFER                                                FNCTN     271
C       ********************************************                    FNCTN     272
        ELSE IF(STRING(1:4).EQ.'PLOT')THEN                              FNCTN     273
          NN1=INDEX(STRING,'PLOT')+4                                    FNCTN     274
          TEMP=STRING(NN1:80)                                           FNCTN     275
          IVS=INDEX(TEMP,'.VS.')                                        FNCTN     276
          IF(IVS.NE.0)THEN                                              FNCTN     277
            IF(FILLED)THEN                                              FNCTN     278
              WRITE(LOUT,*)'X-AXIS ALREADY CHOSEN'                      FNCTN     279
              GOTO 10                                                   FNCTN     280
            ENDIF                                                       FNCTN     281
            NN1=INDEX(TEMP,'.VS.')+4                                    FNCTN     282
            TEMP1=TEMP(NN1:80)                                          FNCTN     283
            CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR,FOUND)              FNCTN     284
            IF(FOUND)THEN                                               FNCTN     285
              WRITE(LOUT,*)'CAN NOT PLOT VERSUS A VARIABLE'             FNCTN     286
              GOTO 10                                                   FNCTN     287
            ENDIF                                                       FNCTN     288
            TEMP2=' '                                                   FNCTN     289
            NN1=INDEX(TEMP1,'(')                                        FNCTN     290
            NN2=INDEX(TEMP1,')')                                        FNCTN     291
            IF(NN1.NE.0)THEN                                            FNCTN     292
              NNP1=NN1+1                                                FNCTN     293
              NNM1=NN1-1                                                FNCTN     294
              NNM2=NN2-1                                                FNCTN     295
              TEMP2=TEMP1(NNP1:NNM2)                                    FNCTN     296
              TEMP1=TEMP1(1:NNM1)                                       FNCTN     297
            ENDIF                                                       FNCTN     298
            CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,IVSLIS,FOUND)            FNCTN     299
            IF(FOUND)THEN                                               FNCTN     300
              IF(TEMP2.NE.' ')THEN                                      FNCTN     301
                READ(TEMP2,*)IVSCHN                                     FNCTN     302
                IF(IVSCHN.GT.NCHN(IVSLIS))THEN                          FNCTN     303
                  WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(IVSLIS),          FNCTN     304
     *            ' ONLY HAS ',NCHN(IVSLIS),' CHANNELS'                 FNCTN     305
                  GOTO 10                                               FNCTN     306
                ENDIF                                                   FNCTN     307
              ELSE                                                      FNCTN     308
                IF(NCHN(IVSLIS).NE.1)THEN                               FNCTN     309
                  WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(IVSLIS),          FNCTN     310
     *            ' HAS MORE THAN ONE CHANNEL'                          FNCTN     311
                  GOTO 10                                               FNCTN     312
                ENDIF                                                   FNCTN     313
                IVSCHN=1                                                FNCTN     314
              ENDIF                                                     FNCTN     315
            ELSE                                                        FNCTN     316
              WRITE(LOUT,*)'CHANNEL LIST FOR X-AXIS IS UNKNOWN'         FNCTN     317
              GOTO 10                                                   FNCTN     318
            ENDIF                                                       FNCTN     319
            IFLG=1                                                      FNCTN     320
            NN1=INDEX(TEMP,'.VS.')-1                                    FNCTN     321
            TEMP=TEMP(1:NN1)                                            FNCTN     322
          ENDIF                                                         FNCTN     323
          NPLOT=1                                                       FNCTN     324
          DO 42 I=1,80                                                  FNCTN     325
            IF(TEMP(I:I).EQ.',')NPLOT=NPLOT+1                           FNCTN     326
  42      CONTINUE                                                      FNCTN     327
          DO 44 K=1,NPLOT                                               FNCTN     328
            IF(K.NE.NPLOT)THEN                                          FNCTN     329
              NN1=INDEX(TEMP,',')-1                                     FNCTN     330
              TEMP1=TEMP(1:NN1)                                         FNCTN     331
              NN2=INDEX(TEMP,',')+1                                     FNCTN     332
              TEMP=TEMP(NN2:80)                                         FNCTN     333
            ELSE                                                        FNCTN     334
              TEMP1=TEMP                                                FNCTN     335
            ENDIF                                                       FNCTN     336
            CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR,FOUND)              FNCTN     337
            IF(FOUND)THEN                                               FNCTN     338
              WRITE(LOUT,*)'CAN NOT PLOT A VARIABLE'                    FNCTN     339
              GOTO 10                                                   FNCTN     340
            ENDIF                                                       FNCTN     341
            TEMP2=' '                                                   FNCTN     342
            NN1=INDEX(TEMP1,'(')                                        FNCTN     343
            IF(NN1.NE.0)THEN                                            FNCTN     344
              NNP1=NN1+1                                                FNCTN     345
              NNM1=NN1-1                                                FNCTN     346
              TEMP2=TEMP1(NNP1:NNM1)                                    FNCTN     347
              TEMP1=TEMP1(1:NNM1)                                       FNCTN     348
            ENDIF                                                       FNCTN     349
            CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS,FOUND)              FNCTN     350
            IF(FOUND)THEN                                               FNCTN     351
              ICOLON=INDEX(TEMP2,':')                                   FNCTN     352
              IF(ICOLON.NE.0)THEN                                       FNCTN     353
                READ(TEMP2(1:ICOLON-1),*)KK1                            FNCTN     354
                READ(TEMP2(ICOLON+1:80),*)KK2                           FNCTN     355
              ELSE IF(TEMP2.NE.' ')THEN                                 FNCTN     356
                READ(TEMP2,*)KK                                         FNCTN     357
                KK1=KK                                                  FNCTN     358
                KK2=KK                                                  FNCTN     359
              ELSE                                                      FNCTN     360
                KK1=1                                                   FNCTN     361
                KK2=NCHN(ILIS)                                          FNCTN     362
              ENDIF                                                     FNCTN     363
              IF((KK1.GT.NCHN(ILIS)).OR.(KK2.GT.NCHN(ILIS)))THEN        FNCTN     364
                WRITE(LOUT,*)'CHANNEL LIST ',LISNAM(ILIS),              FNCTN     365
     *          ' ONLY HAS ',NCHN(ILIS),' CHANNELS'                     FNCTN     366
                GOTO 10                                                 FNCTN     367
              ENDIF                                                     FNCTN     368
C       SET X AXIS LABEL                                                FNCTN     369
              IF((.NOT.CFLRUN).AND.(.NOT.FILLED))THEN                   FNCTN     370
                WRITE(LOUT,*)                                           FNCTN     371
                WRITE(LOUT,*)XTITLE                                     FNCTN     372
                MSG='Enter X-axis Title (D)efault, (B)lank'             FNCTN     373
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     374
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     375
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     376
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     377
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     378
     &               .NE. 'default')THEN                                FNCTN     379
                             XTITLE=STRING                              FNCTN     380
                   ENDIF                                                FNCTN     381
                  ENDIF                                                 FNCTN     382
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     383
                  XTITLE=' '                                            FNCTN     384
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     385
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     386
     &               .NE. 'blank')THEN                                  FNCTN     387
                             XTITLE=STRING                              FNCTN     388
                   ELSE                                                 FNCTN     389
                             XTITLE=' '                                 FNCTN     390
                   ENDIF                                                FNCTN     391
                  ENDIF                                                 FNCTN     392
                ELSE                                                    FNCTN     393
                  XTITLE=STRING                                         FNCTN     394
                ENDIF                                                   FNCTN     395
              ENDIF                                                     FNCTN     396
C                                                                       FNCTN     397
              DO 46 I=KK1,KK2                                           FNCTN     398
                KCH(1)=KCH(1)+1                                         FNCTN     399
                IF(KCH(1).GT.MCHNL-1)THEN                               FNCTN     400
                  KCH(1)=KCH(1)-1                                       FNCTN     401
                  WRITE(LOUT,*)'MAXIMUM OF 6 PLOTS ALLOWED'             FNCTN     402
                  GOTO 10                                               FNCTN     403
                ENDIF                                                   FNCTN     404
                KRECFD(1,1)=KCH(1)                                      FNCTN     405
                KRECFD(1,2)=KCH(1)                                      FNCTN     406
                KCH(KCH(1)+1)=CHN(ILIS,I)                               FNCTN     407
                MAXPT(KCH(1))=NTP                                       FNCTN     408
                DO 48 J=1,MAXPT(KCH(1))                                 FNCTN     409
                  IF((.NOT.FILLED).AND.(IFLG.EQ.1))THEN                 FNCTN     410
                    XARAY(J,1)=BUF(BUFPNT(IVSLIS,IVSCHN),J)             FNCTN     411
                    IPLTYP=2                                            FNCTN     412
                  ELSE IF(IFLG.EQ.1)THEN                                FNCTN     413
                    XARAY(J,KCH(1))=XARAY(J,1)                          FNCTN     414
                    IPLTYP=2                                            FNCTN     415
                  ELSE                                                  FNCTN     416
                    XARAY(J,KCH(1))=TIME(J)                             FNCTN     417
                  ENDIF                                                 FNCTN     418
                  YARAY(J,KCH(1))=BUF(BUFPNT(ILIS,I),J)                 FNCTN     419
                  T(J,KCH(1))=TIME(J)                                   FNCTN     420
  48            CONTINUE                                                FNCTN     421
                FILLED=.TRUE.                                           FNCTN     422
C       PLOT TITLES                                                     FNCTN     423
C       SET DEFAULTS                                                    FNCTN     424
                CALL UNPACK(UID,NTYPE,ITY(1,CHN(ILIS,I)))               FNCTN     425
                CALL WNTYPE(NTYPE,NTIT,NSTATE)                          FNCTN     426
                YTITLE(KCH(1))=GRPTIL(NTIT)                             FNCTN     427
                IF(NTIT.EQ.54.OR.NTIT.EQ.55)                            FNCTN     428
     +             WRITE(YTITLE(KCH(1))(30:35),'(I6)')NSTATE            FNCTN     429
                CALL BUSNAM(LTITLE(KCH(1)),CHN(ILIS,I),KLFO,III)        FNCTN     430
                WRITE(LTITL2(KCH(1)),'(A,I3)') 'CH# ',CHN(ILIS,I)       FNCTN     431
                CTITLE(KCH(1))=TITCAS                                   FNCTN     432
                CTITL2(KCH(1))=CHNLFI                                   FNCTN     433
                FILCHN(KCH(1))=CHNLFI                                   FNCTN     434
                CASEID(KCH(1))=CASID                                    FNCTN     435
C                                                                       FNCTN     436
                ICHTYP(KCH(1))=4                                        FNCTN     437
                DISPCH(1,KCH(1))='          CALCULATED FROM FILE: '     FNCTN     438
     +                       //FILCHN(KCH(1))(1:48)                     FNCTN     439
                WRITE(DISPCH(1,KCH(1))(1:6),'(I6)')CHN(ILIS,I)          FNCTN     440
                DISPCH(2,KCH(1))=' '                                    FNCTN     441
C                                                                       FNCTN     442
                IF(CFLRUN)GOTO 46                                       FNCTN     443
C                                                                       FNCTN     444
                WRITE(STR1,'(A,I2,A)')TEMP1(1:ISLEN(TEMP1))//'(',I,')'  FNCTN     445
C       SET Y AXIS TITLE                                                FNCTN     446
                WRITE(LOUT,*)                                           FNCTN     447
                WRITE(LOUT,*)YTITLE(KCH(1))                             FNCTN     448
                MSG='Enter Y-axis Title for '//STR1(1:ISLEN(STR1))//    FNCTN     449
     *                  '  (D)efault, (B)lank, (F)inished'              FNCTN     450
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     451
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     452
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     453
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     454
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     455
     &               .NE. 'default')THEN                                FNCTN     456
                             YTITLE(KCH(1))=STRING                      FNCTN     457
                   ENDIF                                                FNCTN     458
                  ENDIF                                                 FNCTN     459
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     460
                  YTITLE(KCH(1))=' '                                    FNCTN     461
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     462
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     463
     &               .NE. 'blank')THEN                                  FNCTN     464
                           YTITLE(KCH(1))=STRING                        FNCTN     465
                   ELSE                                                 FNCTN     466
                           YTITLE(KCH(1))=' '                           FNCTN     467
                   ENDIF                                                FNCTN     468
                  ENDIF                                                 FNCTN     469
                ELSE IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')THEN   FNCTN     470
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     471
                      IF(STRING(1:6).NE.'FINISH' .OR. STRING(1:5)       FNCTN     472
     &               .NE. 'finish')YTITLE(KCH(1))=STRING                FNCTN     473
                  ELSE                                                  FNCTN     474
                     GOTO 46                                            FNCTN     475
                  ENDIF                                                 FNCTN     476
                ELSE                                                    FNCTN     477
                  YTITLE(KCH(1))=STRING                                 FNCTN     478
                ENDIF                                                   FNCTN     479
C       BUS DESCRIPTION                                                 FNCTN     480
                WRITE(LOUT,*)                                           FNCTN     481
                WRITE(LOUT,*)LTITLE(KCH(1))                             FNCTN     482
                MSG='Enter Bus Description for '//STR1(1:ISLEN(STR1))// FNCTN     483
     *                  '  (D)efault, (B)lank, (F)inished'              FNCTN     484
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     485
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     486
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     487
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     488
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     489
     &               .NE. 'default')THEN                                FNCTN     490
                            LTITLE(KCH(1))=STRING                       FNCTN     491
                   ENDIF                                                FNCTN     492
                  ENDIF                                                 FNCTN     493
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     494
                  LTITLE(KCH(1))=' '                                    FNCTN     495
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     496
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     497
     &               .NE. 'blank')THEN                                  FNCTN     498
                            LTITLE(KCH(1))=STRING                       FNCTN     499
                   ELSE                                                 FNCTN     500
                            LTITLE(KCH(1))=' '                          FNCTN     501
                   ENDIF                                                FNCTN     502
                  ENDIF                                                 FNCTN     503
                ELSE IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')THEN   FNCTN     504
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     505
                      IF(STRING(1:6).NE.'FINISH' .OR. STRING(1:5)       FNCTN     506
     &               .NE. 'finish')LTITLE(KCH(1))=STRING                FNCTN     507
                  ELSE                                                  FNCTN     508
                     GOTO 46                                            FNCTN     509
                  ENDIF                                                 FNCTN     510
                ELSE                                                    FNCTN     511
                  LTITLE(KCH(1))=STRING                                 FNCTN     512
                ENDIF                                                   FNCTN     513
C       CHANNEL DESCRIPTION                                             FNCTN     514
             WRITE(LOUT,*)                                              FNCTN     515
             WRITE(LOUT,*)LTITL2(KCH(1))                                FNCTN     516
             MSG='Enter Channel Description for '//STR1(1:ISLEN(STR1))//FNCTN     517
     *                  '  (D)efault, (B)lank, (F)inished'              FNCTN     518
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     519
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     520
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     521
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     522
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     523
     &               .NE. 'default')THEN                                FNCTN     524
                             LTITL2(KCH(1))=STRING                      FNCTN     525
                   ENDIF                                                FNCTN     526
                  ENDIF                                                 FNCTN     527
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     528
                  LTITL2(KCH(1))=' '                                    FNCTN     529
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     530
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     531
     &               .NE. 'blank')THEN                                  FNCTN     532
                             LTITL2(KCH(1))=STRING                      FNCTN     533
                   ELSE                                                 FNCTN     534
                             LTITL2(KCH(1))=' '                         FNCTN     535
                   ENDIF                                                FNCTN     536
                  ENDIF                                                 FNCTN     537
                ELSE IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')THEN   FNCTN     538
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     539
                      IF(STRING(1:6).NE.'FINISH' .OR. STRING(1:5)       FNCTN     540
     &               .NE. 'finish')LTITL2(KCH(1))=STRING                FNCTN     541
                  ELSE                                                  FNCTN     542
                     GOTO 46                                            FNCTN     543
                  ENDIF                                                 FNCTN     544
                ELSE                                                    FNCTN     545
                  LTITL2(KCH(1))=STRING                                 FNCTN     546
                ENDIF                                                   FNCTN     547
                                                                        FNCTN     548
C       FILE DESCRIPTION                                                FNCTN     549
                WRITE(LOUT,*)                                           FNCTN     550
                WRITE(LOUT,*)CTITL2(KCH(1))                             FNCTN     551
                MSG='Enter File Description for '//STR1(1:ISLEN(STR1))//FNCTN     552
     *                  '  (D)efault, (B)lank, (F)inished'              FNCTN     553
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     554
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     555
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     556
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     557
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     558
     &               .NE. 'default')THEN                                FNCTN     559
                             CTITL2(KCH(1))=STRING                      FNCTN     560
                   ENDIF                                                FNCTN     561
                  ENDIF                                                 FNCTN     562
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     563
                  CTITL2(KCH(1))=' '                                    FNCTN     564
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     565
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     566
     &               .NE. 'blank')THEN                                  FNCTN     567
                             CTITL2(KCH(1))=STRING                      FNCTN     568
                   ELSE                                                 FNCTN     569
                             CTITL2(KCH(1))=' '                         FNCTN     570
                   ENDIF                                                FNCTN     571
                  ENDIF                                                 FNCTN     572
                ELSE IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')THEN   FNCTN     573
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     574
                      IF(STRING(1:6).NE.'FINISH' .OR. STRING(1:5)       FNCTN     575
     &               .NE. 'finish')CTITL2(KCH(1))=STRING                FNCTN     576
                  ELSE                                                  FNCTN     577
                     GOTO 46                                            FNCTN     578
                  ENDIF                                                 FNCTN     579
                ELSE                                                    FNCTN     580
                  CTITL2(KCH(1))=STRING                                 FNCTN     581
                ENDIF                                                   FNCTN     582
                                                                        FNCTN     583
C       CASE DESCRIPTION                                                FNCTN     584
                WRITE(LOUT,*)                                           FNCTN     585
                WRITE(LOUT,*)CTITLE(KCH(1))                             FNCTN     586
                MSG='Enter Case Description for '//STR1(1:ISLEN(STR1))//FNCTN     587
     *                  '  (D)efault, (B)lank, (F)inished'              FNCTN     588
                CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'CLT',STRING)  FNCTN     589
                IF(RECORD) WRITE(IREC,1010) STRING                      FNCTN     590
                IF(STRING(1:1).EQ.'D'.OR.STRING(1:1).EQ.'d')THEN        FNCTN     591
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     592
                   IF(STRING(1:7).NE.'DEFAULT' .OR. STRING(1:7)         FNCTN     593
     &               .NE. 'default')THEN                                FNCTN     594
                             CTITLE(KCH(1))=STRING                      FNCTN     595
                   ENDIF                                                FNCTN     596
                  ENDIF                                                 FNCTN     597
                ELSE IF(STRING(1:1).EQ.'B'.OR.STRING(1:1).EQ.'b')THEN   FNCTN     598
                  CTITLE(KCH(1))=' '                                    FNCTN     599
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     600
                   IF(STRING(1:5).NE.'BLANK' .OR. STRING(1:5)           FNCTN     601
     &               .NE. 'blank')THEN                                  FNCTN     602
                             CTITLE(KCH(1))=STRING                      FNCTN     603
                   ELSE                                                 FNCTN     604
                             CTITLE(KCH(1))=' '                         FNCTN     605
                   ENDIF                                                FNCTN     606
                  ENDIF                                                 FNCTN     607
                ELSE IF(STRING(1:1).EQ.'F'.OR.STRING(1:1).EQ.'f')THEN   FNCTN     608
                  IF(STRING(2:3).NE.'  ')THEN                           FNCTN     609
                      IF(STRING(1:6).NE.'FINISH' .OR. STRING(1:5)       FNCTN     610
     &               .NE. 'finish')CTITLE(KCH(1))=STRING                FNCTN     611
                  ELSE                                                  FNCTN     612
                     GOTO 46                                            FNCTN     613
                  ENDIF                                                 FNCTN     614
                ELSE                                                    FNCTN     615
                  CTITLE(KCH(1))=STRING                                 FNCTN     616
                ENDIF                                                   FNCTN     617
                                                                        FNCTN     618
                                                                        FNCTN     619
  46          CONTINUE                                                  FNCTN     620
                                                                        FNCTN     621
                                                                        FNCTN     622
              GOTO 44                                                   FNCTN     623
            ENDIF                                                       FNCTN     624
            WRITE(LOUT,2020)TEMP1                                       FNCTN     625
                                                                        FNCTN     626
  44      CONTINUE                                                      FNCTN     627
                                                                        FNCTN     628
                                                                        FNCTN     629
C       ********************************************                    FNCTN     630
C       INTRINSIC FUNCTIONS                                             FNCTN     631
C       ********************************************                    FNCTN     632
        ELSE IF((IFUNC.GE.10).AND.(IFUNC.LE.23))THEN                    FNCTN     633
          NN1=INDEX(STRING,'(')                                         FNCTN     634
          NN2=INDEX(STRING,')')                                         FNCTN     635
          IF(NN1.NE.0)THEN                                              FNCTN     636
            NNP1=NN1+1                                                  FNCTN     637
            NNM1=NN2-1                                                  FNCTN     638
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN     639
          ELSE                                                          FNCTN     640
            FNC=FUNC(IFUNC)                                             FNCTN     641
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN     642
            TEMP1=STRING(NN1:80)                                        FNCTN     643
          ENDIF                                                         FNCTN     644
          NN1=INDEX(STRING,'=')-1                                       FNCTN     645
          NAME=STRING(1:NN1)                                            FNCTN     646
          CALL CHECKR(TEMP1,RE1,X1)                                     FNCTN     647
          CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR1,FOUNV1)              FNCTN     648
          IF(FOUNV1)THEN                                                FNCTN     649
            RE1=.TRUE.                                                  FNCTN     650
            X1=VAR(IVAR1)                                               FNCTN     651
          ENDIF                                                         FNCTN     652
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN     653
                                                                        FNCTN     654
          IF(RE1)THEN                                                   FNCTN     655
C       CHECK IF NAME USED BY CHANNEL LIST                              FNCTN     656
            CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                    FNCTN     657
            IF(FOUND)THEN                                               FNCTN     658
              WRITE(LOUT,*)'CHANNEL LIST OF SAME NAME EXISTS'           FNCTN     659
              GOTO 10                                                   FNCTN     660
            ENDIF                                                       FNCTN     661
C       CHECK IF VARIABLE EXISTS                                        FNCTN     662
            CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                    FNCTN     663
            IF(FOUND)THEN                                               FNCTN     664
              CALL MAT2(X1,IFUNC,VAR(IVAR),ERRMSG,XS1)                  FNCTN     665
              IF(ERRMSG.NE.' ')THEN                                     FNCTN     666
                WRITE(LOUT,*)ERRMSG                                     FNCTN     667
                GOTO 10                                                 FNCTN     668
              ENDIF                                                     FNCTN     669
            ELSE                                                        FNCTN     670
              IF(NVAR.EQ.MAXVAR)THEN                                    FNCTN     671
                WRITE(LOUT,*)'THE NUMBER OF VARIABLES EXCEEDS MAXIMUM'  FNCTN     672
                GOTO 10                                                 FNCTN     673
              ENDIF                                                     FNCTN     674
              NVAR=NVAR+1                                               FNCTN     675
              VARNAM(NVAR)=NAME                                         FNCTN     676
              CALL MAT2(X1,IFUNC,VAR(NVAR),ERRMSG,XS1)                  FNCTN     677
              IF(ERRMSG.NE.' ')THEN                                     FNCTN     678
                WRITE(LOUT,*)ERRMSG                                     FNCTN     679
                GOTO 10                                                 FNCTN     680
              ENDIF                                                     FNCTN     681
            ENDIF                                                       FNCTN     682
          ELSE                                                          FNCTN     683
C       CHECK IF CHANNEL LIST                                           FNCTN     684
            IF(FOUNL1)THEN                                              FNCTN     685
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN     686
              CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                  FNCTN     687
              IF(FOUND)THEN                                             FNCTN     688
                WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'             FNCTN     689
                GOTO 10                                                 FNCTN     690
              ENDIF                                                     FNCTN     691
              CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                  FNCTN     692
              IF(FOUND)THEN                                             FNCTN     693
                IF(NCHN(ILIS).NE.NCHN(ILIS1))THEN                       FNCTN     694
                   WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'            FNCTN     695
                   WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'     FNCTN     696
                   GOTO 10                                              FNCTN     697
                ENDIF                                                   FNCTN     698
                DO 60 I=1,NCHN(ILIS)                                    FNCTN     699
                  DO 50 J=1,NTP                                         FNCTN     700
                    CALL MAT2(BUF(BUFPNT(ILIS1,I),J),IFUNC,             FNCTN     701
     *                  BUF(BUFPNT(ILIS,I),J),ERRMSG,XS1)               FNCTN     702
                    IF(ERRMSG.NE.' ')THEN                               FNCTN     703
                      WRITE(LOUT,*)ERRMSG                               FNCTN     704
                      GOTO 10                                           FNCTN     705
                    ENDIF                                               FNCTN     706
  50              CONTINUE                                              FNCTN     707
  60            CONTINUE                                                FNCTN     708
                GOTO 10                                                 FNCTN     709
              ENDIF                                                     FNCTN     710
              IF(NLIS.EQ.MAXLIS)THEN                                    FNCTN     711
                WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'  FNCTN     712
                GOTO 10                                                 FNCTN     713
              ENDIF                                                     FNCTN     714
              NLIS=NLIS+1                                               FNCTN     715
              LISNAM(NLIS)=NAME                                         FNCTN     716
              NCHN(NLIS)=NCHN(ILIS1)                                    FNCTN     717
              DO 80 I=1,NCHN(NLIS)                                      FNCTN     718
                CHN(NLIS,I)=CHN(ILIS1,I)                                FNCTN     719
                BUFPNT(NLIS,I)=NPOINT+I                                 FNCTN     720
                DO 70 J=1,NTP                                           FNCTN     721
                  CALL MAT2(BUF(BUFPNT(ILIS1,I),J),IFUNC,               FNCTN     722
     *                  BUF(BUFPNT(NLIS,I),J),ERRMSG,XS1)               FNCTN     723
                  IF(ERRMSG.NE.' ')THEN                                 FNCTN     724
                    WRITE(LOUT,*)ERRMSG                                 FNCTN     725
                    GOTO 10                                             FNCTN     726
                  ENDIF                                                 FNCTN     727
  70            CONTINUE                                                FNCTN     728
  80          CONTINUE                                                  FNCTN     729
              NPOINT=NPOINT+NCHN(NLIS)                                  FNCTN     730
              GOTO 10                                                   FNCTN     731
            ENDIF                                                       FNCTN     732
            WRITE(LOUT,2020)TEMP1                                       FNCTN     733
          ENDIF                                                         FNCTN     734
C       ********************************************                    FNCTN     735
C       DEVIATION FUNCTIONS                                             FNCTN     736
C       ********************************************                    FNCTN     737
        ELSE IF((IFUNC.EQ.24).OR.(IFUNC.EQ.25))THEN                     FNCTN     738
          NN1=INDEX(STRING,'(')                                         FNCTN     739
          NN2=INDEX(STRING,')')                                         FNCTN     740
          IF(NN1.NE.0)THEN                                              FNCTN     741
            NNP1=NN1+1                                                  FNCTN     742
            NNM1=NN2-1                                                  FNCTN     743
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN     744
          ELSE                                                          FNCTN     745
            FNC=FUNC(IFUNC)                                             FNCTN     746
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN     747
            TEMP1=STRING(NN1:80)                                        FNCTN     748
          ENDIF                                                         FNCTN     749
          NN1=INDEX(STRING,'=')-1                                       FNCTN     750
          NAME=STRING(1:NN1)                                            FNCTN     751
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN     752
          IF(.NOT.FOUNL1)THEN                                           FNCTN     753
            WRITE(LOUT,*)'ARGUMENT MUST BE A CHANNEL LIST'              FNCTN     754
            GOTO 10                                                     FNCTN     755
          ENDIF                                                         FNCTN     756
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN     757
          CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                      FNCTN     758
          IF(FOUND)THEN                                                 FNCTN     759
            WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'                 FNCTN     760
            GOTO 10                                                     FNCTN     761
          ENDIF                                                         FNCTN     762
          CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                      FNCTN     763
          IF(FOUND)THEN                                                 FNCTN     764
            IF(NCHN(ILIS).NE.NCHN(ILIS1))THEN                           FNCTN     765
              WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'                 FNCTN     766
              WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'          FNCTN     767
              GOTO 10                                                   FNCTN     768
            ENDIF                                                       FNCTN     769
            DO 100 I=1,NCHN(ILIS)                                       FNCTN     770
              Y0=XS1*BUF(BUFPNT(ILIS1,I),1)                             FNCTN     771
              DO 90 J=1,NTP                                             FNCTN     772
                IF(IFUNC.EQ.24)THEN                                     FNCTN     773
                  BUF(BUFPNT(ILIS,I),J)=XS1*BUF(BUFPNT(ILIS1,I),J)-Y0   FNCTN     774
                ELSE                                                    FNCTN     775
                  BUF(BUFPNT(ILIS,I),J)=Y0-XS1*BUF(BUFPNT(ILIS1,I),J)   FNCTN     776
                ENDIF                                                   FNCTN     777
  90          CONTINUE                                                  FNCTN     778
  100       CONTINUE                                                    FNCTN     779
            GOTO 10                                                     FNCTN     780
          ENDIF                                                         FNCTN     781
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN     782
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN     783
            GOTO 10                                                     FNCTN     784
          ENDIF                                                         FNCTN     785
          NLIS=NLIS+1                                                   FNCTN     786
          LISNAM(NLIS)=NAME                                             FNCTN     787
          NCHN(NLIS)=NCHN(ILIS1)                                        FNCTN     788
          DO 120 I=1,NCHN(NLIS)                                         FNCTN     789
            CHN(NLIS,I)=CHN(ILIS1,I)                                    FNCTN     790
            BUFPNT(NLIS,I)=NPOINT+I                                     FNCTN     791
            Y0=XS1*BUF(BUFPNT(ILIS1,I),1)                               FNCTN     792
            DO 110 J=1,NTP                                              FNCTN     793
              IF(IFUNC.EQ.24)THEN                                       FNCTN     794
                BUF(BUFPNT(NLIS,I),J)=XS1*BUF(BUFPNT(ILIS1,I),J)-Y0     FNCTN     795
              ELSE                                                      FNCTN     796
                BUF(BUFPNT(NLIS,I),J)=Y0-XS1*BUF(BUFPNT(ILIS1,I),J)     FNCTN     797
              ENDIF                                                     FNCTN     798
  110       CONTINUE                                                    FNCTN     799
  120     CONTINUE                                                      FNCTN     800
          NPOINT=NPOINT+NCHN(NLIS)                                      FNCTN     801
C       ********************************************                    FNCTN     802
C       MIN AND MAX FUNCTIONS                                           FNCTN     803
C       ********************************************                    FNCTN     804
        ELSE IF((IFUNC.EQ.26).OR.(IFUNC.EQ.27))THEN                     FNCTN     805
          NN1=INDEX(STRING,'(')                                         FNCTN     806
          NN2=INDEX(STRING,')')                                         FNCTN     807
          IF(NN1.NE.0)THEN                                              FNCTN     808
            NNP1=NN1+1                                                  FNCTN     809
            NNM1=NN2-1                                                  FNCTN     810
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN     811
          ELSE                                                          FNCTN     812
            FNC=FUNC(IFUNC)                                             FNCTN     813
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN     814
            TEMP1=STRING(NN1:80)                                        FNCTN     815
          ENDIF                                                         FNCTN     816
          NN1=INDEX(STRING,'=')-1                                       FNCTN     817
          NAME=STRING(1:NN1)                                            FNCTN     818
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN     819
          IF(.NOT.FOUNL1)THEN                                           FNCTN     820
            WRITE(LOUT,*)'ARGUMENT MUST BE A CHANNEL LIST'              FNCTN     821
            GOTO 10                                                     FNCTN     822
          ENDIF                                                         FNCTN     823
C       CHECK IF NAME IS ALREADY A CHANNEL LIST                         FNCTN     824
          CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                      FNCTN     825
          IF(FOUND)THEN                                                 FNCTN     826
            WRITE(LOUT,*)'CHANNEL LIST OF SAME NAME EXISTS'             FNCTN     827
            GOTO 10                                                     FNCTN     828
          ENDIF                                                         FNCTN     829
          CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                      FNCTN     830
          IF(FOUND)THEN                                                 FNCTN     831
            IF(IFUNC.EQ.26)THEN                                         FNCTN     832
              VAR(IVAR)=9999.0                                          FNCTN     833
            ELSE                                                        FNCTN     834
              VAR(IVAR)=-9999.0                                         FNCTN     835
            ENDIF                                                       FNCTN     836
            DO 160 I=1,NCHN(ILIS1)                                      FNCTN     837
              DO 150 J=1,NTP                                            FNCTN     838
                IF(IFUNC.EQ.26)THEN                                     FNCTN     839
                  IF(XS1*BUF(BUFPNT(ILIS1,I),J).LT.VAR(IVAR))THEN       FNCTN     840
                    VAR(IVAR)=XS1*BUF(BUFPNT(ILIS1,I),J)                FNCTN     841
                    ICHAN=I                                             FNCTN     842
                    ISTEP=J                                             FNCTN     843
                  ENDIF                                                 FNCTN     844
                ELSE                                                    FNCTN     845
                  IF(XS1*BUF(BUFPNT(ILIS1,I),J).GT.VAR(IVAR))THEN       FNCTN     846
                    VAR(IVAR)=XS1*BUF(BUFPNT(ILIS1,I),J)                FNCTN     847
                    ICHAN=I                                             FNCTN     848
                    ISTEP=J                                             FNCTN     849
                  ENDIF                                                 FNCTN     850
                ENDIF                                                   FNCTN     851
 150          CONTINUE                                                  FNCTN     852
 160        CONTINUE                                                    FNCTN     853
            IF(IFUNC.EQ.26)THEN                                         FNCTN     854
              WRITE(LOUT,*)'MINIMUM OF ',VAR(IVAR),' ON CHANNEL ',      FNCTN     855
     *          CHN(ILIS1,ICHAN)                                        FNCTN     856
            ELSE                                                        FNCTN     857
              WRITE(LOUT,*)'MAXIMUM OF ',VAR(IVAR),' ON CHANNEL ',      FNCTN     858
     *          CHN(ILIS1,ICHAN)                                        FNCTN     859
            ENDIF                                                       FNCTN     860
            GOTO 10                                                     FNCTN     861
          ENDIF                                                         FNCTN     862
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN     863
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN     864
            GOTO 10                                                     FNCTN     865
          ENDIF                                                         FNCTN     866
          NVAR=NVAR+1                                                   FNCTN     867
          VARNAM(NVAR)=NAME                                             FNCTN     868
          IF(IFUNC.EQ.26)THEN                                           FNCTN     869
            VAR(NVAR)=9999.0                                            FNCTN     870
          ELSE                                                          FNCTN     871
            VAR(NVAR)=-9999.0                                           FNCTN     872
          ENDIF                                                         FNCTN     873
          DO 180 I=1,NCHN(ILIS1)                                        FNCTN     874
            DO 170 J=1,NTP                                              FNCTN     875
              IF(IFUNC.EQ.26)THEN                                       FNCTN     876
                IF(XS1*BUF(BUFPNT(ILIS1,I),J).LT.VAR(NVAR))THEN         FNCTN     877
                  VAR(NVAR)=XS1*BUF(BUFPNT(ILIS1,I),J)                  FNCTN     878
                  ICHAN=I                                               FNCTN     879
                  ISTEP=J                                               FNCTN     880
                ENDIF                                                   FNCTN     881
              ELSE                                                      FNCTN     882
                IF(XS1*BUF(BUFPNT(ILIS1,I),J).GT.VAR(NVAR))THEN         FNCTN     883
                  VAR(NVAR)=XS1*BUF(BUFPNT(ILIS1,I),J)                  FNCTN     884
                  ICHAN=I                                               FNCTN     885
                  ISTEP=J                                               FNCTN     886
                ENDIF                                                   FNCTN     887
              ENDIF                                                     FNCTN     888
 170        CONTINUE                                                    FNCTN     889
 180      CONTINUE                                                      FNCTN     890
          WRITE(LOUT,*)'MAXIMUM OF ',VAR(NVAR),' ON CHANNEL ',          FNCTN     891
     *          CHN(ILIS1,ICHAN)                                        FNCTN     892
C       ********************************************                    FNCTN     893
C       ATAN2                                                           FNCTN     894
C       2 INPUT/1 OUTPUT CHANNELS                                       FNCTN     895
C       ********************************************                    FNCTN     896
        ELSE IF(IFUNC.EQ.7)THEN                                         FNCTN     897
          NN1=INDEX(STRING,'(')                                         FNCTN     898
          NN2=INDEX(STRING,')')                                         FNCTN     899
          IF(NN1.NE.0)THEN                                              FNCTN     900
            NNP1=NN1+1                                                  FNCTN     901
            NNM1=NN2-1                                                  FNCTN     902
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN     903
          ELSE                                                          FNCTN     904
            FNC=FUNC(IFUNC)                                             FNCTN     905
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN     906
            TEMP1=STRING(NN1:80)                                        FNCTN     907
          ENDIF                                                         FNCTN     908
          NN1=INDEX(STRING,'=')-1                                       FNCTN     909
          NAME=STRING(1:NN1)                                            FNCTN     910
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN     911
          IF(.NOT.FOUNL1)THEN                                           FNCTN     912
            WRITE(LOUT,*)'ARGUMENT MUST BE A CHANNEL LIST'              FNCTN     913
            GOTO 10                                                     FNCTN     914
          ENDIF                                                         FNCTN     915
          IF(NCHN(ILIS1).NE.2)THEN                                      FNCTN     916
            WRITE(LOUT,*)'INPUT CHANNEL LIST MUST HAVE TWO CHANNELS'    FNCTN     917
            GOTO 10                                                     FNCTN     918
          ENDIF                                                         FNCTN     919
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN     920
          CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                      FNCTN     921
          IF(FOUND)THEN                                                 FNCTN     922
            WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'                 FNCTN     923
            GOTO 10                                                     FNCTN     924
          ENDIF                                                         FNCTN     925
          CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                      FNCTN     926
          IF(FOUND)THEN                                                 FNCTN     927
            IF(NCHN(ILIS).NE.1)THEN                                     FNCTN     928
              WRITE(LOUT,*)'OUTPUT CHANNEL LIST MUST HAVE ONE CHANNEL'  FNCTN     929
              GOTO 10                                                   FNCTN     930
            ENDIF                                                       FNCTN     931
            DO 182 J=1,NTP                                              FNCTN     932
              X=XS1*BUF(BUFPNT(ILIS1,1),J)                              FNCTN     933
              Y=XS1*BUF(BUFPNT(ILIS1,2),J)                              FNCTN     934
              IF((X.EQ.0.0).AND.(Y.EQ.0.0))THEN                         FNCTN     935
                WRITE(LOUT,*)'ERROR: ATAN2(0,0)'                        FNCTN     936
                GOTO 10                                                 FNCTN     937
              ENDIF                                                     FNCTN     938
              BUF(BUFPNT(ILIS,1),J)=ATAN2(X,Y)                          FNCTN     939
  182       CONTINUE                                                    FNCTN     940
            GOTO 10                                                     FNCTN     941
          ENDIF                                                         FNCTN     942
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN     943
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN     944
            GOTO 10                                                     FNCTN     945
          ENDIF                                                         FNCTN     946
          NLIS=NLIS+1                                                   FNCTN     947
          LISNAM(NLIS)=NAME                                             FNCTN     948
          NCHN(NLIS)=1                                                  FNCTN     949
          CHN(NLIS,1)=CHN(ILIS1,1)                                      FNCTN     950
          BUFPNT(NLIS,1)=NPOINT+1                                       FNCTN     951
          DO 184 J=1,NTP                                                FNCTN     952
            X=XS1*BUF(BUFPNT(ILIS1,1),J)                                FNCTN     953
            Y=XS1*BUF(BUFPNT(ILIS1,2),J)                                FNCTN     954
            IF((X.EQ.0.0).AND.(Y.EQ.0.0))THEN                           FNCTN     955
              WRITE(LOUT,*)'ERROR: ATAN2(0,0)'                          FNCTN     956
              GOTO 10                                                   FNCTN     957
            ENDIF                                                       FNCTN     958
            BUF(BUFPNT(NLIS,1),J)=ATAN2(X,Y)                            FNCTN     959
  184     CONTINUE                                                      FNCTN     960
          NPOINT=NPOINT+1                                               FNCTN     961
C       ********************************************                    FNCTN     962
C       POLAR <--> RECTANGULAR CONVERSION                               FNCTN     963
C       2 INPUT/OUTPUT CHANNELS                                         FNCTN     964
C       ********************************************                    FNCTN     965
        ELSE IF((IFUNC.EQ.8).OR.(IFUNC.EQ.9))THEN                       FNCTN     966
          NN1=INDEX(STRING,'(')                                         FNCTN     967
          NN2=INDEX(STRING,')')                                         FNCTN     968
          IF(NN1.NE.0)THEN                                              FNCTN     969
            NNP1=NN1+1                                                  FNCTN     970
            NNM1=NN2-1                                                  FNCTN     971
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN     972
          ELSE                                                          FNCTN     973
            FNC=FUNC(IFUNC)                                             FNCTN     974
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN     975
            TEMP1=STRING(NN1:80)                                        FNCTN     976
     *                                                                  FNCTN     977
          ENDIF                                                         FNCTN     978
          NN1=INDEX(STRING,'=')-1                                       FNCTN     979
          NAME=STRING(1:NN1)                                            FNCTN     980
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN     981
          IF(.NOT.FOUNL1)THEN                                           FNCTN     982
            WRITE(LOUT,*)'ARGUMENT MUST BE A CHANNEL LIST'              FNCTN     983
            GOTO 10                                                     FNCTN     984
          ENDIF                                                         FNCTN     985
          IF(NCHN(ILIS1).NE.2)THEN                                      FNCTN     986
            WRITE(LOUT,*)'CHANNEL LIST MUST HAVE TWO CHANNELS'          FNCTN     987
            GOTO 10                                                     FNCTN     988
          ENDIF                                                         FNCTN     989
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN     990
          CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                      FNCTN     991
          IF(FOUND)THEN                                                 FNCTN     992
            WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'                 FNCTN     993
            GOTO 10                                                     FNCTN     994
          ENDIF                                                         FNCTN     995
          CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                      FNCTN     996
          IF(FOUND)THEN                                                 FNCTN     997
            IF(NCHN(ILIS).NE.2)THEN                                     FNCTN     998
              WRITE(LOUT,*)'CHANNEL LIST MUST HAVE TWO CHANNELS'        FNCTN     999
              GOTO 10                                                   FNCTN    1000
            ENDIF                                                       FNCTN    1001
            DO 185 J=1,NTP                                              FNCTN    1002
              X=XS1*BUF(BUFPNT(ILIS1,1),J)                              FNCTN    1003
              Y=XS1*BUF(BUFPNT(ILIS1,2),J)                              FNCTN    1004
              IF(IFUNC.EQ.8)THEN                                        FNCTN    1005
                BUF(BUFPNT(ILIS,1),J)=SQRT(X*X+Y*Y)                     FNCTN    1006
                BUF(BUFPNT(ILIS,2),J)=ATAN2(Y,X)                        FNCTN    1007
              ELSE                                                      FNCTN    1008
                BUF(BUFPNT(ILIS,1),J)=X*COS(Y)                          FNCTN    1009
                BUF(BUFPNT(ILIS,2),J)=X*SIN(Y)                          FNCTN    1010
              ENDIF                                                     FNCTN    1011
  185       CONTINUE                                                    FNCTN    1012
            GOTO 10                                                     FNCTN    1013
          ENDIF                                                         FNCTN    1014
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN    1015
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN    1016
            GOTO 10                                                     FNCTN    1017
          ENDIF                                                         FNCTN    1018
          NLIS=NLIS+1                                                   FNCTN    1019
          LISNAM(NLIS)=NAME                                             FNCTN    1020
          NCHN(NLIS)=2                                                  FNCTN    1021
          CHN(NLIS,1)=CHN(ILIS1,1)                                      FNCTN    1022
          CHN(NLIS,2)=CHN(ILIS1,2)                                      FNCTN    1023
          BUFPNT(NLIS,1)=NPOINT+1                                       FNCTN    1024
          BUFPNT(NLIS,2)=NPOINT+2                                       FNCTN    1025
          DO 190 J=1,NTP                                                FNCTN    1026
            X=XS1*BUF(BUFPNT(ILIS1,1),J)                                FNCTN    1027
            Y=XS1*BUF(BUFPNT(ILIS1,2),J)                                FNCTN    1028
            IF(IFUNC.EQ.8)THEN                                          FNCTN    1029
              BUF(BUFPNT(NLIS,1),J)=SQRT(X*X+Y*Y)                       FNCTN    1030
              BUF(BUFPNT(NLIS,2),J)=ATAN2(Y,X)                          FNCTN    1031
            ELSE                                                        FNCTN    1032
              BUF(BUFPNT(NLIS,1),J)=X*COS(Y)                            FNCTN    1033
              BUF(BUFPNT(NLIS,2),J)=X*SIN(Y)                            FNCTN    1034
            ENDIF                                                       FNCTN    1035
  190     CONTINUE                                                      FNCTN    1036
          NPOINT=NPOINT+2                                               FNCTN    1037
C       ********************************************                    FNCTN    1038
C       FUNCTIONS REQUIRING INTEGRATION                                 FNCTN    1039
C       ********************************************                    FNCTN    1040
        ELSE IF((IFUNC.EQ.28).OR.(IFUNC.EQ.29))THEN                     FNCTN    1041
          NN1=INDEX(STRING,'(')                                         FNCTN    1042
          NN2=INDEX(STRING,')')                                         FNCTN    1043
          IF(NN1.NE.0)THEN                                              FNCTN    1044
            NNP1=NN1+1                                                  FNCTN    1045
            NNM1=NN2-1                                                  FNCTN    1046
            TEMP1=STRING(NNP1:NNM1)                                     FNCTN    1047
          ELSE                                                          FNCTN    1048
            FNC=FUNC(IFUNC)                                             FNCTN    1049
            NN1=INDEX(STRING,FNC(1:ISLEN(FNC)))+ISLEN(FNC)              FNCTN    1050
            TEMP1=STRING(NN1:80)                                        FNCTN    1051
          ENDIF                                                         FNCTN    1052
          NN1=INDEX(STRING,'=')-1                                       FNCTN    1053
          NAME=STRING(1:NN1)                                            FNCTN    1054
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN    1055
          IF(.NOT.FOUNL1)THEN                                           FNCTN    1056
            WRITE(LOUT,*)'ARGUMENT MUST BE A CHANNEL LIST'              FNCTN    1057
            GOTO 10                                                     FNCTN    1058
          ENDIF                                                         FNCTN    1059
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN    1060
          CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                      FNCTN    1061
          IF(FOUND)THEN                                                 FNCTN    1062
            WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'                 FNCTN    1063
            GOTO 10                                                     FNCTN    1064
          ENDIF                                                         FNCTN    1065
          CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                      FNCTN    1066
          IF(FOUND)THEN                                                 FNCTN    1067
            IF(NCHN(ILIS).NE.NCHN(ILIS1))THEN                           FNCTN    1068
              WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'                 FNCTN    1069
              WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'          FNCTN    1070
              GOTO 10                                                   FNCTN    1071
            ENDIF                                                       FNCTN    1072
            DO 194 I=1,NCHN(ILIS)                                       FNCTN    1073
                                                                        FNCTN    1074
              DO 192 J=1,NTP                                            FNCTN    1075
                IF(IFUNC.EQ.28)THEN                                     FNCTN    1076
                  IF(J.EQ.1)THEN                                        FNCTN    1077
                    BUF2(J)=0.0                                         FNCTN    1078
                  ELSE                                                  FNCTN    1079
                    BUF2(J)=BUF2(J-1)+                                  FNCTN    1080
     *                  (BUF(1,J)-BUF(1,J-1))*XS1*                      FNCTN    1081
     *                  (BUF(BUFPNT(ILIS1,I),J-1)+                      FNCTN    1082
     *                   BUF(BUFPNT(ILIS1,I),J))/2.0                    FNCTN    1083
                  ENDIF                                                 FNCTN    1084
                ELSE                                                    FNCTN    1085
                  IF(J.LE.2)THEN                                        FNCTN    1086
                    BUF2(J)=XS1*(BUF(BUFPNT(ILIS1,I),3)-                FNCTN    1087
     *                  BUF(BUFPNT(ILIS1,I),2))/(BUF(1,3)-BUF(1,2))     FNCTN    1088
                  ELSE                                                  FNCTN    1089
                   IF((BUF(1,J)-BUF(1,J-1)).LT.1.0E-6)THEN              FNCTN    1090
                    BUF2(J)=BUF2(J-1)                                   FNCTN    1091
                   ELSE                                                 FNCTN    1092
                    BUF2(J)=XS1*(BUF(BUFPNT(ILIS1,I),J)-                FNCTN    1093
     *                  BUF(BUFPNT(ILIS1,I),J-1))/(BUF(1,J)-BUF(1,J-1)) FNCTN    1094
                   ENDIF                                                FNCTN    1095
                  ENDIF                                                 FNCTN    1096
                ENDIF                                                   FNCTN    1097
  192         CONTINUE                                                  FNCTN    1098
                                                                        FNCTN    1099
            DO 193 J=1,NTP                                              FNCTN    1100
              BUF(BUFPNT(ILIS,I),J)=BUF2(J)                             FNCTN    1101
  193       CONTINUE                                                    FNCTN    1102
                                                                        FNCTN    1103
  194       CONTINUE                                                    FNCTN    1104
            GOTO 10                                                     FNCTN    1105
          ENDIF                                                         FNCTN    1106
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN    1107
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN    1108
            GOTO 10                                                     FNCTN    1109
          ENDIF                                                         FNCTN    1110
          NLIS=NLIS+1                                                   FNCTN    1111
          LISNAM(NLIS)=NAME                                             FNCTN    1112
          NCHN(NLIS)=NCHN(ILIS1)                                        FNCTN    1113
          DO 198 I=1,NCHN(NLIS)                                         FNCTN    1114
            CHN(NLIS,I)=CHN(ILIS1,I)                                    FNCTN    1115
            BUFPNT(NLIS,I)=NPOINT+I                                     FNCTN    1116
            DO 196 J=1,NTP                                              FNCTN    1117
                IF(IFUNC.EQ.28)THEN                                     FNCTN    1118
                  IF(J.EQ.1)THEN                                        FNCTN    1119
                    BUF(BUFPNT(NLIS,I),J)=0.0                           FNCTN    1120
                  ELSE                                                  FNCTN    1121
                    BUF(BUFPNT(NLIS,I),J)=BUF(BUFPNT(NLIS,I),J-1)+      FNCTN    1122
     *                  (BUF(1,J)-BUF(1,J-1))*XS1*                      FNCTN    1123
     *                  (BUF(BUFPNT(ILIS1,I),J-1)+                      FNCTN    1124
     *                   BUF(BUFPNT(ILIS1,I),J))/2.0                    FNCTN    1125
                  ENDIF                                                 FNCTN    1126
                ELSE                                                    FNCTN    1127
                  IF(J.LE.2)THEN                                        FNCTN    1128
                    BUF(BUFPNT(NLIS,I),J)=XS1*(BUF(BUFPNT(ILIS1,I),3)-  FNCTN    1129
     *                  BUF(BUFPNT(ILIS1,I),2))/(BUF(1,3)-BUF(1,2))     FNCTN    1130
                  ELSE                                                  FNCTN    1131
                   IF((BUF(1,J)-BUF(1,J-1)).LT.1.0E-6)THEN              FNCTN    1132
                    BUF(BUFPNT(ILIS1,I),J)=BUF(BUFPNT(ILIS1,I),J-1)     FNCTN    1133
                   ELSE                                                 FNCTN    1134
                    BUF(BUFPNT(NLIS,I),J)=XS1*(BUF(BUFPNT(ILIS1,I),J)-  FNCTN    1135
     *                  BUF(BUFPNT(ILIS1,I),J-1))/(BUF(1,J)-BUF(1,J-1)) FNCTN    1136
                   ENDIF                                                FNCTN    1137
                  ENDIF                                                 FNCTN    1138
                ENDIF                                                   FNCTN    1139
                                                                        FNCTN    1140
                                                                        FNCTN    1141
                                                                        FNCTN    1142
                                                                        FNCTN    1143
  196       CONTINUE                                                    FNCTN    1144
  198     CONTINUE                                                      FNCTN    1145
          NPOINT=NPOINT+NCHN(NLIS)                                      FNCTN    1146
C       ********************************************                    FNCTN    1147
C       BASIC ARITHMETIC                                                FNCTN    1148
C       ********************************************                    FNCTN    1149
        ELSE IF((IFUNC.GE.1).AND.(IFUNC.LE.6))THEN                      FNCTN    1150
C       CHECK IF EXPONENT NUMBER(IE. 1E-3)                              FNCTN    1151
          NN1=INDEX(STRING,'=')-1                                       FNCTN    1152
          NAME=STRING(1:NN1)                                            FNCTN    1153
          NN1=INDEX(STRING,'=')+1                                       FNCTN    1154
          NN2=INDEX(STRING,FUNC(IFUNC)(1:ISLEN(FUNC(IFUNC))))-1         FNCTN    1155
          TEMP1=STRING(NN1:NN2)                                         FNCTN    1156
          NN1=INDEX(STRING,FUNC(IFUNC)(1:ISLEN(FUNC(IFUNC))))+          FNCTN    1157
     *          ISLEN(FUNC(IFUNC))                                      FNCTN    1158
          TEMP2=STRING(NN1:80)                                          FNCTN    1159
          CALL CHECKR(TEMP1,RE1,X1)                                     FNCTN    1160
          CALL CHECKR(TEMP2,RE2,X2)                                     FNCTN    1161
          CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR1,FOUNV1)              FNCTN    1162
          IF(FOUNV1)THEN                                                FNCTN    1163
            RE1=.TRUE.                                                  FNCTN    1164
            X1=VAR(IVAR1)                                               FNCTN    1165
          ENDIF                                                         FNCTN    1166
          CALL CHECKV(TEMP2(1:6),VARNAM,NVAR,IVAR2,FOUNV2)              FNCTN    1167
          IF(FOUNV2)THEN                                                FNCTN    1168
            RE2=.TRUE.                                                  FNCTN    1169
            X2=VAR(IVAR2)                                               FNCTN    1170
          ENDIF                                                         FNCTN    1171
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN    1172
          CALL CHECKL(TEMP2(1:6),LISNAM,NLIS,ILIS2,FOUNL2)              FNCTN    1173
          IF(RE1.AND.RE2)THEN                                           FNCTN    1174
C       CHECK IF NAME USED BY CHANNEL LIST                              FNCTN    1175
            CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                    FNCTN    1176
            IF(FOUND)THEN                                               FNCTN    1177
              WRITE(LOUT,*)'CHANNEL LIST OF SAME NAME EXISTS'           FNCTN    1178
              GOTO 10                                                   FNCTN    1179
            ENDIF                                                       FNCTN    1180
C       CHECK IF VARIABLE EXISTS                                        FNCTN    1181
            CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                    FNCTN    1182
            IF(FOUND)THEN                                               FNCTN    1183
              CALL MAT(X1,X2,IFUNC,VAR(IVAR),ERRMSG,XS1,XS2)            FNCTN    1184
              IF(ERRMSG.NE.' ')THEN                                     FNCTN    1185
                WRITE(LOUT,*)ERRMSG                                     FNCTN    1186
                GOTO 10                                                 FNCTN    1187
              ENDIF                                                     FNCTN    1188
            ELSE                                                        FNCTN    1189
              IF(NVAR.EQ.MAXVAR)THEN                                    FNCTN    1190
                WRITE(LOUT,*)'THE NUMBER OF VARIABLES EXCEEDS MAXIMUM'  FNCTN    1191
                GOTO 10                                                 FNCTN    1192
              ENDIF                                                     FNCTN    1193
              NVAR=NVAR+1                                               FNCTN    1194
              VARNAM(NVAR)=NAME                                         FNCTN    1195
              CALL MAT(X1,X2,IFUNC,VAR(NVAR),ERRMSG,XS1,XS2)            FNCTN    1196
              IF(ERRMSG.NE.' ')THEN                                     FNCTN    1197
                WRITE(LOUT,*)ERRMSG                                     FNCTN    1198
                GOTO 10                                                 FNCTN    1199
              ENDIF                                                     FNCTN    1200
            ENDIF                                                       FNCTN    1201
          ELSE IF(RE1)THEN                                              FNCTN    1202
C       CHECK IF CHANNEL LIST                                           FNCTN    1203
            IF(FOUNL2)THEN                                              FNCTN    1204
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN    1205
              CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                  FNCTN    1206
              IF(FOUND)THEN                                             FNCTN    1207
                WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'             FNCTN    1208
                GOTO 10                                                 FNCTN    1209
              ENDIF                                                     FNCTN    1210
              CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                  FNCTN    1211
              IF(FOUND)THEN                                             FNCTN    1212
                IF(NCHN(ILIS).NE.NCHN(ILIS2))THEN                       FNCTN    1213
                   WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'            FNCTN    1214
                   WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'     FNCTN    1215
                   GOTO 10                                              FNCTN    1216
                ENDIF                                                   FNCTN    1217
                DO 210 I=1,NCHN(ILIS)                                   FNCTN    1218
                  DO 200 J=1,NTP                                        FNCTN    1219
                    CALL MAT(X1,BUF(BUFPNT(ILIS2,I),J),IFUNC,           FNCTN    1220
     *                  BUF(BUFPNT(ILIS,I),J),ERRMSG,XS1,XS2)           FNCTN    1221
                    IF(ERRMSG.NE.' ')THEN                               FNCTN    1222
                      WRITE(LOUT,*)ERRMSG                               FNCTN    1223
                      GOTO 10                                           FNCTN    1224
                    ENDIF                                               FNCTN    1225
  200             CONTINUE                                              FNCTN    1226
  210           CONTINUE                                                FNCTN    1227
                GOTO 10                                                 FNCTN    1228
              ENDIF                                                     FNCTN    1229
              IF(NLIS.EQ.MAXLIS)THEN                                    FNCTN    1230
                WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'  FNCTN    1231
                GOTO 10                                                 FNCTN    1232
              ENDIF                                                     FNCTN    1233
              NLIS=NLIS+1                                               FNCTN    1234
              LISNAM(NLIS)=NAME                                         FNCTN    1235
              NCHN(NLIS)=NCHN(ILIS2)                                    FNCTN    1236
              DO 230 I=1,NCHN(NLIS)                                     FNCTN    1237
                CHN(NLIS,I)=CHN(ILIS2,I)                                FNCTN    1238
                BUFPNT(NLIS,I)=NPOINT+I                                 FNCTN    1239
                DO 220 J=1,NTP                                          FNCTN    1240
                  CALL MAT(X1,BUF(BUFPNT(ILIS2,I),J),IFUNC,             FNCTN    1241
     *                  BUF(BUFPNT(NLIS,I),J),ERRMSG,XS1,XS2)           FNCTN    1242
                  IF(ERRMSG.NE.' ')THEN                                 FNCTN    1243
                    WRITE(LOUT,*)ERRMSG                                 FNCTN    1244
                    GOTO 10                                             FNCTN    1245
                  ENDIF                                                 FNCTN    1246
  220           CONTINUE                                                FNCTN    1247
  230         CONTINUE                                                  FNCTN    1248
              NPOINT=NPOINT+NCHN(NLIS)                                  FNCTN    1249
              GOTO 10                                                   FNCTN    1250
            ENDIF                                                       FNCTN    1251
            WRITE(LOUT,2020)TEMP2                                       FNCTN    1252
 2020   FORMAT(1X,'UNKNOWN VARIABLE/CHANNEL LIST *** ',A6,' ***')       FNCTN    1253
          ELSE IF(RE2)THEN                                              FNCTN    1254
C       CHECK IF CHANNEL LIST                                           FNCTN    1255
            IF(FOUNL1)THEN                                              FNCTN    1256
              CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                  FNCTN    1257
              IF(FOUND)THEN                                             FNCTN    1258
                WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'             FNCTN    1259
                GOTO 10                                                 FNCTN    1260
              ENDIF                                                     FNCTN    1261
              CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                  FNCTN    1262
              IF(FOUND)THEN                                             FNCTN    1263
                IF(NCHN(ILIS).NE.NCHN(ILIS1))THEN                       FNCTN    1264
                   WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'            FNCTN    1265
                   WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'     FNCTN    1266
                   GOTO 10                                              FNCTN    1267
                ENDIF                                                   FNCTN    1268
                DO 250 I=1,NCHN(ILIS)                                   FNCTN    1269
                  DO 240 J=1,NTP                                        FNCTN    1270
                    CALL MAT(BUF(BUFPNT(ILIS1,I),J),X2,IFUNC,           FNCTN    1271
     *                  BUF(BUFPNT(ILIS,I),J),ERRMSG,XS1,XS2)           FNCTN    1272
                    IF(ERRMSG.NE.' ')THEN                               FNCTN    1273
                      WRITE(LOUT,*)ERRMSG                               FNCTN    1274
                      GOTO 10                                           FNCTN    1275
                    ENDIF                                               FNCTN    1276
  240             CONTINUE                                              FNCTN    1277
  250           CONTINUE                                                FNCTN    1278
                GOTO 10                                                 FNCTN    1279
              ENDIF                                                     FNCTN    1280
              IF(NLIS.EQ.MAXLIS)THEN                                    FNCTN    1281
                WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'  FNCTN    1282
                GOTO 10                                                 FNCTN    1283
              ENDIF                                                     FNCTN    1284
              NLIS=NLIS+1                                               FNCTN    1285
              LISNAM(NLIS)=NAME                                         FNCTN    1286
              NCHN(NLIS)=NCHN(ILIS1)                                    FNCTN    1287
              DO 270 I=1,NCHN(NLIS)                                     FNCTN    1288
                CHN(NLIS,I)=CHN(ILIS1,I)                                FNCTN    1289
                BUFPNT(NLIS,I)=NPOINT+I                                 FNCTN    1290
                DO 260 J=1,NTP                                          FNCTN    1291
                  CALL MAT(BUF(BUFPNT(ILIS1,I),J),X2,IFUNC,             FNCTN    1292
     *                  BUF(BUFPNT(NLIS,I),J),ERRMSG,XS1,XS2)           FNCTN    1293
                  IF(ERRMSG.NE.' ')THEN                                 FNCTN    1294
                    WRITE(LOUT,*)ERRMSG                                 FNCTN    1295
                    GOTO 10                                             FNCTN    1296
                  ENDIF                                                 FNCTN    1297
 260            CONTINUE                                                FNCTN    1298
 270          CONTINUE                                                  FNCTN    1299
              NPOINT=NPOINT+NCHN(NLIS)                                  FNCTN    1300
              GOTO 10                                                   FNCTN    1301
            ENDIF                                                       FNCTN    1302
            WRITE(LOUT,2020)TEMP1                                       FNCTN    1303
          ELSE                                                          FNCTN    1304
            IF(FOUNL1.AND.FOUNL2)THEN                                   FNCTN    1305
                                                                        FNCTN    1306
              CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                  FNCTN    1307
              IF(FOUND)THEN                                             FNCTN    1308
                WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'             FNCTN    1309
                GOTO 10                                                 FNCTN    1310
              ENDIF                                                     FNCTN    1311
                                                                        FNCTN    1312
                                                                        FNCTN    1313
              IF((NCHN(ILIS1).NE.1).AND.(NCHN(ILIS2).NE.1))THEN         FNCTN    1314
                WRITE(LOUT,*)'ONE CHANNEL LIST MUST BE A SINGLE CHANNEL'FNCTN    1315
                GOTO 10                                                 FNCTN    1316
              ENDIF                                                     FNCTN    1317
              CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                  FNCTN    1318
              IF(FOUND)THEN                                             FNCTN    1319
                IF(((NCHN(ILIS1).EQ.1).AND.                             FNCTN    1320
     *                  (NCHN(ILIS).NE.NCHN(ILIS2))).OR.                FNCTN    1321
     *                  ((NCHN(ILIS2).EQ.1).AND.                        FNCTN    1322
     *                  (NCHN(ILIS).NE.NCHN(ILIS1))))THEN               FNCTN    1323
                   WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'            FNCTN    1324
                   WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'     FNCTN    1325
                   GOTO 10                                              FNCTN    1326
                ENDIF                                                   FNCTN    1327
                DO 290 I=1,NCHN(ILIS)                                   FNCTN    1328
                  DO 280 J=1,NTP                                        FNCTN    1329
                    IF(NCHN(ILIS1).EQ.1)THEN                            FNCTN    1330
                      CALL MAT(BUF(BUFPNT(ILIS1,1),J),                  FNCTN    1331
     *                        BUF(BUFPNT(ILIS2,I),J),IFUNC,             FNCTN    1332
     *                        BUF(BUFPNT(ILIS,I),J),ERRMSG,XS1,XS2)     FNCTN    1333
                      IF(ERRMSG.NE.' ')THEN                             FNCTN    1334
                        WRITE(LOUT,*)ERRMSG                             FNCTN    1335
                        GOTO 10                                         FNCTN    1336
                      ENDIF                                             FNCTN    1337
                    ELSE                                                FNCTN    1338
                      CALL MAT(BUF(BUFPNT(ILIS1,I),J),                  FNCTN    1339
     *                        BUF(BUFPNT(ILIS2,1),J),IFUNC,             FNCTN    1340
     *                        BUF(BUFPNT(ILIS,I),J),ERRMSG,XS1,XS2)     FNCTN    1341
                      IF(ERRMSG.NE.' ')THEN                             FNCTN    1342
                        WRITE(LOUT,*)ERRMSG                             FNCTN    1343
                        GOTO 10                                         FNCTN    1344
                      ENDIF                                             FNCTN    1345
                    ENDIF                                               FNCTN    1346
  280             CONTINUE                                              FNCTN    1347
  290           CONTINUE                                                FNCTN    1348
                GOTO 10                                                 FNCTN    1349
              ENDIF                                                     FNCTN    1350
              IF(NLIS.EQ.MAXLIS)THEN                                    FNCTN    1351
                WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'  FNCTN    1352
                GOTO 10                                                 FNCTN    1353
              ENDIF                                                     FNCTN    1354
              NLIS=NLIS+1                                               FNCTN    1355
              LISNAM(NLIS)=NAME                                         FNCTN    1356
              IF(NCHN(ILIS1).EQ.1)THEN                                  FNCTN    1357
                NCHN(NLIS)=NCHN(ILIS2)                                  FNCTN    1358
              ELSE                                                      FNCTN    1359
                NCHN(NLIS)=NCHN(ILIS1)                                  FNCTN    1360
              ENDIF                                                     FNCTN    1361
              DO 310 I=1,NCHN(NLIS)                                     FNCTN    1362
                BUFPNT(NLIS,I)=NPOINT+I                                 FNCTN    1363
                IF(NCHN(ILIS1).EQ.1)THEN                                FNCTN    1364
                  CHN(NLIS,I)=CHN(ILIS2,I)                              FNCTN    1365
                ELSE                                                    FNCTN    1366
                  CHN(NLIS,I)=CHN(ILIS1,I)                              FNCTN    1367
                ENDIF                                                   FNCTN    1368
                DO 300 J=1,NTP                                          FNCTN    1369
                  IF(NCHN(ILIS1).EQ.1)THEN                              FNCTN    1370
                    CALL MAT(BUF(BUFPNT(ILIS1,1),J),                    FNCTN    1371
     *                      BUF(BUFPNT(ILIS2,I),J),IFUNC,               FNCTN    1372
     *                      BUF(BUFPNT(NLIS,I),J),ERRMSG,XS1,XS2)       FNCTN    1373
                    IF(ERRMSG.NE.' ')THEN                               FNCTN    1374
                      WRITE(LOUT,*)ERRMSG                               FNCTN    1375
                      GOTO 10                                           FNCTN    1376
                    ENDIF                                               FNCTN    1377
                  ELSE                                                  FNCTN    1378
                    CALL MAT(BUF(BUFPNT(ILIS1,I),J),                    FNCTN    1379
     *                      BUF(BUFPNT(ILIS2,1),J),IFUNC,               FNCTN    1380
     *                      BUF(BUFPNT(NLIS,I),J),ERRMSG,XS1,XS2)       FNCTN    1381
                    IF(ERRMSG.NE.' ')THEN                               FNCTN    1382
                      WRITE(LOUT,*)ERRMSG                               FNCTN    1383
                      GOTO 10                                           FNCTN    1384
                    ENDIF                                               FNCTN    1385
                  ENDIF                                                 FNCTN    1386
 300            CONTINUE                                                FNCTN    1387
 310          CONTINUE                                                  FNCTN    1388
              NPOINT=NPOINT+NCHN(NLIS)                                  FNCTN    1389
              GOTO 10                                                   FNCTN    1390
            ENDIF                                                       FNCTN    1391
            WRITE(LOUT,2030)TEMP1,TEMP2                                 FNCTN    1392
 2030       FORMAT(1X,'UNKNOWN VARIABLE *** ',A6,' OR ',A6,' ***')      FNCTN    1393
          ENDIF                                                         FNCTN    1394
C       ********************************************                    FNCTN    1395
C       ASSIGNMENT OF NEW CHANNEL LIST                                  FNCTN    1396
C       ********************************************                    FNCTN    1397
        ELSE IF(((NEW1X.NE.0).AND.                                      FNCTN    1398
     *           (NEW2X.NE.0)).OR.                                      FNCTN    1399
     *           ((NEW3X.NE.0).AND.                                     FNCTN    1400
     *           (NEW4X.NE.0)))THEN                                     FNCTN    1401
          NN1=INDEX(STRING,'=')-1                                       FNCTN    1402
          NAME=STRING(1:NN1)                                            FNCTN    1403
          NN1=INDEX(STRING,'<')                                         FNCTN    1404
          IF(NN1.NE.0)THEN                                              FNCTN    1405
            NN2=INDEX(STRING,'>')+1                                     FNCTN    1406
            TEMP=STRING(NN2:80)                                         FNCTN    1407
            IF( (NN1+1).EQ.(NN2-1) )THEN                                FNCTN    1408
              FILE=' '                                                  FNCTN    1409
            ELSE                                                        FNCTN    1410
              NN1=INDEX(STRING,'<')+1                                   FNCTN    1411
              NN2=INDEX(STRING,'>')-1                                   FNCTN    1412
              FILE=STRING(NN1:NN2)                                      FNCTN    1413
            ENDIF                                                       FNCTN    1414
            CALL OPCHNL(FILE,ISLEN(FILE))                               FNCTN    1415
          ELSE                                                          FNCTN    1416
            NN1=INDEX(STRING,'=')+1                                     FNCTN    1417
            TEMP=STRING(NN1:LEN(STRING))                                FNCTN    1418
          ENDIF                                                         FNCTN    1419
          CALL CHECKV(NAME(1:6),VARNAM,NVAR,IVAR,FOUND)                 FNCTN    1420
          IF(FOUND)THEN                                                 FNCTN    1421
            WRITE(LOUT,*)'VARIABLE OF SAME NAME ALREADY EXISTS'         FNCTN    1422
            GOTO 10                                                     FNCTN    1423
          ENDIF                                                         FNCTN    1424
          CALL CHECKL(NAME(1:6),LISNAM,NLIS,ILIS,FOUND)                 FNCTN    1425
          IF(FOUND)THEN                                                 FNCTN    1426
            NCH=1                                                       FNCTN    1427
            DO 315 I=1,80                                               FNCTN    1428
              IF(TEMP(I:I).EQ.',')NCH=NCH+1                             FNCTN    1429
  315       CONTINUE                                                    FNCTN    1430
            IF(NCHN(ILIS).NE.NCH)THEN                                   FNCTN    1431
              WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'                 FNCTN    1432
              WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'          FNCTN    1433
              GOTO 10                                                   FNCTN    1434
            ENDIF                                                       FNCTN    1435
            CHNLIS(ILIS)=TEMP                                           FNCTN    1436
                                                                        FNCTN    1437
                                                                        FNCTN    1438
                                                                        FNCTN    1439
            CALL CHALIS(CHNLIS,CHN,NCHN,BUFPNT,BUF,TIMEN,ILIS,NTPN,     FNCTN    1440
     *          NPOINT,LRECFD,IOK)                                      FNCTN    1441
            CALL INTER(TIME,NTP,TIMEN,BUF,BUFPNT(ILIS,1),NTPN)          FNCTN    1442
                                                                        FNCTN    1443
            GOTO 10                                                     FNCTN    1444
          ENDIF                                                         FNCTN    1445
          IF(NLIS.EQ.MAXLIS)THEN                                        FNCTN    1446
            WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'      FNCTN    1447
            GOTO 10                                                     FNCTN    1448
          ENDIF                                                         FNCTN    1449
                                                                        FNCTN    1450
                                                                        FNCTN    1451
          NLIS=NLIS+1                                                   FNCTN    1452
          LISNAM(NLIS)=NAME                                             FNCTN    1453
          CHNLIS(NLIS)=TEMP                                             FNCTN    1454
          IF(NLIS.EQ.2)THEN                                             FNCTN    1455
            CALL CHALIS(CHNLIS,CHN,NCHN,BUFPNT,BUF,TIME,NLIS,NTP,       FNCTN    1456
     *          NPOINT,LRECFD,IOK)                                      FNCTN    1457
          ELSE                                                          FNCTN    1458
            CALL CHALIS(CHNLIS,CHN,NCHN,BUFPNT,BUF,TIMEN,NLIS,NTPN,     FNCTN    1459
     *          NPOINT,LRECFD,IOK)                                      FNCTN    1460
            CALL INTER(TIME,NTP,TIMEN,BUF,BUFPNT(NLIS,1),NTPN)          FNCTN    1461
          ENDIF                                                         FNCTN    1462
          IF(IOK.LT.0)NLIS=NLIS-1                                       FNCTN    1463
C       ********************************************                    FNCTN    1464
C       VARIABLE ASSIGNMENT OR CHANNEL LIST EQUATE                      FNCTN    1465
C       ********************************************                    FNCTN    1466
        ELSE IF(NEW5X.NE.0)THEN                                         FNCTN    1467
          NN1=INDEX(STRING,'=')+1                                       FNCTN    1468
          TEMP1=STRING(NN1:LEN(STRING))                                 FNCTN    1469
          NN2=INDEX(STRING,'=')-1                                       FNCTN    1470
          NAME=STRING(1:NN2)                                            FNCTN    1471
C       CHECK IF CONSTANT EXISTS                                        FNCTN    1472
          CALL CHECKR(TEMP1,RE1,X1)                                     FNCTN    1473
          IF(.NOT.RE1)THEN                                              FNCTN    1474
            X=1.                                                        FNCTN    1475
            IF(TEMP1(1:1).EQ.'-')THEN                                   FNCTN    1476
              TEMP1=TEMP1(2:80)                                         FNCTN    1477
              X=-1.                                                     FNCTN    1478
            ENDIF                                                       FNCTN    1479
          ENDIF                                                         FNCTN    1480
          CALL CHECKL(TEMP1(1:6),LISNAM,NLIS,ILIS1,FOUNL1)              FNCTN    1481
          CALL CHECKV(TEMP1(1:6),VARNAM,NVAR,IVAR1,FOUNV1)              FNCTN    1482
          IF(FOUNV1)THEN                                                FNCTN    1483
            X1=X*VAR(IVAR1)                                             FNCTN    1484
            RE1=.TRUE.                                                  FNCTN    1485
          ENDIF                                                         FNCTN    1486
          IF(RE1)THEN                                                   FNCTN    1487
C       CHECK IF NAME USED BY CHANNEL LIST                              FNCTN    1488
            CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                    FNCTN    1489
            IF(FOUND)THEN                                               FNCTN    1490
              WRITE(LOUT,*)'CHANNEL LIST OF SAME NAME EXISTS'           FNCTN    1491
              GOTO 10                                                   FNCTN    1492
            ENDIF                                                       FNCTN    1493
            CALL CHECKV(NAME(1:6),VARNAM,NVAR,IVAR,FOUND)               FNCTN    1494
            IF(FOUND)THEN                                               FNCTN    1495
              VAR(IVAR)=X1*XS1                                          FNCTN    1496
              GOTO 10                                                   FNCTN    1497
            ENDIF                                                       FNCTN    1498
C       NEW CONSTANT                                                    FNCTN    1499
            IF(NVAR.EQ.MAXVAR)THEN                                      FNCTN    1500
              WRITE(LOUT,*)'THE NUMBER OF VARIABLES EXCEEDS MAXIMUM'    FNCTN    1501
              GOTO 10                                                   FNCTN    1502
            ENDIF                                                       FNCTN    1503
            NVAR=NVAR+1                                                 FNCTN    1504
            VARNAM(NVAR)=NAME                                           FNCTN    1505
            VAR(NVAR)=X1*XS1                                            FNCTN    1506
          ELSE                                                          FNCTN    1507
C       CHECK IF CHANNEL LIST                                           FNCTN    1508
            IF(FOUNL1)THEN                                              FNCTN    1509
C       CHECK IF NAME IS ALREADY A VARIABLE                             FNCTN    1510
              CALL CHECKV(NAME,VARNAM,NVAR,IVAR,FOUND)                  FNCTN    1511
              IF(FOUND)THEN                                             FNCTN    1512
                WRITE(LOUT,*)'VARIABLE OF SAME NAME EXISTS'             FNCTN    1513
                GOTO 10                                                 FNCTN    1514
              ENDIF                                                     FNCTN    1515
              CALL CHECKL(NAME,LISNAM,NLIS,ILIS,FOUND)                  FNCTN    1516
              IF(FOUND)THEN                                             FNCTN    1517
                IF(NCHN(ILIS).NE.NCHN(ILIS1))THEN                       FNCTN    1518
                   WRITE(LOUT,*)'INPUT/OUTPUT CHANNEL LISTS'            FNCTN    1519
                   WRITE(LOUT,*)'HAVE DIFFERENT NUMBER OF CHANNELS'     FNCTN    1520
                   GOTO 10                                              FNCTN    1521
                ENDIF                                                   FNCTN    1522
                DO 330 I=1,NCHN(ILIS)                                   FNCTN    1523
                  CHN(ILIS,I)=CHN(ILIS1,I)                              FNCTN    1524
                  DO 320 J=1,NTP                                        FNCTN    1525
                    BUF(BUFPNT(ILIS,I),J)=XS1*X*BUF(BUFPNT(ILIS1,I),J)  FNCTN    1526
  320             CONTINUE                                              FNCTN    1527
  330           CONTINUE                                                FNCTN    1528
                GOTO 10                                                 FNCTN    1529
              ENDIF                                                     FNCTN    1530
              IF(NLIS.EQ.MAXLIS)THEN                                    FNCTN    1531
                WRITE(LOUT,*)'NUMBER OF CHANNEL LISTS EXCEEDS MAXIMUM'  FNCTN    1532
                GOTO 10                                                 FNCTN    1533
              ENDIF                                                     FNCTN    1534
              NLIS=NLIS+1                                               FNCTN    1535
              LISNAM(NLIS)=NAME                                         FNCTN    1536
              NCHN(NLIS)=NCHN(ILIS1)                                    FNCTN    1537
              DO 350 I=1,NCHN(NLIS)                                     FNCTN    1538
                CHN(NLIS,I)=CHN(ILIS1,I)                                FNCTN    1539
                BUFPNT(NLIS,I)=NPOINT+I                                 FNCTN    1540
                DO 340 J=1,NTP                                          FNCTN    1541
                  BUF(BUFPNT(NLIS,I),J)=XS1*X*BUF(BUFPNT(ILIS1,I),J)    FNCTN    1542
  340           CONTINUE                                                FNCTN    1543
  350         CONTINUE                                                  FNCTN    1544
              NPOINT=NPOINT+NCHN(NLIS)                                  FNCTN    1545
              GOTO 10                                                   FNCTN    1546
            ENDIF                                                       FNCTN    1547
            WRITE(LOUT,2020)TEMP1                                       FNCTN    1548
          ENDIF                                                         FNCTN    1549
C       ********************************************                    FNCTN    1550
C       ********************************************                    FNCTN    1551
        ELSE                                                            FNCTN    1552
          WRITE(LOUT,*)'UNKNOWN COMMAND'                                FNCTN    1553
        ENDIF                                                           FNCTN    1554
C       ********************************************                    FNCTN    1555
        GOTO 10                                                         FNCTN    1556
C       ********************************************                    FNCTN    1557
  999   CONTINUE                                                        FNCTN    1558
C                                                                       FNCTN    1559
        IF(KCH(1).GT.NOCH)THEN                                          FNCTN    1560
          WRITE(LOUT,'(/,10X,A,/)')'Use GPPLOT or DPPLOT'//             FNCTN    1561
     +      ' commands to plot contents of buffer.'                     FNCTN    1562
          IF(LIN.EQ.LPIN)THEN                                           FNCTN    1563
            WRITE(LOUT,'(/,1X,A)')'Press <RETURN> to continue'          FNCTN    1564
            READ(LIN,'(A)')CH                                           FNCTN    1565
          ENDIF                                                         FNCTN    1566
          STRING(1:7)='ANALYSI'                                         FNCTN    1567
          IF(IPLTYP.EQ.0)IPLTYP=1                                       FNCTN    1568
          CALL GPPAGE                                                   FNCTN    1569
          CALL GETCHN(STRING)                                           FNCTN    1570
        ENDIF                                                           FNCTN    1571
C                                                                       FNCTN    1572
 1000   FORMAT(1X,A2)                                                   FNCTN    1573
 1010   FORMAT(A)                                                       FNCTN    1574
        RETURN                                                          FNCTN    1575
        END                                                             FNCTN    1576
        SUBROUTINE PACK(STRING)                                         FNCTN    1577
CD                                                                      FNCTN    1578
CD           THIS ROUTINE REMOVES SPACES BETWEEN TWO ADJACENT           FNCTN    1579
CD           CHARACTER STRINGS                                          FNCTN    1580
CD                                                                      FNCTN    1581
CD           CALLING PARAMETER :                                        FNCTN    1582
CD                                                                      FNCTN    1583
CD                   STRING : UPON ENTRY ,IT IS A CHARACTER*80          FNCTN    1584
CD                            VARILABLE TO BE PACKED.                   FNCTN    1585
CD                            ON EXIT, IT IS PACKED CHARACTER           FNCTN    1586
CD                            STRING                                    FNCTN    1587
CD                                                                      FNCTN    1588
CD                                                                      FNCTN    1589
        CHARACTER*80 STRING,TEMP                                        FNCTN    1590
        NC=0                                                            FNCTN    1591
        DO 10 I=1,80                                                    FNCTN    1592
          TEMP=STRING                                                   FNCTN    1593
          IF((TEMP(I:I).NE.' ').AND.(TEMP(I:I).NE.'     '))THEN         FNCTN    1594
            NC=NC+1                                                     FNCTN    1595
            STRING(NC:NC)=TEMP(I:I)                                     FNCTN    1596
          ENDIF                                                         FNCTN    1597
  10    CONTINUE                                                        FNCTN    1598
        STRING(NC+1:80)=' '                                             FNCTN    1599
        RETURN                                                          FNCTN    1600
        END                                                             FNCTN    1601
        SUBROUTINE CHECKR(STRING,RE,X)                                  FNCTN    1602
CD                                                                      FNCTN    1603
CD              THIS ROUTINE DETERMINES OPERANDS IN A SINGLE            FNCTN    1604
CD              OPERATION                                               FNCTN    1605
CD                                                                      FNCTN    1606
CD              CALLING PARAMETERS :                                    FNCTN    1607
CD                                                                      FNCTN    1608
CD                      STRING : NAME OF THE OPERAND                    FNCTN    1609
CD                      RE     : LOGICAL FLAG                           FNCTN    1610
CD                                 .FALSE. : THE OPERAND IS A VARIABLE  FNCTN    1611
CD                                           NAME                       FNCTN    1612
CD                                 .TRUE.  : THE OPERAND IS A NUMERICAL FNCTN    1613
CD                                           CONSTANT                   FNCTN    1614
CD                      X      : VALUE OF THE READ IN NUMERICAL CONSTANTFNCTN    1615
CD                                                                      FNCTN    1616
CD                                                                      FNCTN    1617
        CHARACTER*80 STRING,TEMP                                        FNCTN    1618
        CHARACTER*1 DIGIT(11)                                           FNCTN    1619
        LOGICAL RE                                                      FNCTN    1620
      INCLUDE 'SOAPC1.INS'                                              FNCTN    1621
        DATA DIGIT/'1','2','3','4','5','6','7','8','9','0','.'/         FNCTN    1622
        TEMP=STRING                                                     FNCTN    1623
        IF(STRING(1:1).EQ.'-')THEN                                      FNCTN    1624
          TEMP=STRING(2:80)                                             FNCTN    1625
        ENDIF                                                           FNCTN    1626
        IF(STRING(1:1).EQ.'+')THEN                                      FNCTN    1627
          TEMP=STRING(2:80)                                             FNCTN    1628
        ENDIF                                                           FNCTN    1629
        DO 10 I=1,11                                                    FNCTN    1630
          IF(DIGIT(I).EQ.TEMP(1:1))GOTO 20                              FNCTN    1631
  10    CONTINUE                                                        FNCTN    1632
        RE=.FALSE.                                                      FNCTN    1633
        X=0                                                             FNCTN    1634
        GOTO 40                                                         FNCTN    1635
  20    RE=.TRUE.                                                       FNCTN    1636
        READ(STRING,*,IOSTAT=IOS)X                                      FNCTN    1637
        IF(IOS.EQ.0) GOTO 40                                            FNCTN    1638
        WRITE(LOUT,*)'VARIABLE NAME MUST NOT START WITH A DIGIT'        FNCTN    1639
  40    CONTINUE                                                        FNCTN    1640
        RETURN                                                          FNCTN    1641
        END                                                             FNCTN    1642
        SUBROUTINE CHECKV(VARNM,VARNAM,NVAR,IVAR,FOUND)                 FNCTN    1643
CD                                                                      FNCTN    1644
CD            THIS ROUTINE CHECKS IF VARIABLE IS A PROGRAM PRE-DEFINED  FNCTN    1645
CD            VARIABLE SUCH IS PI, RAD TO DEGREE CONVERSION ETC.        FNCTN    1646
CD                                                                      FNCTN    1647
CD            CALLING PARAMETERS :                                      FNCTN    1648
CD                                                                      FNCTN    1649
CD                      VARNM  : CHARACTER STRING CONTAINING THE NAME   FNCTN    1650
CD                               OF THE OPERAND                         FNCTN    1651
CD                      VARNAM : CHARACTER ARRAY STORES NAME OF THE     FNCTN    1652
CD                               PROGRAM PRE-DEFINED VARIABLES          FNCTN    1653
CD                      NVAR   : NUMBER OF PROGRAM PRE-DEFINED VARIABLE FNCTN    1654
CD                      IVAR   : POINTER FOR THE VARNAM ARRAY IF        FNCTN    1655
CD                               VARNM IS A PROGRAM PRE-DEFINED NAME    FNCTN    1656
CD                               AND VARNAM(IVAR)=VARNM                 FNCTN    1657
CD                      FOUND  : LOGICAL FLAG INDICATING IF THE OPERNAD FNCTN    1658
CD                               NAME IS ONE OF THE PROGRAM PRE-DEFINED FNCTN    1659
CD                               NAME.                                  FNCTN    1660
CD                                                                      FNCTN    1661
CD                                                                      FNCTN    1662
      INCLUDE 'PARAM.INS'                                               FNCTN    1663
        CHARACTER*6 VARNAM(MAXVAR),VARNM                                FNCTN    1664
        LOGICAL FOUND                                                   FNCTN    1665
        FOUND=.FALSE.                                                   FNCTN    1666
          DO 10 I=1,NVAR                                                FNCTN    1667
            IF(VARNM.EQ.VARNAM(I))THEN                                  FNCTN    1668
              IVAR=I                                                    FNCTN    1669
              FOUND=.TRUE.                                              FNCTN    1670
              RETURN                                                    FNCTN    1671
            ENDIF                                                       FNCTN    1672
  10      CONTINUE                                                      FNCTN    1673
C       NEW VARIABLE                                                    FNCTN    1674
        RETURN                                                          FNCTN    1675
        END                                                             FNCTN    1676
        SUBROUTINE CHECKL(LISNM,LISNAM,NLIS,ILIS,FOUND)                 FNCTN    1677
CD                                                                      FNCTN    1678
CD             THE ROUTINE CHECKS IF THE OPERAND'S NAME                 FNCTN    1679
CD             COINCIDE WITH THE NAME OF EXISTING CHANNEL LISTS         FNCTN    1680
CD                                                                      FNCTN    1681
CD             CALL PARAMETERS :                                        FNCTN    1682
CD                                                                      FNCTN    1683
CD                      LISNM  : CHARACTER STRING CONTAINING THE NAME   FNCTN    1684
CD                               OF THE OPERAND                         FNCTN    1685
CD                      LISNAM : CHARACTER ARRAY STORES NAME OF THE     FNCTN    1686
CD                               EXISTING CHANNEL LISTS                 FNCTN    1687
CD                      NLIS   : NUMBER OF EXISTING CHANNEL LIST        FNCTN    1688
CD                      IVAR   : POINTER FOR THE LISNAM ARRAY IF        FNCTN    1689
CD                               LISNM COINCIDES WITH A CHANNEL LIST    FNCTN    1690
CD                               AND LISNAM(IVAR)=LISNM                 FNCTN    1691
CD                      FOUND  : LOGICAL FLAG INDICATING IF THE OPERNAD FNCTN    1692
CD                               NAME COINCIDES WITH AN EXISTING CHANNELFNCTN    1693
CD                               LIST                                   FNCTN    1694
CD                                                                      FNCTN    1695
CD                                                                      FNCTN    1696
      INCLUDE 'PARAM.INS'                                               FNCTN    1697
        CHARACTER*6 LISNAM(MAXLIS),LISNM                                FNCTN    1698
        LOGICAL FOUND                                                   FNCTN    1699
        FOUND=.FALSE.                                                   FNCTN    1700
          DO 10 I=1,NLIS                                                FNCTN    1701
            IF(LISNM.EQ.LISNAM(I))THEN                                  FNCTN    1702
              ILIS=I                                                    FNCTN    1703
              FOUND=.TRUE.                                              FNCTN    1704
              RETURN                                                    FNCTN    1705
            ENDIF                                                       FNCTN    1706
  10      CONTINUE                                                      FNCTN    1707
        RETURN                                                          FNCTN    1708
        END                                                             FNCTN    1709
        SUBROUTINE MAT(XX1,XX2,IFUNC,Y,ERRMSG,XS1,XS2)                  FNCTN    1710
CD                                                                      FNCTN    1711
CD              THIS ROUTINE CARRIES OUT THE BASIC ARITHMETIC           FNCTN    1712
CD              OPERATIONS ON TWO VARIABLES                             FNCTN    1713
CD                                                                      FNCTN    1714
CD              CALLING PARAMETERS :                                    FNCTN    1715
CD                                                                      FNCTN    1716
CD                          XX1    : INCOMING VARIABLE TO BE OPERATED   FNCTN    1717
CD                          XX2    : INCOMING VARIABLE TO BE OPERATED   FNCTN    1718
CD                          IFUNC  : CODE FOR THE ARITHMETIC            FNCTN    1719
CD                                   OPERATION                          FNCTN    1720
CD                          Y      : THE RESULTING VALUE AFTER OPERATED FNCTN    1721
CD                                   ON XX1 AND XX2                     FNCTN    1722
CD                          ERRMSG : ERROR MESSAGE                      FNCTN    1723
CD                          XS1    : 1.0                                FNCTN    1724
CD                          XS2    : 1.0 OR -1.0 DEPENDING ON THE       FNCTN    1725
CD                                   OPERATION                          FNCTN    1726
CD                                                                      FNCTN    1727
        CHARACTER*80 ERRMSG                                             FNCTN    1728
        ERRMSG=' '                                                      FNCTN    1729
        X1=XS1*XX1                                                      FNCTN    1730
        X2=XS2*XX2                                                      FNCTN    1731
        IF(IFUNC.EQ.5)THEN                                              FNCTN    1732
          Y=X1+X2                                                       FNCTN    1733
        ELSE IF(IFUNC.EQ.6)THEN                                         FNCTN    1734
          Y=X1-X2                                                       FNCTN    1735
        ELSE IF((IFUNC.EQ.1).OR.(IFUNC.EQ.4))THEN                       FNCTN    1736
          X=1                                                           FNCTN    1737
          IF(X1.LT.0)THEN                                               FNCTN    1738
            X1=ABS(X1)                                                  FNCTN    1739
            IF(MOD(X2,2.).EQ.0)THEN                                     FNCTN    1740
              X=1.                                                      FNCTN    1741
            ELSE IF(ABS(INT(X2)-X2).LE.0.0)THEN                         FNCTN    1742
              X=-1.                                                     FNCTN    1743
            ELSE                                                        FNCTN    1744
              X=0                                                       FNCTN    1745
              ERRMSG='ERROR: -VE NUMBER TO REAL EXPONENT'               FNCTN    1746
            ENDIF                                                       FNCTN    1747
          ENDIF                                                         FNCTN    1748
          Y=X*X1**X2                                                    FNCTN    1749
        ELSE IF(IFUNC.EQ.2)THEN                                         FNCTN    1750
          IF(ABS(X2).LE.0.0)THEN                                        FNCTN    1751
            ERRMSG='ERROR: DIVISION BY ZERO'                            FNCTN    1752
          ELSE                                                          FNCTN    1753
            Y=X1/X2                                                     FNCTN    1754
          ENDIF                                                         FNCTN    1755
        ELSE IF(IFUNC.EQ.3)THEN                                         FNCTN    1756
          Y=X1*X2                                                       FNCTN    1757
        ENDIF                                                           FNCTN    1758
        RETURN                                                          FNCTN    1759
        END                                                             FNCTN    1760
        SUBROUTINE MAT2(X1,IFUNC,Y,ERRMSG,XS1)                          FNCTN    1761
CD                                                                      FNCTN    1762
CD             THIS ROUTINE CARRIES OUT INTRINSIC FUNCTIONS             FNCTN    1763
CD             OPERATIONS ON THE INCOMING VAIRABLE                      FNCTN    1764
CD                                                                      FNCTN    1765
CD             CALLING PARAMETERS :                                     FNCTN    1766
CD                                                                      FNCTN    1767
CD                         X1     : INCOMING VARIABLE TO BE OPERATED    FNCTN    1768
CD                         IFUNC  : CODE INDICATING THE TYPE OF         FNCTN    1769
CD                                  INTRINSIC FUNCTION                  FNCTN    1770
CD                         Y      : THE VALUE AFTER X1 IS BEING         FNCTN    1771
CD                                  OPERATED                            FNCTN    1772
CD                         ERRMSG : ERROR MESSAGE                       FNCTN    1773
CD                         XS1    : 1.0                                 FNCTN    1774
CD                                                                      FNCTN    1775
        CHARACTER*80 ERRMSG                                             FNCTN    1776
        ERRMSG=' '                                                      FNCTN    1777
        X=X1*XS1                                                        FNCTN    1778
        IF(IFUNC.EQ.10)THEN                                             FNCTN    1779
          IF(ABS(X).GT.1)THEN                                           FNCTN    1780
            ERRMSG='ERROR: ACOS(ABS>1)'                                 FNCTN    1781
          ELSE                                                          FNCTN    1782
            Y=ACOS(X)                                                   FNCTN    1783
          ENDIF                                                         FNCTN    1784
        ELSE IF(IFUNC.EQ.11)THEN                                        FNCTN    1785
          IF(ABS(X).GT.1)THEN                                           FNCTN    1786
            ERRMSG='ERROR: ASIN(ABS>1)'                                 FNCTN    1787
          ELSE                                                          FNCTN    1788
            Y=ASIN(X)                                                   FNCTN    1789
          ENDIF                                                         FNCTN    1790
        ELSE IF(IFUNC.EQ.12)THEN                                        FNCTN    1791
          Y=ATAN(X)                                                     FNCTN    1792
        ELSE IF(IFUNC.EQ.13)THEN                                        FNCTN    1793
          Y=COSH(X)                                                     FNCTN    1794
        ELSE IF(IFUNC.EQ.14)THEN                                        FNCTN    1795
          Y=SINH(X)                                                     FNCTN    1796
        ELSE IF(IFUNC.EQ.15)THEN                                        FNCTN    1797
          Y=TANH(X)                                                     FNCTN    1798
        ELSE IF(IFUNC.EQ.16)THEN                                        FNCTN    1799
          Y=COS(X)                                                      FNCTN    1800
        ELSE IF(IFUNC.EQ.17)THEN                                        FNCTN    1801
          Y=SIN(X)                                                      FNCTN    1802
        ELSE IF(IFUNC.EQ.18)THEN                                        FNCTN    1803
          Y=TAN(X)                                                      FNCTN    1804
        ELSE IF(IFUNC.EQ.19)THEN                                        FNCTN    1805
          IF(X.LE.0.0)THEN                                              FNCTN    1806
            ERRMSG='ERROR: LOG10(<=0)'                                  FNCTN    1807
          ELSE                                                          FNCTN    1808
            Y=LOG10(X)                                                  FNCTN    1809
          ENDIF                                                         FNCTN    1810
        ELSE IF(IFUNC.EQ.20)THEN                                        FNCTN    1811
          IF(X.LE.0.0)THEN                                              FNCTN    1812
            ERRMSG='ERROR: LOG(<=0)'                                    FNCTN    1813
          ELSE                                                          FNCTN    1814
            Y=LOG(X)                                                    FNCTN    1815
          ENDIF                                                         FNCTN    1816
        ELSE IF(IFUNC.EQ.21)THEN                                        FNCTN    1817
          IF(X.LT.0.0)THEN                                              FNCTN    1818
            ERRMSG='ERROR: SQRT(<0)'                                    FNCTN    1819
          ELSE                                                          FNCTN    1820
            Y=SQRT(X)                                                   FNCTN    1821
          ENDIF                                                         FNCTN    1822
        ELSE IF(IFUNC.EQ.22)THEN                                        FNCTN    1823
          Y=ABS(X)                                                      FNCTN    1824
        ELSE IF(IFUNC.EQ.23)THEN                                        FNCTN    1825
          Y=EXP(X)                                                      FNCTN    1826
        ENDIF                                                           FNCTN    1827
        RETURN                                                          FNCTN    1828
        END                                                             FNCTN    1829
