CFPRIME RSDBDA                                                          RSDBDA      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 RSDBDA(IUX,IUY,IEBK)                                   RSDBDA      3
CD                                                                      RSDBDA      4
CD    TO READ SDB DATA.                                                 RSDBDA      5
CD                                                                      RSDBDA      6
      INCLUDE 'PARX.INS'                                                RSDBDA      7
      INCLUDE 'CNFLAG.INS'                                              RSDBDA      8
      INCLUDE 'CNMNEW.INS'                                              RSDBDA      9
      INCLUDE 'CNJPT.INS'                                               RSDBDA     10
      INCLUDE 'CNJDAT.INS'                                              RSDBDA     11
      INCLUDE 'CNTMDA.INS'                                              RSDBDA     12
      INCLUDE 'CNUNIT.INS'                                              RSDBDA     13
      INCLUDE 'CNMSG.INS'                                               RSDBDA     14
      INCLUDE 'CNPARX.INS'                                              RSDBDA     15
*IF FACTS                                                               RSDBDA     16
C                                                                       RSDBDA     17
      CHARACTER*80 SIMBUF                                               RSDBDA     18
      CHARACTER*12 SDBA1                                                RSDBDA     19
      DIMENSION IBUSN(3)                                                RSDBDA     20
      EQUIVALENCE (IBUSN(1),SDBA1)                                      RSDBDA     21
C                                                                       RSDBDA     22
      CHARACTER*40 LCARD(2)                                             RSDBDA     23
      DATA LCARD(1)/'     START OF THE SDB DATA              '/         RSDBDA     24
      DATA LCARD(2)/'                                        '/         RSDBDA     25
C                                                                       RSDBDA     26
      LDEB=(JDEB(8).NE.0)                                               RSDBDA     27
C                                                                       RSDBDA     28
C     READING SDB DATA                                                  RSDBDA     29
C                                                                       RSDBDA     30
  100 CONTINUE                                                          RSDBDA     31
      CALL GETLIN (IUX,SIMBUF)                                          RSDBDA     32
      IF (SIMBUF(1:5).EQ.'EDATA')GOTO 130                               RSDBDA     33
C                                                                       RSDBDA     34
      IF(KLFO.EQ.0)THEN                                                 RSDBDA     35
         READ (SIMBUF,1020,IOSTAT=IOS) NLF1,NDTYPX,IDIVX                RSDBDA     36
         IF(IOS.NE.0) GOTO 900                                          RSDBDA     37
         IF(NLF1.GT.N99999)THEN                                         RSDBDA     38
         WRITE(MSG(2),1070) N99999                                      RSDBDA     39
         MSG(1)=SIMBUF                                                  RSDBDA     40
         CALL PRTMSG(2)                                                 RSDBDA     41
         CALL ASTOP('RSDBDA: FATAL ERROR',19)                           RSDBDA     42
         ENDIF                                                          RSDBDA     43
      ELSE                                                              RSDBDA     44
         READ (SIMBUF,1050,IOSTAT=IOS) SDBA1,NDTYPX,IDIVX               RSDBDA     45
         IF(IOS.NE.0) GOTO 900                                          RSDBDA     46
         CALL CHKBUS(SDBA1,NLF1)                                        RSDBDA     47
      ENDIF                                                             RSDBDA     48
 105  CONTINUE                                                          RSDBDA     49
      LCARD(1)=SIMBUF(1:40)                                             RSDBDA     50
      LCARD(2)=SIMBUF(41:80)                                            RSDBDA     51
C                                                                       RSDBDA     52
      JSDB=JSDB+1                                                       RSDBDA     53
      IF(JSDB.GT.NXSDB)GOTO 120                                         RSDBDA     54
      IF(KLFO.EQ.0) THEN                                                RSDBDA     55
      JSDBDA(JSDB)=JTLN                                                 RSDBDA     56
      ITDDAT(JTLN+1)=NLF1                                               RSDBDA     57
      ITDDAT(JTLN+2)=NDTYPX                                             RSDBDA     58
      IF(IDIVX.LT.1)IDIVX=1                                             RSDBDA     59
      ITDDAT(JTLN+3)=IDIVX                                              RSDBDA     60
      JTLN=JTLN+3                                                       RSDBDA     61
      ELSE                                                              RSDBDA     62
      JSDBDA(JSDB)=JTLN                                                 RSDBDA     63
      ITDDAT(JTLN+1)=IBUSN(1)                                           RSDBDA     64
      ITDDAT(JTLN+2)=IBUSN(2)                                           RSDBDA     65
      ITDDAT(JTLN+3)=IBUSN(3)                                           RSDBDA     66
      ITDDAT(JTLN+4)=NDTYPX                                             RSDBDA     67
      IF(IDIVX.LT.1)IDIVX=1                                             RSDBDA     68
      ITDDAT(JTLN+5)=IDIVX                                              RSDBDA     69
      JTLN=JTLN+5                                                       RSDBDA     70
      ENDIF                                                             RSDBDA     71
C                                                                       RSDBDA     72
      IF (NDTYPX.NE.50) GO TO 110                                       RSDBDA     73
C                                                                       RSDBDA     74
C     USER DEFINED SDB DATA                                             RSDBDA     75
C                                                                       RSDBDA     76
      JTLN1=0                                                           RSDBDA     77
      JTLN=JTLN+2                                                       RSDBDA     78
      NUF=9                                                             RSDBDA     79
      CALL RUDMDA(NUF,IUX,IUY,JTLN1,SIMBUF)                             RSDBDA     80
      IF(NUF.EQ.900) GO TO 900                                          RSDBDA     81
      CALL MCHECK (NLF1,14,JTLN,'RSDBDA')                               RSDBDA     82
      GOTO 100                                                          RSDBDA     83
C                                                                       RSDBDA     84
  110 CONTINUE                                                          RSDBDA     85
      WRITE(MSG(1),1010) JSDB,NDTYPX                                    RSDBDA     86
      CALL PRTMSG(1)                                                    RSDBDA     87
      SIMBUF='RSDBDA: SDB TYPE ERROR'                                   RSDBDA     88
      CALL ASTOP(SIMBUF,22)                                             RSDBDA     89
C                                                                       RSDBDA     90
  120 CONTINUE                                                          RSDBDA     91
      WRITE (MSG(1),1030) NLF1,NXSDB                                    RSDBDA     92
      WRITE(MSG(2),1031)                                                RSDBDA     93
      CALL PRTMSG(2)                                                    RSDBDA     94
      IEBK=1                                                            RSDBDA     95
  130 CONTINUE                                                          RSDBDA     96
C                                                                       RSDBDA     97
      RETURN                                                            RSDBDA     98
C                                                                       RSDBDA     99
  900 CONTINUE                                                          RSDBDA    100
      WRITE(MSG(1),1000)                                                RSDBDA    101
      MSG(2)=LCARD(1)//LCARD(2)                                         RSDBDA    102
      MSG(4)=SIMBUF                                                     RSDBDA    103
      WRITE(MSG(3),1001)                                                RSDBDA    104
      CALL PRTMSG(4)                                                    RSDBDA    105
      SIMBUF='RSDBDA: SDB DATA FORMAT ERROR'                            RSDBDA    106
      CALL ASTOP(SIMBUF,29)                                             RSDBDA    107
C                                                                       RSDBDA    108
 1000 FORMAT(' *** READ ERROR CHECK THE CARD:')                         RSDBDA    109
 1001 FORMAT(11X,'THIS IS THE FIRST CARD OF THE',                       RSDBDA    110
     & ' SDB DEVICE LAST READ:')                                        RSDBDA    111
 1010 FORMAT(' *** ERROR SDB# ',I3,'HAS UNKOWN TYPE',I5)                RSDBDA    112
 1020 FORMAT(3I5)                                                       RSDBDA    113
 1030 FORMAT(1X,'*** ERROR SDB ON BUS ',I4                              RSDBDA    114
     &,'EXCEEDS THE LIMIT OF ',I4)                                      RSDBDA    115
 1031 FORMAT(11X,'INCREASE NXSDB IN PARX.INS')                          RSDBDA    116
 1050 FORMAT (A12,I3,I5)                                                RSDBDA    117
 1070 FORMAT(' *** ERROR BUS NUMBER OF THE ABOVE SDB EXCEEDED',I6)      RSDBDA    118
      END                                                               RSDBDA    119
*ENDIF                                                                  RSDBDA    120
*IF -FACTS                                                              RSDBDA    121
*ENDIF                                                                  RSDBDA    127
