CFPRIME URREAD                                                          URREAD      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*        Extended Transient-Midterm Stability Program (ETMSP)         *RIGHTE      3
C*        ====================================================         *RIGHTE      4
C*                                                                     *RIGHTE      5
C*       Copyright (C) (1993) Electric Power Research Institute        *RIGHTE      6
C*                                                                     *RIGHTE      7
C* EPRI reserves all rights in the software and associated             *RIGHTE      8
C* documentation as delivered. The software and its associated         *RIGHTE      9
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     10
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     11
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     12
C* of any changes or modifications to the software within two (2)      *RIGHTE     13
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     14
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     15
C* new designation sufficiently different from its then current        *RIGHTE     16
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     17
C* the current software as changed or modified.                        *RIGHTE     18
C*                                                                     *RIGHTE     19
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     20
C* directly from EPRI.                                                 *RIGHTE     21
C*                                                                     *RIGHTE     22
C* This program and supporting materials may be independently available*RIGHTE     23
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     24
C* distribution fee. The EPSC is a service of                          *RIGHTE     25
C*                                                                     *RIGHTE     26
C*                    Power Computing Company                          *RIGHTE     27
C*                    1930 Hi Line                                     *RIGHTE     28
C*                    Dallas, Tx 75207                                 *RIGHTE     29
C*                                                                     *RIGHTE     30
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     31
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     32
C*                                                                     *RIGHTE     33
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     34
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     35
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     36
C*    DOCUMENTATION; OR                                                *RIGHTE     37
C*                                                                     *RIGHTE     38
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     39
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     40
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     41
C*                                                                     *RIGHTE     42
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     43
C* THEREOF.                                                            *RIGHTE     44
C*                                                                     *RIGHTE     45
C***********************************************************************RIGHTE     46
      SUBROUTINE  URREAD (CDATA, RDATA, IDATA, JREPEA)                  URREAD      3
CD -------------------------------------------------------------------  URREAD      4
CD                                                                      URREAD      5
CD              *****     URREAD  ROUTINE   *****                       URREAD      6
CD                                                                      URREAD      7
CD -------------------------------------------------------------------  URREAD      8
CD                                                                      URREAD      9
CD       PURPOSE:  Controls reading of all udc data.                    URREAD     10
CD                                                                      URREAD     11
CD                                                                      URREAD     12
CD       DEFINITION OF LOCAL VARIABLES:                                 URREAD     13
CD                 BNAME  -  current udc block name.                    URREAD     14
CD          (P)    CDATA  -  character input data.                      URREAD     15
CD                 JFIRST -  position of first input that can be        URREAD     16
CD                           repeated.                                  URREAD     17
CD                 FOUND  -  search for data was successful.            URREAD     18
CD                 I      - 'do' loop index.                            URREAD     19
CD          (P)    IDATA  -  integer input data.                        URREAD     20
CD                 LEN    -  length of current udc block name.          URREAD     21
CD          (P)    RDATA  -  real input data.                           URREAD     22
CD          (P)    JREPEA -  indicates number of inputs that may be     URREAD     23
CD                           repeated.                                  URREAD     24
CD                 SUBNAM -  subroutine name.                           URREAD     25
CD                 SVTYPE -  saves the original required data types.    URREAD     26
CD                 TNAME  -  udc type name.                             URREAD     27
CD                 WORD   -  extra input data.                          URREAD     28
CD                                                                      URREAD     29
CD -------------------------------------------------------------------  URREAD     30
      INCLUDE 'CNUNIT.INS'                                              URREAD     31
      INCLUDE 'CNMSG.INS'                                               URREAD     32
      INCLUDE 'PARX.INS'                                                URREAD     33
      INCLUDE 'UDCA.INS'                                                URREAD     34
      INCLUDE 'UDCH.INS'                                                URREAD     35
      INCLUDE 'UDCI.INS'                                                URREAD     36
C                                                                       URREAD     37
      DIMENSION     RDATA(100),IDATA(100)                               URREAD     38
C                                                                       URREAD     39
      LOGICAL       FOUND, READ                                         URREAD     40
C                                                                       URREAD     41
      CHARACTER*72  CDATA(100), WORD                                    URREAD     42
      CHARACTER*20  SUBNAM                                              URREAD     43
      CHARACTER*17  BNAME                                               URREAD     44
      CHARACTER*8   TNAME                                               URREAD     45
      CHARACTER*4   SVTYPE(100)                                         URREAD     46
C                                                                       URREAD     47
C---------------------------------------------------------------------  URREAD     48
C                                                                       URREAD     49
C     Define subroutine name.                                           URREAD     50
C                                                                       URREAD     51
      IF(SDBG)THEN                                                      URREAD     52
         SUBNAM = 'URREAD ROUTINE.'                                     URREAD     53
      ELSE                                                              URREAD     54
         SUBNAM = ' '                                                   URREAD     55
      END IF                                                            URREAD     56
C                                                                       URREAD     57
      IF(TRACE)THEN                                                     URREAD     58
         TNAME = TPNAME(IUDTYP(ISRNUM))                                 URREAD     59
         BNAME = UDNAME(ISRNUM)                                         URREAD     60
         LEN = IUDLEN(ISRNUM)                                           URREAD     61
      ELSE                                                              URREAD     62
         TNAME = TPNAME(IUDTYP(IUDC))                                   URREAD     63
         BNAME = UDNAME(IUDC)                                           URREAD     64
         LEN = IUDLEN(IUDC)                                             URREAD     65
      END IF                                                            URREAD     66
C                                                                       URREAD     67
      IF(EXPAND)THEN                                                    URREAD     68
         NEXT = IBKTOP(IBKLAS)                                          URREAD     69
      END IF                                                            URREAD     70
C                                                                       URREAD     71
C                                                                       URREAD     72
C     Retrieve the necessary data from the input file.                  URREAD     73
C                                                                       URREAD     74
      DO 20 I = 1, NUMSRC                                               URREAD     75
C                                                                       URREAD     76
         SVTYPE(I) = TYPE(I)                                            URREAD     77
C                                                                       URREAD     78
         IF(EXPAND)THEN                                                 URREAD     79
            READ = DTREAD(NEXT)                                         URREAD     80
         ELSE                                                           URREAD     81
            READ = .TRUE.                                               URREAD     82
         END IF                                                         URREAD     83
C                                                                       URREAD     84
         IF(READ)THEN                                                   URREAD     85
            IF(ENDBLK)THEN                                              URREAD     86
C                                                                       URREAD     87
C              Missing required data for this subtype.                  URREAD     88
C                                                                       URREAD     89
               WRITE (MSG(1),9000) SUBNAM                               URREAD     90
               WRITE(MSG(2),9001) TNAME                                 URREAD     91
               WRITE(MSG(3),9002) BNAME(1:LEN)                          URREAD     92
               WRITE(MSG(4),9003) SEARCH(I)                             URREAD     93
               CALL PRTMSG(4)                                           URREAD     94
               IERCNT = IERCNT + 1                                      URREAD     95
               TYPE(I) = ' '                                            URREAD     96
C                                                                       URREAD     97
            ELSE                                                        URREAD     98
C                                                                       URREAD     99
C              Attempt to remove data value from file.                  URREAD    100
C                                                                       URREAD    101
               IF(TYPE(I).EQ.'CHAR')THEN                                URREAD    102
                  CALL URGETC (CDATA(I), FOUND)                         URREAD    103
               ELSEIF(TYPE(I).EQ.'INTE')THEN                            URREAD    104
                  CALL URGETI (IDATA(I), CDATA(I), FOUND)               URREAD    105
               ELSEIF(TYPE(I).EQ.'REAL')THEN                            URREAD    106
                  CALL URGETR (RDATA(I), CDATA(I), FOUND)               URREAD    107
               ELSEIF(TYPE(I).EQ.'RECH')THEN                            URREAD    108
                  CALL URGETX (RDATA(I), CDATA(I), TYPE(I), FOUND)      URREAD    109
               END IF                                                   URREAD    110
            END IF                                                      URREAD    111
         ELSE                                                           URREAD    112
            FOUND = .TRUE.                                              URREAD    113
            TYPE(I) = DTTYPE(NEXT)                                      URREAD    114
            IF(TYPE(I).EQ.'CHAR')THEN                                   URREAD    115
               CDATA(I) = DTCDAT(NEXT)(1:72)                            URREAD    116
            ELSEIF(TYPE(I).EQ.'INTE')THEN                               URREAD    117
               IDATA(I) = IDTIDA(NEXT)                                  URREAD    118
            ELSEIF(TYPE(I).EQ.'REAL')THEN                               URREAD    119
               RDATA(I) = DTRDAT(NEXT)                                  URREAD    120
            END IF                                                      URREAD    121
         END IF                                                         URREAD    122
C                                                                       URREAD    123
         IF(.NOT. FOUND)THEN                                            URREAD    124
            IF(I .NE. NUMSRC.AND.ENDBLK)THEN                            URREAD    125
C                                                                       URREAD    126
C              Missing data for this type, ':' is found before          URREAD    127
C              all the required data is found.                          URREAD    128
C                                                                       URREAD    129
               WRITE (MSG(1),9000) SUBNAM                               URREAD    130
               WRITE(MSG(2),9001) TNAME                                 URREAD    131
               WRITE(MSG(3),9002) BNAME(1:LEN)                          URREAD    132
               WRITE(MSG(4),9003) SEARCH(I)                             URREAD    133
               CALL PRTMSG(4)                                           URREAD    134
               IERCNT = IERCNT + 1                                      URREAD    135
               TYPE(I) = ' '                                            URREAD    136
C                                                                       URREAD    137
            ELSE                                                        URREAD    138
C                                                                       URREAD    139
C              Check if invalid data because of structure processing.   URREAD    140
C                                                                       URREAD    141
               IF(DEFINE.AND.CDATA(I)(1:1).EQ.'%')THEN                  URREAD    142
                  TYPE(I) = 'CHAR'                                      URREAD    143
               ELSE                                                     URREAD    144
C                                                                       URREAD    145
C                 Invalid data is found.                                URREAD    146
C                                                                       URREAD    147
               WRITE (MSG(1),9000) SUBNAM                               URREAD    148
               WRITE(MSG(2),9001) TNAME                                 URREAD    149
               WRITE(MSG(3),9004) BNAME(1:LEN)                          URREAD    150
               WRITE(MSG(4),9003) SEARCH(I)                             URREAD    151
               CALL PRTMSG(4)                                           URREAD    152
                  IERCNT = IERCNT + 1                                   URREAD    153
                  TYPE(I) = ' '                                         URREAD    154
               END IF                                                   URREAD    155
C                                                                       URREAD    156
            END IF                                                      URREAD    157
C                                                                       URREAD    158
         END IF                                                         URREAD    159
C                                                                       URREAD    160
         IF(EXPAND)THEN                                                 URREAD    161
            NEXT = IDTNEX(NEXT)                                         URREAD    162
            IF(NEXT.EQ.0) ENDBLK=.TRUE.                                 URREAD    163
         END IF                                                         URREAD    164
C                                                                       URREAD    165
20    CONTINUE                                                          URREAD    166
C                                                                       URREAD    167
C                                                                       URREAD    168
      IF(EXPAND) ENDBLK=.FALSE.                                         URREAD    169
      IF(JREPEA .NE. 0)THEN                                             URREAD    170
         NUM = NUMSRC                                                   URREAD    171
         JFIRST = NUMSRC - JREPEA + 1                                   URREAD    172
         I = JFIRST                                                     URREAD    173
40       IF(I.EQ.JFIRST.AND.ENDBLK) GOTO 60                             URREAD    174
C                                                                       URREAD    175
            IF(EXPAND)THEN                                              URREAD    176
               READ = DTREAD(NEXT)                                      URREAD    177
            ELSE                                                        URREAD    178
               READ = .TRUE.                                            URREAD    179
            END IF                                                      URREAD    180
C                                                                       URREAD    181
            NUM = NUM + 1                                               URREAD    182
            SEARCH(NUM) = SEARCH(I)                                     URREAD    183
            TYPE(NUM) = SVTYPE(I)                                       URREAD    184
            LENGTH(NUM) = LENGTH(I)                                     URREAD    185
C                                                                       URREAD    186
            IF(READ)THEN                                                URREAD    187
               IF(ENDBLK)THEN                                           URREAD    188
C                                                                       URREAD    189
C                 Missing required data for this subtype.               URREAD    190
C                                                                       URREAD    191
               WRITE (MSG(1),9000) SUBNAM                               URREAD    192
               WRITE(MSG(2),9001) TNAME                                 URREAD    193
               WRITE(MSG(3),9002) BNAME(1:LEN)                          URREAD    194
               WRITE(MSG(4),9003) SEARCH(NUM)                           URREAD    195
               CALL PRTMSG(4)                                           URREAD    196
                  IERCNT = IERCNT + 1                                   URREAD    197
                  TYPE(NUM) = ' '                                       URREAD    198
C                                                                       URREAD    199
               ELSE                                                     URREAD    200
C                                                                       URREAD    201
C                 Attempt to remove data value from file.               URREAD    202
C                                                                       URREAD    203
                  IF(TYPE(NUM).EQ.'CHAR')THEN                           URREAD    204
                     CALL URGETC (CDATA(NUM), FOUND)                    URREAD    205
                  ELSEIF(TYPE(NUM).EQ.'INTE')THEN                       URREAD    206
                     CALL URGETI (IDATA(NUM), CDATA(NUM), FOUND)        URREAD    207
                  ELSEIF(TYPE(NUM).EQ.'REAL')THEN                       URREAD    208
                     CALL URGETR (RDATA(NUM), CDATA(NUM), FOUND)        URREAD    209
                  ELSEIF(TYPE(NUM).EQ.'RECH')THEN                       URREAD    210
                     CALL URGETX (RDATA(NUM), CDATA(NUM), TYPE(NUM),    URREAD    211
     1                            FOUND)                                URREAD    212
                  END IF                                                URREAD    213
               END IF                                                   URREAD    214
C                                                                       URREAD    215
            ELSE                                                        URREAD    216
               FOUND = .TRUE.                                           URREAD    217
               TYPE(NUM) = DTTYPE(NEXT)                                 URREAD    218
               IF(TYPE(NUM).EQ.'CHAR')THEN                              URREAD    219
                 CDATA(NUM) = DTCDAT(NEXT)(1:72)                        URREAD    220
               ELSEIF(TYPE(NUM).EQ.'INTE')THEN                          URREAD    221
                 IDATA(NUM) = IDTIDA(NEXT)                              URREAD    222
               ELSEIF(TYPE(NUM).EQ.'REAL')THEN                          URREAD    223
                 RDATA(NUM) = DTRDAT(NEXT)                              URREAD    224
              END IF                                                    URREAD    225
           END IF                                                       URREAD    226
C                                                                       URREAD    227
           IF(.NOT. FOUND)THEN                                          URREAD    228
               IF(I .NE. NUMSRC.AND.ENDBLK)THEN                         URREAD    229
C                                                                       URREAD    230
C                Missing data for this type, ':' is found before        URREAD    231
C                all the required data is found.                        URREAD    232
C                                                                       URREAD    233
               WRITE (MSG(1),9000) SUBNAM                               URREAD    234
               WRITE(MSG(2),9001) TNAME                                 URREAD    235
               WRITE(MSG(3),9002) BNAME(1:LEN)                          URREAD    236
               WRITE(MSG(4),9003) SEARCH(NUM)                           URREAD    237
               CALL PRTMSG(4)                                           URREAD    238
                 IERCNT = IERCNT + 1                                    URREAD    239
                 TYPE(NUM) = ' '                                        URREAD    240
C                                                                       URREAD    241
              ELSE                                                      URREAD    242
C                                                                       URREAD    243
C                Invalid data is found.                                 URREAD    244
C                                                                       URREAD    245
               WRITE (MSG(1),9000) SUBNAM                               URREAD    246
               WRITE(MSG(2),9001) TNAME                                 URREAD    247
               WRITE(MSG(3),9004) BNAME(1:LEN)                          URREAD    248
               WRITE(MSG(4),9003) SEARCH(NUM)                           URREAD    249
               CALL PRTMSG(4)                                           URREAD    250
                 IERCNT = IERCNT + 1                                    URREAD    251
                 TYPE(NUM) = ' '                                        URREAD    252
C                                                                       URREAD    253
               END IF                                                   URREAD    254
            END IF                                                      URREAD    255
C                                                                       URREAD    256
            IF(I.EQ.NUMSRC)THEN                                         URREAD    257
               I = NUMSRC - JREPEA + 1                                  URREAD    258
            ELSE                                                        URREAD    259
               I = I + 1                                                URREAD    260
            END IF                                                      URREAD    261
C                                                                       URREAD    262
            IF(EXPAND)THEN                                              URREAD    263
               NEXT = IDTNEX(NEXT)                                      URREAD    264
               IF(NEXT.EQ.0) ENDBLK=.TRUE.                              URREAD    265
            END IF                                                      URREAD    266
C                                                                       URREAD    267
            GOTO 40                                                     URREAD    268
60       CONTINUE                                                       URREAD    269
                                                                        URREAD    270
         NUMSRC = NUM                                                   URREAD    271
      END IF                                                            URREAD    272
C                                                                       URREAD    273
C        Search file until ':' is found.                                URREAD    274
C                                                                       URREAD    275
      IF(.NOT. EXPAND)THEN                                              URREAD    276
80       IF(ENDBLK) GOTO 100                                            URREAD    277
            CALL URGETC (WORD, FOUND)                                   URREAD    278
            IF(FOUND.AND.NUMSRC .NE. 0)THEN                             URREAD    279
               WRITE (MSG(1),9000) SUBNAM                               URREAD    280
               WRITE(MSG(2),9001) TNAME                                 URREAD    281
               WRITE(MSG(3),9006) BNAME(1:LEN)                          URREAD    282
               WRITE(MSG(4),9008)                                       URREAD    283
               CALL PRTMSG(4)                                           URREAD    284
               IERCNT = IERCNT + 1                                      URREAD    285
            END IF                                                      URREAD    286
            GOTO 80                                                     URREAD    287
100      CONTINUE                                                       URREAD    288
      END IF                                                            URREAD    289
C                                                                       URREAD    290
C---------------------------------------------------------------------  URREAD    291
C                                                                       URREAD    292
      RETURN                                                            URREAD    293
C                                                                       URREAD    294
C---------------------------------------------------------------------  URREAD    295
C                                                                       URREAD    296
9000  FORMAT(' *** ERROR', 5X, A)                                       URREAD    297
9001  FORMAT(11X,'DURING THE READING OF UDC "', A, '" BLOCKS, THE ',    URREAD    298
     2        'BLOCK')                                                  URREAD    299
9002  FORMAT(11X,'"', A, '" IS MISSING DATA.  ',                        URREAD    300
     3        'UNABLE TO FIND DATA FOR')                                URREAD    301
9003  FORMAT(11X,'"', A, '".  ',                                        URREAD    302
     4        'CHECK YOUR UDC INPUT FILE FOR ERRORS.')                  URREAD    303
9004  FORMAT (11X,'"', A, '" HAS INVALID DATA.  ',                      URREAD    304
     3        'UNABLE TO FIND DATA FOR')                                URREAD    305
9006  FORMAT (11X,'"', A, '" CONTAINS EXTRA DATA.  ',                   URREAD    306
     3        'DID YOU FORGET A')                                       URREAD    307
9008  FORMAT(11X,'":"?  CHECK YOUR UDC ',                               URREAD    308
     4        'INPUT FILE FOR ERRORS.')                                 URREAD    309
C                                                                       URREAD    310
C---------------------------------------------------------------------  URREAD    311
C                                                                       URREAD    312
      END                                                               URREAD    313
