CFPRIME IELOAD                                                          IELOAD      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 IELOAD(IREC,IU,DA,NCARD,MCLD,NNLDS,NB,ERR)             IELOAD      3
CD                                                                      IELOAD      4
CD    TO READ LOAD CARDS FROM IEEE FORMAT DYNAMIC DATA.                 IELOAD      5
CD                                                                      IELOAD      6
      INCLUDE 'CNUNIT.INS'                                              IELOAD      7
      INCLUDE 'CNMSG.INS'                                               IELOAD      8
*IF -MI2                                                                IELOAD      9
      INTEGER*2 MCLD                                                    IELOAD     10
*ENDIF                                                                  IELOAD     11
      DIMENSION MCLD(NB)                                                IELOAD     12
                                                                        IELOAD     13
      CHARACTER*(*) DA(NCARD)                                           IELOAD     14
      CHARACTER*80 LINE                                                 IELOAD     15
                                                                        IELOAD     16
      LOGICAL ERR                                                       IELOAD     17
C                                                                       IELOAD     18
      IBUSNO=0                                                          IELOAD     19
      ERR=.FALSE.                                                       IELOAD     20
      ICMT=0                                                            IELOAD     21
      ISANTY=0                                                          IELOAD     22
C                                                                       IELOAD     23
      CALL GETLIN(IU,LINE)                                              IELOAD     24
      IF (LINE(2:10).NE.'LOAD DATA') THEN                               IELOAD     25
        WRITE(MSG(3),1010) LINE(2:16)                                   IELOAD     26
        WRITE(MSG(1),1000)                                              IELOAD     27
        WRITE(MSG(2),3000)                                              IELOAD     28
        CALL PRTMSG(3)                                                  IELOAD     29
        ERR=.TRUE.                                                      IELOAD     30
        GOTO 9999                                                       IELOAD     31
      ENDIF                                                             IELOAD     32
C                                                                       IELOAD     33
   1  CONTINUE                                                          IELOAD     34
      DO 110 I=1,NCARD                                                  IELOAD     35
        CALL GETLIN(IU,LINE)                                            IELOAD     36
        IF (LINE(2:5).EQ.'-999') GOTO 9999                              IELOAD     37
        IF(I.EQ.1) THEN                                                 IELOAD     38
            READ(LINE(1:5),'(I5)',IOSTAT=IOS)IBUSNO                     IELOAD     39
            IF(IBUSNO.LE.0.OR.IOS.NE.0) GOTO 9990                       IELOAD     40
            READ(LINE(7:18),'(A12)',IOSTAT=IOS)BUSNAM                   IELOAD     41
            IF(IOS.NE.0) GOTO 9995                                      IELOAD     42
        ENDIF                                                           IELOAD     43
        IF (LINE(2:12) .EQ. 'END OF DATA') THEN                         IELOAD     44
            WRITE(MSG(3),1010) LINE(2:16)                               IELOAD     45
            WRITE(MSG(1),1000)                                          IELOAD     46
            WRITE(MSG(2),3020)                                          IELOAD     47
            CALL PRTMSG(3)                                              IELOAD     48
            ERR=.TRUE.                                                  IELOAD     49
            GOTO 9997                                                   IELOAD     50
        ENDIF                                                           IELOAD     51
        ICMT=ICMT+1                                                     IELOAD     52
        DA(ICMT)=LINE                                                   IELOAD     53
 110  CONTINUE                                                          IELOAD     54
C                                                                       IELOAD     55
      ISANTY=ISANTY+ICMT                                                IELOAD     56
      IREC=IREC+1                                                       IELOAD     57
      ISTREC=IREC                                                       IELOAD     58
      WRITE(IU31,REC=IREC)DA(1), DA(2)                                  IELOAD     59
      IREC=IREC+1                                                       IELOAD     60
      WRITE(IU31,REC=IREC)DA(3), DA(4)                                  IELOAD     61
C    ...............................................................    IELOAD     62
C    :SET UP MCLD() POINTERS .. STORE IT FOR NOW                        IELOAD     63
C    :                                                             :    IELOAD     64
      NNLDS=NNLDS+1                                                     IELOAD     65
      MCLD(IBUSNO)=ISTREC                                               IELOAD     66
C    :.............................................................:    IELOAD     67
      GOTO 1                                                            IELOAD     68
C                                                                       IELOAD     69
 9990 CONTINUE                                                          IELOAD     70
      WRITE(MSG(1),3050)                                                IELOAD     71
      MSG(2)=LINE                                                       IELOAD     72
      CALL PRTMSG(2)                                                    IELOAD     73
      ERR=.TRUE.                                                        IELOAD     74
      GOTO 9999                                                         IELOAD     75
 9995 CONTINUE                                                          IELOAD     76
      WRITE(MSG(1),3060)                                                IELOAD     77
      MSG(2)=LINE                                                       IELOAD     78
      CALL PRTMSG(2)                                                    IELOAD     79
      ERR=.TRUE.                                                        IELOAD     80
      GOTO 9999                                                         IELOAD     81
 9997 CONTINUE                                                          IELOAD     82
      WRITE(MSG(1),3080)                                                IELOAD     83
      CALL PRTMSG(1)                                                    IELOAD     84
      ERR=.TRUE.                                                        IELOAD     85
      GOTO 9999                                                         IELOAD     86
                                                                        IELOAD     87
 9999 CONTINUE                                                          IELOAD     88
      ICHECK=MOD(ISANTY,NCARD)                                          IELOAD     89
      IF(ICHECK.NE.0)THEN                                               IELOAD     90
         WRITE(MSG(1),3070) ISANTY                                      IELOAD     91
         CALL PRTMSG(1)                                                 IELOAD     92
      ENDIF                                                             IELOAD     93
      RETURN                                                            IELOAD     94
C                                                                       IELOAD     95
 1000 FORMAT                                                            IELOAD     96
     *(' *** ERROR READING IEEE FORMAT COMPOSITE LOAD DATA CARDS.')     IELOAD     97
 1010 FORMAT(11X,'DATA READ IN IS: ',A)                                 IELOAD     98
 3000 FORMAT(11X,'EXPECTING  "LOAD DATA" IN COLUMNS 2 TO 10.')          IELOAD     99
 3020 FORMAT(11X,'EXPECTING  "-999" TO END LOAD')                       IELOAD    100
 3050 FORMAT(' *** ERROR READING BUS NUMBER OF THIS DATA LINE:')        IELOAD    101
 3060 FORMAT(' *** ERROR READING BUS NAME OF THIS DATA LINE:')          IELOAD    102
 3070 FORMAT(' *** LOAD CARD ERROR. READ IN ',I6,' CARDS. ')            IELOAD    103
 3080 FORMAT(' *** ERROR "-999" CARD MISSING FOR LOAD DATA BLOCK')      IELOAD    104
      END                                                               IELOAD    105
